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
${a}_{\mathit{i}}$, for
$\mathit{i}=0,1,\dots ,n$, of a polynomial
$p\left(x\right)$ of degree
$n$, where
the routine returns the coefficients
${\stackrel{-}{a}}_{\mathit{i}}$, for
$\mathit{i}=0,1,\dots ,n-1$, of the polynomial
$q\left(x\right)$ of degree
$n-1$, where
Here
${T}_{j}\left(\stackrel{-}{x}\right)$ denotes the Chebyshev polynomial of the first kind of degree
$j$ with argument
$\stackrel{-}{x}$. It is assumed that the normalized variable
$\stackrel{-}{x}$ in the interval
$\left[-1,+1\right]$ was obtained from your original variable
$x$ in the interval
$\left[{x}_{\mathrm{min}},{x}_{\mathrm{max}}\right]$ by the linear transformation
and that you require the derivative to be with respect to the variable
$x$. If the derivative with respect to
$\stackrel{-}{x}$ is required, set
${x}_{\mathrm{max}}=1$ and
${x}_{\mathrm{min}}=-1$.
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
$x$. Initially setting
${\stackrel{-}{a}}_{n+1}={\stackrel{-}{a}}_{n}=0$, the routine forms successively
If on entry
${\mathbf{ifail}}=0$ or
$-1$, explanatory error messages are output on the current error message unit (as defined by
x04aaf).
There is always a loss of precision in numerical differentiation, in this case associated with the multiplication by
$2i$ in the formula quoted in
Section 3.
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
$\left[-0.5,2.5\right]$. The following program evaluates the first and second derivatives of this polynomial at
$4$ 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.)
None.