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

# NAG Library Routine DocumentC06DBF

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

C06DBF returns the value of the sum of a Chebyshev series through the routine name.

## 2  Specification

 FUNCTION C06DBF ( X, C, N, S)
 REAL (KIND=nag_wp) C06DBF
 INTEGER N, S REAL (KIND=nag_wp) X, C(N)

## 3  Description

C06DBF evaluates the sum of a Chebyshev series of one of three forms according to the value of the parameter S:
 $S=1: 0.5 c1 + ∑ j=2 n cj T j-1 x , S=2: 0.5 c1 + ∑ 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.0\le x\le 1.0$. Here ${T}_{r}\left(x\right)$ is the Chebyshev polynomial of order $r$ in $x$, defined by $\mathrm{cos}\left(ry\right)$ where $\mathrm{cos}y=x$.
The method used is based upon a three-term recurrence relation; for details see Clenshaw (1962).

## 4  References

Clenshaw C W (1962) Chebyshev Series for Mathematical Functions Mathematical tables HMSO

## 5  Parameters

1:     X – REAL (KIND=nag_wp)Input
On entry: the argument $x$ of the series.
Constraint: $-1.0\le {\mathbf{X}}\le 1.0$.
2:     C(N) – REAL (KIND=nag_wp) arrayInput
On entry: ${\mathbf{C}}\left(\mathit{j}\right)$ must contain the coefficient ${c}_{\mathit{j}}$ of the Chebyshev series, for $\mathit{j}=1,2,\dots ,n$.
3:     N – INTEGERInput
On entry: $n$, the number of terms in the series.
4:     S – INTEGERInput
On entry: must have the value $1$, $2$ or $3$ according to whether the series is general, even or odd respectively (see Section 3). For all other values of S, the routine behaves as though ${\mathbf{S}}=2$.

## 6  Error Indicators and Warnings

If an error is detected in an input parameter C06DBF will act as if a soft noisy exit has been requested (see Section 3.3.4 in the Essential Introduction).

## 7  Accuracy

There may be a loss of significant figures due to cancellation between terms. However, provided that $n$ is not too large, C06DBF yields results which differ little from the best attainable for the available machine precision.

## 8  Further Comments

The time taken increases with $n$.
C06DBF 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 + T1 x + 0.5 T2 x + 0.25 T3 x$
at the point $x=0.5$.

### 9.1  Program Text

Program Text (c06dbfe.f90)

None.

### 9.3  Program Results

Program Results (c06dbfe.r)

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