# NAG CL Interfaced02uzc (bvp_​ps_​lin_​cheb_​eval)

Settings help

CL Name Style:

## 1Purpose

d02uzc returns the value of the $k$th Chebyshev polynomial evaluated at a point $x\in \left[-1,1\right]$. d02uzc is primarily a utility function for use by the Chebyshev boundary value problem solvers.

## 2Specification

 #include
 void d02uzc (Integer k, double x, double *t, NagError *fail)
The function may be called by the names: d02uzc or nag_ode_bvp_ps_lin_cheb_eval.

## 3Description

d02uzc returns the value, $T$, of the $k$th Chebyshev polynomial evaluated at a point $x\in \left[-1,1\right]$; that is, $T=\mathrm{cos}\left(k×\mathrm{arccos}\left(x\right)\right)$.

## 4References

Trefethen L N (2000) Spectral Methods in MATLAB SIAM

## 5Arguments

1: $\mathbf{k}$Integer Input
On entry: the order of the Chebyshev polynomial.
Constraint: ${\mathbf{k}}\ge 0$.
2: $\mathbf{x}$double Input
On entry: the point at which to evaluate the polynomial.
Constraint: $-1.0\le {\mathbf{x}}\le 1.0$.
3: $\mathbf{t}$double * Output
On exit: the value, $T$, of the Chebyshev polynomial order $k$ evaluated at $x$.
4: $\mathbf{fail}$NagError * Input/Output
The NAG error argument (see Section 7 in the Introduction to the NAG Library CL Interface).

## 6Error Indicators and Warnings

NE_ALLOC_FAIL
Dynamic memory allocation failed.
See Section 3.1.2 in the Introduction to the NAG Library CL Interface for further information.
On entry, argument $⟨\mathit{\text{value}}⟩$ had an illegal value.
NE_INT
On entry, ${\mathbf{k}}=⟨\mathit{\text{value}}⟩$.
Constraint: ${\mathbf{k}}\ge 0$.
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 contact NAG for assistance.
See Section 7.5 in the Introduction to the NAG Library CL Interface for further information.
NE_NO_LICENCE
Your licence key may have expired or may not have been installed correctly.
See Section 8 in the Introduction to the NAG Library CL Interface for further information.
NE_REAL
On entry, ${\mathbf{x}}=⟨\mathit{\text{value}}⟩$.
Constraint: $-1.0\le {\mathbf{x}}\le 1.0$.

## 7Accuracy

The accuracy should be close to machine precision.

## 8Parallelism and Performance

d02uzc is not threaded in any implementation.

None.

## 10Example

A set of Chebyshev coefficients is obtained for the function $x+\mathrm{exp}\left(-x\right)$ defined on $\left[-0.24×\pi ,0.5×\pi \right]$ using d02ucc. At each of a set of new grid points in the domain of the function d02uzc is used to evaluate each Chebshev polynomial in the series representation. The values obtained are multiplied to the Chebyshev coefficients and summed to obtain approximations to the given function at the new grid points.

### 10.1Program Text

Program Text (d02uzce.c)

### 10.2Program Data

Program Data (d02uzce.d)

### 10.3Program Results

Program Results (d02uzce.r)