# NAG Library Function Document

## 1Purpose

nag_ode_bvp_ps_lin_cgl_grid (d02ucc) returns the Chebyshev Gauss–Lobatto grid points on $\left[a,b\right]$.

## 2Specification

 #include #include
 void nag_ode_bvp_ps_lin_cgl_grid (Integer n, double a, double b, double x[], NagError *fail)

## 3Description

nag_ode_bvp_ps_lin_cgl_grid (d02ucc) returns the Chebyshev Gauss–Lobatto grid points on $\left[a,b\right]$. The Chebyshev Gauss–Lobatto points on $\left[-1,1\right]$ are computed as ${t}_{\mathit{i}}=-\mathrm{cos}\left(\frac{\left(\mathit{i}-1\right)\pi }{n}\right)$, for $\mathit{i}=1,2,\dots ,n+1$. The Chebyshev Gauss–Lobatto points on an arbitrary domain $\left[a,b\right]$ are:
 $xi = b-a 2 ti + a+b 2 , i=1,2,…,n+1 .$

## 4References

Trefethen L N (2000) Spectral Methods in MATLAB SIAM

## 5Arguments

1:    $\mathbf{n}$IntegerInput
On entry: $n$, where the number of grid points is $n+1$. This is also the largest order of Chebyshev polynomial in the Chebyshev series to be computed.
Constraint: ${\mathbf{n}}>0$ and n is even.
2:    $\mathbf{a}$doubleInput
On entry: $a$, the lower bound of domain $\left[a,b\right]$.
Constraint: ${\mathbf{a}}<{\mathbf{b}}$.
3:    $\mathbf{b}$doubleInput
On entry: $b$, the upper bound of domain $\left[a,b\right]$.
Constraint: ${\mathbf{b}}>{\mathbf{a}}$.
4:    $\mathbf{x}\left[{\mathbf{n}}+1\right]$doubleOutput
On exit: the Chebyshev Gauss–Lobatto grid points, ${x}_{\mathit{i}}$, for $\mathit{i}=1,2,\dots ,n+1$, on $\left[a,b\right]$.
5:    $\mathbf{fail}$NagError *Input/Output
The NAG error argument (see Section 3.7 in How to Use the NAG Library and its Documentation).

## 6Error Indicators and Warnings

NE_ALLOC_FAIL
Dynamic memory allocation failed.
See Section 2.3.1.2 in How to Use the NAG Library and its Documentation for further information.
On entry, argument $〈\mathit{\text{value}}〉$ had an illegal value.
NE_INT
On entry, ${\mathbf{n}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{n}}>0$.
On entry, ${\mathbf{n}}=〈\mathit{\text{value}}〉$.
Constraint: n is even.
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 2.7.6 in How to Use the NAG Library and its Documentation for further information.
NE_NO_LICENCE
Your licence key may have expired or may not have been installed correctly.
See Section 2.7.5 in How to Use the NAG Library and its Documentation for further information.
NE_REAL_2
On entry, ${\mathbf{a}}=〈\mathit{\text{value}}〉$ and ${\mathbf{b}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{a}}<{\mathbf{b}}$.

## 7Accuracy

The Chebyshev Gauss–Lobatto grid points computed should be accurate to within a small multiple of machine precision.

## 8Parallelism and Performance

nag_ode_bvp_ps_lin_cgl_grid (d02ucc) is not threaded in any implementation.

The number of operations is of the order $n\mathrm{log}\left(n\right)$ and there are no internal memory requirements; thus the computation remains efficient and practical for very fine discretizations (very large values of $n$).