NAG Library Routine Document
C06DCF
Note: before using this routine, please read the Users' Note for your implementation to check the interpretation of bold italicised terms and other implementation-dependent details.
1 Purpose
C06DCF evaluates a polynomial from its Chebyshev series representation at a set of points.
2 Specification
INTEGER
LX, N, S, IFAIL
REAL (KIND=nag_wp)
X(LX), XMIN, XMAX, C(N), RES(LX)
3 Description
C06DCF evaluates, at each point in a given set
, the sum of a Chebyshev series of one of three forms according to the value of the parameter
S:
:
:
:
where
lies in the range
. Here
is the Chebyshev polynomial of order
in
, defined by
where
.
It is assumed that the independent variable
in the interval
was obtained from your original variable
, a set of real numbers in the interval
, by the linear transformation
The method used is based upon a three-term recurrence relation; for details see
Clenshaw (1962).
The coefficients
are normally generated by other routines, for example they may be those returned by the interpolation routine
E01AEF (in vector
A), by a least squares fitting routine in
Chapter E02, or as the solution of a boundary value problem by
D02JAF,
D02JBF or
D02UEF.
4 References
Clenshaw C W (1962) Chebyshev Series for Mathematical Functions Mathematical tables HMSO
5 Parameters
- 1: X(LX) – REAL (KIND=nag_wp) arrayInput
On entry: , the set of arguments of the series.
Constraint:
, for .
- 2: LX – INTEGERInput
On entry: the number of evaluation points in .
Constraint:
.
- 3: XMIN – REAL (KIND=nag_wp)Input
- 4: 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
Constraint:
.
- 5: C(N) – REAL (KIND=nag_wp) arrayInput
On entry: must contain the coefficient of the Chebyshev series, for .
- 6: N – INTEGERInput
On entry: , the number of terms in the series.
Constraint:
.
- 7: S – INTEGERInput
On entry: determines the series (see
Section 3).
- The series is general.
- The series is even.
- The series is odd.
Constraint:
, or .
- 8: RES(LX) – REAL (KIND=nag_wp) arrayOutput
On exit: the Chebyshev series evaluated at the set of points .
- 9: 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
On entry, .
On entry, .
On entry, , or .
On entry, .
On entry, an element of
X is less than
XMIN or greater than
XMAX.
7 Accuracy
There may be a loss of significant figures due to cancellation between terms. However, provided that is not too large, C06DCF yields results which differ little from the best attainable for the available machine precision.
The time taken increases with .
C06DCF has been prepared in the present form to complement a number of integral equation solving routines which use Chebyshev series methods, e.g.,
D05AAF and
D05ABF.
9 Example
This example evaluates
at the points
.
9.1 Program Text
Program Text (c06dcfe.f90)
9.2 Program Data
Program Data (c06dcfe.d)
9.3 Program Results
Program Results (c06dcfe.r)