e02afc 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.
The function may be called by the names: e02afc, nag_fit_dim1_cheb_glp or nag_1d_cheb_interp_fit.
e02afc 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 you can choose the data abscissae, 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.
The rounding errors committed are such that the computed coefficients are exact for a slightly perturbed set of ordinates . The ratio of the sum of the absolute values of the to the sum of the absolute values of the is less than a small multiple of , where is the machine precision.
8Parallelism and Performance
Background information to multithreading can be found in the Multithreading documentation.
e02afc is not threaded in any implementation.
The time taken by e02afc is approximately proportional to .
Determine the Chebyshev coefficients of the polynomial which interpolates the data , for , where and . Evaluate, for comparison with the values of , the resulting Chebyshev series at , for .
The example program supplied is written in a general form that will enable polynomial interpolations of arbitrary data at the cosine points , for to be obtained for any (). Note that e02aec is used to evaluate the interpolating polynomial. The program is self-starting in that any number of datasets can be supplied.