[UP]


Manual Reference Pages  - ju_polfit (3)

NAME

ju_polfit(3f) - [M_math] Fit discrete data in a least squares sense by polynomials in one variable.

CONTENTS

Synopsis
Description
Options
Output
Pedigree
Routines Called
References

SYNOPSIS

SUBROUTINE JU_POLFIT (N, X, Y, W, MAXDEG, NDEG, EPS, R, IERR, A)

DESCRIPTION

Given a collection of points X(I) and a set of values Y(I) which correspond to some function or measurement at each of the X(I), subroutine JU_POLFIT computes the weighted least-squares polynomial fits of all degrees up to some degree either specified by the user or determined by the routine. The fits thus obtained are in orthogonal polynomial form. Subroutine JU_PVALUE may then be called to evaluate the fitted polynomials and any of their derivatives at any point. The subroutine PCOEF may be used to express the polynomial fits as powers of (X-C) for any specified point C.

OPTIONS

The parameters for JU_POLFIT are

         N -      the number of data points. The arrays X, Y and W
                  must be dimensioned at least N (N .GE. 1).
         X -      array of values of the independent variable. These
                  values may appear in any order and need not all be
                  distinct.
         Y -      array of corresponding function values.
         W -      array of positive values to be used as weights. If
                  W(1) is negative, JU_POLFIT will set all the weights
                  to 1.0, which means unweighted least squares error
                  will be minimized. To minimize relative error, the
                  user should set the weights to: W(I) = 1.0/Y(I)**2,
                  I = 1,...,N .
         MAXDEG - maximum degree to be allowed for polynomial fit.
                  MAXDEG may be any non-negative integer less than N.
                  Note -- MAXDEG cannot be equal to N-1 when a
                  statistical test is to be used for degree selection,
                  i.e., when input value of EPS is negative.
         EPS -    specifies the criterion to be used in determining
                  the degree of fit to be computed.
                   1. If EPS is input negative, JU_POLFIT chooses the
                      degree based on a statistical F test of
                      significance. One of three possible
                      significance levels will be used: .01, .05 or
                      .10. If EPS=-1.0 , the routine will
                      automatically select one of these levels based
                      on the number of data points and the maximum
                      degree to be considered. If EPS is input as
                      -.01, -.05, or -.10, a significance level of
                      .01, .05, or .10, respectively, will be used.
                   2. If EPS is set to 0., JU_POLFIT computes the
                       polynomials of degrees 0 through MAXDEG .
                   3. If EPS is input positive, EPS is the RMS
                      error tolerance which must be satisfied by the
                      fitted polynomial. JU_POLFIT will increase the
                      degree of fit until this criterion is met or
                      until the maximum degree is reached.

OUTPUT

NDEG degree of the highest degree fit computed.
EPS RMS error of the polynomial of degree NDEG .
R vector of dimension at least NDEG containing values of the fit of degree NDEG at each of the X(I) . Except when the statistical test is used, these values are more accurate than results from subroutine JU_PVALUE normally are.
IERR error flag with the following possible values.

1 -- indicates normal execution, i.e., either
 
(1) the input value of EPS was negative, and the computed polynomial fit of degree NDEG satisfies the specified F test, or
(2) the input value of EPS was 0., and the fits of all degrees up to MAXDEG are complete, or
(3) the input value of EPS was positive, and the polynomial of degree NDEG satisfies the RMS error requirement. 2 -- invalid input parameter. At least one of the input parameters has an illegal value and must be corrected before JU_POLFIT can proceed. Valid input results when the following restrictions are observed N .GE. 1 0 .LE. MAXDEG .LE. N-1 for EPS .GE. 0. 0 .LE. MAXDEG .LE. N-2 for EPS .LT. 0. W(1)=-1.0 or W(I) .GT. 0., I=1,...,N . 3 -- cannot satisfy the RMS error requirement with a polynomial of degree no greater than MAXDEG. Best fit found is of degree MAXDEG . 4 -- cannot satisfy the test for significance using current value of MAXDEG . Statistically, the best fit found is of order NORD . (In this case, NDEG will have one of the values: MAXDEG-2, MAXDEG-1, or MAXDEG). Using a higher value of MAXDEG may result in passing the test.

A work and output array having at least 3N+3MAXDEG+3 locations

    NOTE

JU_POLFIT calculates all fits of degrees up to and including NDEG. Any or all of these fits can be evaluated or expressed as powers of (X-C) using JU_PVALUE and PCOEF after just one call to JU_POLFIT.

PEDIGREE

o PURPOSE @(#) Fit discrete data in a least squares sense by polynomials in one variable.
o LIBRARY SLATEC
o CATEGORY K1A1A2
o TYPE SINGLE PRECISION (JU_POLFIT-S, DPOLFT-D)
o KEYWORDS CURVE FITTING, DATA FITTING, LEAST SQUARES, POLYNOMIAL FIT
o AUTHOR Shampine, L. F., (SNLA) Davenport, S. M., (SNLA) Huddleston, R. E., (SNLL)

*REVISION HISTORY (YYMMDD)

   740601  Date written
   890531  Changed all specific intrinsics to generic. (WRB)
   890531  REVISION DATE from Version 3.2
   891214  Prologue converted to Version 4.0 format. (BAB)
   900315  CALLs to XERROR changed to CALLs to JU_XERMSG. (THJ)
   920501  Reformatted the REFERENCES section. (WRB)
   920527  Corrected erroneous statements in DESCRIPTION. (WRB)

ROUTINES CALLED

ju_pvalue(3f), ju_xermsg(3f)

REFERENCES

L. F. Shampine, S. M. Davenport and R. E. Huddleston, Curve fitting by polynomials in one variable, Report SLA-74-0270, Sandia Laboratories, June 1974.


ju_polfit (3) March 11, 2021
Generated by manServer 1.08 from d988d82b-cfd2-4c00-a66e-bd50f8880c14 using man macros.