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

naginterfaces.library.fit.dim1_cheb_eval2(n, xmin, xmax, a, ia1, x)[source]

dim1_cheb_eval2 evaluates a polynomial from its Chebyshev series representation, allowing an arbitrary index increment for accessing the array of coefficients.

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

https://www.nag.com/numeric/nl/nagdoc_28.6/flhtml/e02/e02akf.html

Parameters
nint

, the degree of the given polynomial .

xminfloat

The lower and upper end points respectively of the interval . The Chebyshev series representation is in terms of the normalized variable , where

xmaxfloat

The lower and upper end points respectively of the interval . The Chebyshev series representation is in terms of the normalized variable , where

afloat, array-like, shape

The Chebyshev coefficients of the polynomial . Specifically, element must contain the coefficient , for . Only these elements will be accessed.

ia1int

The index increment of . Most frequently, the Chebyshev coefficients are stored in adjacent elements of , and must be set to . However, if, for example, they are stored in , the value of must be .

xfloat

The argument at which the polynomial is to be evaluated.

Returns
resultfloat

The value of the polynomial .

Raises
NagValueError
(errno )

On entry, and .

Constraint: .

(errno )

On entry, , and .

Constraint: .

(errno )

On entry, .

Constraint: .

(errno )

On entry, >.

Constraint: .

(errno )

On entry, does not lie in : , and .

Notes

If supplied with the coefficients , for , of a polynomial of degree , where

dim1_cheb_eval2 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 , 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).

References

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

Cox, M G, 1973, A data-fitting package for the non-specialist user, NPL Report NAC 40, National Physical Laboratory

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