|
NAG[e02ahc] NAG[nag_1d_cheb_deriv] - Derivative of fitted polynomial in Chebyshev series form
|
|
Calling Sequence
e02ahc(n, xmin, xmax, a, ia1, patm1, adif, iadif1, 'fail'=fail)
nag_1d_cheb_deriv(. . .)
Parameters
|
n - integer;
|
|
|
On entry: , the degree of the given polynomial .
|
|
Constraint: . .
|
|
|
xmin - float;
xmax - float;
|
|
|
On entry: the lower and upper end points respectively of the interval . The Chebyshev-series representation is in terms of the normalized variable , where
|
|
Constraint: . .
|
|
|
a - Vector(1.. , datatype=float[8]);
|
|
|
Note: the dimension, dim, of the array a must be at least .
|
|
|
ia1 - integer;
|
|
|
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 1. However, if, for example, they are stored in , then the value of ia1 must be 3. See also Section [Further Comments].
|
|
Constraint: . .
|
|
|
patm1 - assignable;
|
|
|
Note: On exit the variable patm1 will have a value of type float.
|
|
|
adif - Vector(1.. , datatype=float[8]);
|
|
|
Note: the dimension, dim, of the array adif must be at least .
|
|
|
iadif1 - integer;
|
|
|
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 1. However, if, for example, they are to be stored in , then the value of iadif1 must be 3. See Section [Further Comments].
|
|
Constraint: . .
|
|
|
'fail'=fail - table; (optional)
|
|
|
The NAG error argument, see the documentation for NagError.
|
|
|
|
Description
|
|
|
Purpose
|
|
nag_1d_cheb_deriv (e02ahc) determines the coefficients in the Chebyshev-series representation of the derivative of a polynomial given in Chebyshev-series form.
|
|
Description
|
|
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 (nag_1d_cheb_eval2).
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
|
|
Error Indicators and Warnings
|
|
"NE_BAD_PARAM"
On entry, argument had an illegal value.
"NE_INT"
On entry, . Constraint: .
On entry, . Constraint: .
On entry, . Constraint: .
"NE_INTERNAL_ERROR"
An internal error has occurred in this function. Check the function call and any array sizes. If the call is correct then please consult NAG for assistance.
"NE_REAL_2"
On entry, : , .
|
|
Accuracy
|
|
There is always a loss of precision in numerical differentiation, in this case associated with the multiplication by in the formula quoted in Section [Description].
|
|
Further Comments
|
|
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.
|
|
|
Examples
|
|
>
|
n := 6:
xmin := -0.5:
xmax := 2.5:
ia1 := 1:
iadif1 := 1:
a := Vector([2.53213, 1.13032, 0.2715, 0.04434, 0.00547, 0.00054, 4e-05], datatype=float[8]):
adif := Vector(7, datatype=float[8]):
NAG:-e02ahc(n, xmin, xmax, a, ia1, patm1, adif, iadif1):
|
|
|