# NAG FL Interfaced02uzf (bvp_​ps_​lin_​cheb_​eval)

## ▸▿ Contents

Settings help

FL Name Style:

FL Specification Language:

## 1Purpose

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

## 2Specification

Fortran Interface
 Subroutine d02uzf ( k, x, t,
 Integer, Intent (In) :: k Integer, Intent (Inout) :: ifail Real (Kind=nag_wp), Intent (In) :: x Real (Kind=nag_wp), Intent (Out) :: t
#include <nag.h>
 void d02uzf_ (const Integer *k, const double *x, double *t, Integer *ifail)
The routine may be called by the names d02uzf or nagf_ode_bvp_ps_lin_cheb_eval.

## 3Description

d02uzf 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}$Real (Kind=nag_wp) Input
On entry: the point at which to evaluate the polynomial.
Constraint: $-1.0\le {\mathbf{x}}\le 1.0$.
3: $\mathbf{t}$Real (Kind=nag_wp) Output
On exit: the value, $T$, of the Chebyshev polynomial order $k$ evaluated at $x$.
4: $\mathbf{ifail}$Integer Input/Output
On entry: ifail must be set to $0$, $-1$ or $1$ to set behaviour on detection of an error; these values have no effect when no error is detected.
A value of $0$ causes the printing of an error message and program execution will be halted; otherwise program execution continues. A value of $-1$ means that an error message is printed while a value of $1$ means that it is not.
If halting is not appropriate, the value $-1$ or $1$ is recommended. If message printing is undesirable, then the value $1$ is recommended. Otherwise, the value $0$ is recommended. When the value $-\mathbf{1}$ or $\mathbf{1}$ is used it is essential to test the value of ifail on exit.
On exit: ${\mathbf{ifail}}={\mathbf{0}}$ unless the routine detects an error or a warning has been flagged (see Section 6).

## 6Error Indicators and Warnings

If on entry ${\mathbf{ifail}}=0$ or $-1$, explanatory error messages are output on the current error message unit (as defined by x04aaf).
Errors or warnings detected by the routine:
${\mathbf{ifail}}=1$
On entry, ${\mathbf{k}}=⟨\mathit{\text{value}}⟩$.
Constraint: ${\mathbf{k}}\ge 0$.
${\mathbf{ifail}}=2$
On entry, ${\mathbf{x}}=⟨\mathit{\text{value}}⟩$.
Constraint: $-1.0\le {\mathbf{x}}\le 1.0$.
${\mathbf{ifail}}=-99$
An unexpected error has been triggered by this routine. Please contact NAG.
See Section 7 in the Introduction to the NAG Library FL Interface for further information.
${\mathbf{ifail}}=-399$
Your licence key may have expired or may not have been installed correctly.
See Section 8 in the Introduction to the NAG Library FL Interface for further information.
${\mathbf{ifail}}=-999$
Dynamic memory allocation failed.
See Section 9 in the Introduction to the NAG Library FL Interface for further information.

## 7Accuracy

The accuracy should be close to machine precision.

## 8Parallelism and Performance

d02uzf 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 d02ucf. At each of a set of new grid points in the domain of the function d02uzf 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 (d02uzfe.f90)

### 10.2Program Data

Program Data (d02uzfe.d)

### 10.3Program Results

Program Results (d02uzfe.r)