# naginterfaces.library.fit.dim1_​cheb_​glp¶

naginterfaces.library.fit.dim1_cheb_glp(f)[source]

dim1_cheb_glp computes the coefficients of a polynomial, in its Chebyshev series form, which interpolates (passes exactly through) data at a special set of points. Least squares polynomial approximations can also be obtained.

For full information please refer to the NAG Library document for e02af

https://www.nag.com/numeric/nl/nagdoc_29.2/flhtml/e02/e02aff.html

Parameters
ffloat, array-like, shape

For , must contain the value of the dependent variable (ordinate) corresponding to the value

of the independent variable (abscissa) , or equivalently to the value

of your original variable . Here and are respectively the upper and lower ends of the range over which you wish to interpolate.

Returns
afloat, ndarray, shape

is the coefficient in the interpolating polynomial, for .

Raises
NagValueError
(errno )

On entry, .

Constraint: .

Notes

dim1_cheb_glp computes the coefficients , for , in the Chebyshev series

which interpolates the data at the points

Here denotes the Chebyshev polynomial of the first kind of degree with argument . The use of these points minimizes the risk of unwanted fluctuations in the polynomial and is recommended when the data abscissae can be chosen by you, e.g., when the data is given as a graph. For further advantages of this choice of points, see Clenshaw (1962).

In terms of your original variables, say, the values of at which the data are to be provided are

where and are respectively the upper and lower ends of the range of over which you wish to interpolate.

Truncation of the resulting series after the term involving , say, yields a least squares approximation to the data. This approximation, , say, is the polynomial of degree which minimizes

where the residual , for .

The method employed is based on the application of the three-term recurrence relation due to Clenshaw (1955) for the evaluation of the defining expression for the Chebyshev coefficients (see, for example, Clenshaw (1962)). The modifications to this recurrence relation suggested by Reinsch and Gentleman (see Gentleman (1969)) are used to give greater numerical stability.

For further details of the algorithm and its use see Cox (1974) and Cox and Hayes (1973).

Subsequent evaluation of the computed polynomial, perhaps truncated after an appropriate number of terms, should be carried out using dim1_cheb_eval().

References

Clenshaw, C W, 1955, A note on the summation of Chebyshev series, Math. Tables Aids Comput. (9), 118–120

Clenshaw, C W, 1962, Chebyshev Series for Mathematical Functions, Mathematical tables, HMSO

Cox, M G, 1974, A data-fitting package for the non-specialist user, Software for Numerical Mathematics, (ed D J Evans), Academic Press

Cox, M G and Hayes, J G, 1973, Curve fitting: a guide and suite of algorithms for the non-specialist user, NPL Report NAC26, National Physical Laboratory

Gentleman, W M, 1969, An error analysis of Goertzel’s (Watt’s) method for computing Fourier coefficients, Comput. J. (12), 160–165