The function may be called by the names: e02ahc, nag_fit_dim1_cheb_deriv or nag_1d_cheb_deriv.
e02ahc forms the polynomial which is the derivative of a given polynomial. Both the original polynomial and its derivative are represented in Chebyshev series form. Given the coefficients , for , of a polynomial of degree , where
the function returns the coefficients , for , of the polynomial of degree , where
Here denotes the Chebyshev polynomial of the first kind of degree with argument . It is assumed that the normalized variable in the interval was obtained from your original variable in the interval by the linear transformation
and that you require the derivative to be with respect to the variable . If the derivative with respect to is required, set and .
Values of the derivative can subsequently be computed, from the coefficients obtained, by using e02akc.
The method employed is that of Chebyshev series (see Chapter 8 of Modern Computing Methods (1961)), modified to obtain the derivative with respect to . Initially setting , the function forms successively
Modern Computing Methods (1961) Chebyshev-series NPL Notes on Applied Science16 (2nd Edition) HMSO
1: – IntegerInput
On entry: , the degree of the given polynomial .
2: – doubleInput
3: – doubleInput
On entry: the lower and upper end points respectively of the interval . The Chebyshev series representation is in terms of the normalized variable , where
4: – const doubleInput
Note: the dimension, dim, of the array a
must be at least
On entry: the Chebyshev coefficients of the polynomial . Specifically, element
of a must contain the coefficient , for . Only these elements will be accessed.
5: – IntegerInput
On entry: the index increment of a. Most frequently the Chebyshev coefficients are stored in adjacent elements of a, and ia1 must be set to . However, if for example, they are stored in , the value of ia1 must be . See also Section 9.
6: – double *Output
On exit: the value of . If this value is passed to the integration function e02ajc with the coefficients of , the original polynomial is recovered, including its constant coefficient.
7: – doubleOutput
Note: the dimension, dim, of the array adif
must be at least
On exit: the Chebyshev coefficients of the derived polynomial . (The differentiation is with respect to the variable .) Specifically, element
of adif contains the coefficient , for . Additionally, element is set to zero.
8: – IntegerInput
On entry: the index increment of adif. Most frequently the Chebyshev coefficients are required in adjacent elements of adif, and iadif1 must be set to . However, if, for example, they are to be stored in , the value of iadif1 must be . See Section 9.
9: – NagError *Input/Output
The NAG error argument (see Section 7 in the Introduction to the NAG Library CL Interface).
6Error Indicators and Warnings
Dynamic memory allocation failed.
See Section 3.1.2 in the Introduction to the NAG Library CL Interface for further information.
On entry, argument had an illegal value.
On entry, .
On entry, .
On entry, .
An internal error has occurred in this function. Check the function call and any array sizes. If the call is correct then please contact NAG for assistance.
See Section 7.5 in the Introduction to the NAG Library CL Interface for further information.
Your licence key may have expired or may not have been installed correctly.
See Section 8 in the Introduction to the NAG Library CL Interface for further information.
On entry, and .
There is always a loss of precision in numerical differentiation, in this case associated with the multiplication by in the formula quoted in Section 3.
8Parallelism and Performance
e02ahc is not threaded in any implementation.
The time taken is approximately proportional to .
The increments ia1, iadif1 are included as arguments to give a degree of flexibility which, for example, allows a polynomial in two variables to be differentiated with respect to either variable without rearranging the coefficients.
Suppose a polynomial has been computed in Chebyshev series form to fit data over the interval . The following program evaluates the first and second derivatives of this polynomial at equally spaced points over the interval. (For the purposes of this example, xmin, xmax and the Chebyshev coefficients are simply supplied.
Normally a program would first read in or generate data and compute the fitted polynomial.)