naginterfaces.library.fit.dim1_​cheb_​eval

naginterfaces.library.fit.dim1_cheb_eval(a, xcap)[source]

dim1_cheb_eval evaluates a polynomial from its Chebyshev series representation.

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

https://www.nag.com/numeric/nl/nagdoc_28.5/flhtml/e02/e02aef.html

Parameters
afloat, array-like, shape

must be set to the value of the th coefficient in the series, for .

xcapfloat

, the argument at which the polynomial is to be evaluated. It should lie in the range to , but a value just outside this range is permitted (see Exceptions) to allow for possible rounding errors committed in the transformation from to discussed in Notes. Provided the recommended form of the transformation is used, a successful exit is thus assured whenever the value of lies in the range to .

Returns
pfloat

The value of the polynomial.

Raises
NagValueError
(errno )

On entry, and .

Constraint: , where is machine precision.

(errno )

On entry, .

Constraint: .

Notes

In the NAG Library the traditional C interface for this routine uses a different algorithmic base. Please contact NAG if you have any questions about compatibility.

dim1_cheb_eval evaluates the polynomial

for any value of satisfying . Here denotes the Chebyshev polynomial of the first kind of degree with argument . The value of is prescribed by you.

In practice, the variable will usually have been obtained from an original variable , where and

Note that this form of the transformation should be used computationally rather than the mathematical equivalent

since the former guarantees that the computed value of differs from its true value by at most , where is the machine precision, whereas the latter has no such guarantee.

The method employed is based on the three-term recurrence relation due to Clenshaw (1955), with modifications to give greater numerical stability due to Reinsch and Gentleman (see Gentleman (1969)).

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

References

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

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