E02AHF 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 routine 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 E02AKF.
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 routine forms successively
Modern Computing Methods (1961) Chebyshev-series NPL Notes on Applied Science16 (2nd Edition) HMSO
1: NP1 – INTEGERInput
On entry: , where is the degree of the given polynomial . Thus NP1 is the number of coefficients in this polynomial.
2: XMIN – REAL (KIND=nag_wp)Input
3: XMAX – REAL (KIND=nag_wp)Input
On entry: the lower and upper end points respectively of the interval . The Chebyshev series representation is in terms of the normalized variable , where
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 , then the value of IA1 must be . See also Section 8.
6: LA – INTEGERInput
On entry: the dimension of the array A as declared in the (sub)program from which E02AHF is called.
7: PATM1 – REAL (KIND=nag_wp)Output
On exit: the value of . If this value is passed to the integration routine E02AJF with the coefficients of , then the original polynomial is recovered, including its constant coefficient.
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. A call of the routine may have the array name ADIF the same as A, provided that note is taken of the order in which elements are overwritten, when choosing the starting elements and increments IA1 and IADIF1, i.e., the coefficients must be intact after coefficient is stored. In particular, it is possible to overwrite the completely by having , and the actual arrays for A and ADIF identical.
9: IADIF1 – 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 , then the value of IADIF1 must be . See Section 8.
10: LADIF – INTEGERInput
On entry: the dimension of the array ADIF as declared in the (sub)program from which E02AHF is called.
11: IFAIL – INTEGERInput/Output
On entry: IFAIL must be set to , . If you are unfamiliar with this parameter you should refer to Section 3.3 in the Essential Introduction for details.
For environments where it might be inappropriate to halt program execution when an error is detected, the value is recommended. If the output of error messages is undesirable, then the value is recommended. Otherwise, if you are not familiar with this parameter, the recommended value is . When the value is used it is essential to test the value of IFAIL on exit.
On exit: unless the routine detects an error or a warning has been flagged (see Section 6).
6 Error Indicators and Warnings
If on entry or , explanatory error messages are output on the current error message unit (as defined by X04AAF).
Errors or warnings detected by the routine:
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.
8 Further Comments
The time taken is approximately proportional to .
The increments IA1, IADIF1 are included as parameters 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
in DATA statements.
Normally a program would first read in or generate data and compute the fitted polynomial.)