C06DCF (PDF version)
C06 Chapter Contents
C06 Chapter Introduction
NAG Library Manual

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.

+ Contents

    1  Purpose
    7  Accuracy

1  Purpose

C06DCF evaluates a polynomial from its Chebyshev series representation at a set of points.

2  Specification

SUBROUTINE C06DCF ( X, LX, XMIN, XMAX, C, N, S, RES, IFAIL)
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 X, the sum of a Chebyshev series of one of three forms according to the value of the parameter S:
S=1: 0.5c1+ j=2 n cj Tj-1 x-  
S=2: 0.5c1+ j=2 n cj T 2j-2 x-  
S=3: j=1 n cj T 2j-1 x-  
where x- lies in the range -1.0x-1.0. Here Trx is the Chebyshev polynomial of order r in x-, defined by cosry where cosy=x-.
It is assumed that the independent variable x- in the interval -1.0,+1.0 was obtained from your original variable xX, a set of real numbers in the interval xmin,xmax, by the linear transformation
x- = 2x-xmax+xmin xmax-xmin .
The method used is based upon a three-term recurrence relation; for details see Clenshaw (1962).
The coefficients cj 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: xX, the set of arguments of the series.
Constraint: XMINXiXMAX, for i=1,2,,LX.
2:     LX – INTEGERInput
On entry: the number of evaluation points in X.
Constraint: LX1.
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 xmin,xmax. The Chebyshev series representation is in terms of the normalized variable x-, where
x- = 2x-xmax+xmin xmax-xmin .
Constraint: XMIN<XMAX.
5:     C(N) – REAL (KIND=nag_wp) arrayInput
On entry: Cj must contain the coefficient cj of the Chebyshev series, for j=1,2,,n.
6:     N – INTEGERInput
On entry: n, the number of terms in the series.
Constraint: N1.
7:     S – INTEGERInput
On entry: determines the series (see Section 3).
S=1
The series is general.
S=2
The series is even.
S=3
The series is odd.
Constraint: S=1, 2 or 3.
8:     RES(LX) – REAL (KIND=nag_wp) arrayOutput
On exit: the Chebyshev series evaluated at the set of points X.
9:     IFAIL – INTEGERInput/Output
On entry: IFAIL must be set to 0, -1​ or ​1. 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 -1​ or ​1 is recommended. If the output of error messages is undesirable, then the value 1 is recommended. Otherwise, if you are not familiar with this parameter, the recommended value is 0. When the value -1​ or ​1 is used it is essential to test the value of IFAIL on exit.
On exit: IFAIL=0 unless the routine detects an error or a warning has been flagged (see Section 6).

6  Error Indicators and Warnings

IFAIL=1
On entry, LX<1.
IFAIL=2
On entry, N<1.
IFAIL=3
On entry, S1, 2 or 3.
IFAIL=4
On entry, XMAXXMIN.
IFAIL=5
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 n is not too large, C06DCF yields results which differ little from the best attainable for the available machine precision.

8  Further Comments

The time taken increases with n.
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
0.5+ T1x+ 0.5T2x+ 0.25T3x
at the points X=0.5,1.0,-0.2.

9.1  Program Text

Program Text (c06dcfe.f90)

9.2  Program Data

Program Data (c06dcfe.d)

9.3  Program Results

Program Results (c06dcfe.r)


C06DCF (PDF version)
C06 Chapter Contents
C06 Chapter Introduction
NAG Library Manual

© The Numerical Algorithms Group Ltd, Oxford, UK. 2012