nag_1d_cheb_eval2 (e02akc) evaluates a polynomial from its Chebyshev series representation, allowing an arbitrary index increment for accessing the array of coefficients.
If supplied with the coefficients
, for
, of a polynomial
of degree
, where
nag_1d_cheb_eval2 (e02akc) returns the value of
at a user-specified value of the variable
. Here
denotes the Chebyshev polynomial of the first kind of degree
with argument
. It is assumed that the independent variable
in the interval
was obtained from your original variable
in the interval
by the linear transformation
The coefficients
may be supplied in the array
a, with any increment between the indices of array elements which contain successive coefficients. This enables the function to be used in surface fitting and other applications, in which the array might have two or more dimensions.
The method employed is based on the three-term recurrence relation due to Clenshaw (see
Clenshaw (1955)), with modifications due to Reinsch and Gentleman (see
Gentleman (1969)). For further details of the algorithm and its use see
Cox (1973) and
Cox and Hayes (1973).
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
The rounding errors are such that the computed value of the polynomial is exact for a slightly perturbed set of coefficients . 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 .
nag_1d_cheb_eval2 (e02akc) is not threaded in any implementation.
Suppose a polynomial has been computed in Chebyshev series form to fit data over the interval
. The following program evaluates the polynomial at
equally spaced points over the interval. (For the purposes of this example,
xmin,
xmax and the Chebyshev coefficients are supplied
.
Normally a program would first read in or generate data and compute the fitted polynomial.)
None.