d02uef finds the solution of a linear constant coefficient boundary value problem by using the Chebyshev integration formulation on a Chebyshev Gauss–Lobatto grid.
where $1\le m\le 4$, $B$ is an $m\times (m+1)$ matrix of constant coefficients and ${\beta}_{i}$ are constants. The points ${y}_{i}$ are usually either $a$ or $b$.
The function $f\left(x\right)$ is supplied as an array of Chebyshev coefficients ${c}_{j}$, $j=0,1,\dots ,n$ for the function discretized on $n+1$ Chebyshev Gauss–Lobatto points (as returned by d02ucf); the coefficients are normally obtained by a previous call to d02uaf. The solution and its derivatives (up to order $m$) are returned, in the form of their Chebyshev series representation, as arrays of Chebyshev coefficients; subsequent calls to d02ubf will return the corresponding function and derivative values at the Chebyshev Gauss–Lobatto discretization points on $[a,b]$. Function and derivative values can be obtained on any uniform grid over the same range $[a,b]$ by calling the interpolation routine d02uwf.
4References
Clenshaw C W (1957) The numerical solution of linear differential equations in Chebyshev series Proc. Camb. Phil. Soc.53 134–149
Coutsias E A, Hagstrom T and Torres D (1996) An efficient spectral method for ordinary differential equations with rational function coefficients Mathematics of Computation65(214) 611–635
Greengard L (1991) Spectral integration and two-point boundary value problems SIAM J. Numer. Anal.28(4) 1071–80
Lundbladh A, Hennigson D S and Johannson A V (1992) An efficient spectral integration method for the solution of the Navier–Stokes equations Technical report FFA–TN 1992–28 Aeronautical Research Institute of Sweden
Muite B K (2010) A numerical comparison of Chebyshev methods for solving fourth-order semilinear initial boundary value problems Journal of Computational and Applied Mathematics234(2) 317–342
5Arguments
1: $\mathbf{n}$ – IntegerInput
On entry: $n$, where the number of grid points is $n+1$.
On entry: the order, $m$, of the boundary value problem to be solved.
Constraint:
$1\le {\mathbf{m}}\le 4$.
5: $\mathbf{c}\left({\mathbf{n}}+1\right)$ – Real (Kind=nag_wp) arrayInput
On entry: the Chebyshev coefficients ${c}_{j}$, $j=0,1,\dots ,n$, for the right-hand side of the boundary value problem. Usually these are obtained by a previous call of d02uaf.
6: $\mathbf{bmat}({\mathbf{m}},{\mathbf{m}}+1)$ – Real (Kind=nag_wp) arrayInput/Output
On entry: ${\mathbf{bmat}}(\mathit{i},\mathit{j}+1)$ must contain the coefficients ${B}_{\mathit{i},\mathit{j}+1}$, for $\mathit{i}=1,2,\dots ,m$ and $\mathit{j}=0,1,\dots ,m$, in the problem formulation of Section 3.
On exit: the coefficients have been scaled to form an equivalent problem defined on the domain $[-1,1]$.
7: $\mathbf{y}\left({\mathbf{m}}\right)$ – Real (Kind=nag_wp) arrayInput
On entry: the points,
${y}_{\mathit{i}}$, for $\mathit{i}=1,2,\dots ,m$, where the boundary conditions are discretized.
8: $\mathbf{bvec}\left({\mathbf{m}}\right)$ – Real (Kind=nag_wp) arrayInput
On entry: the values,
${\beta}_{\mathit{i}}$, for $\mathit{i}=1,2,\dots ,m$, in the formulation of the boundary conditions given in Section 3.
9: $\mathbf{f}\left({\mathbf{m}}+1\right)$ – Real (Kind=nag_wp) arrayInput/Output
On entry: the coefficients,
${f}_{\mathit{j}}$, for $\mathit{j}=1,2,\dots ,m+1$, in the formulation of the linear boundary value problem given in Section 3. The highest order term, ${\mathbf{f}}\left({\mathbf{m}}+1\right)$, needs to be nonzero to have a well posed problem.
On exit: the coefficients have been scaled to form an equivalent problem defined on the domain $[-1,1]$.
10: $\mathbf{uc}({\mathbf{n}}+1,{\mathbf{m}}+1)$ – Real (Kind=nag_wp) arrayOutput
On exit: the Chebyshev coefficients in the Chebyshev series representations of the solution and derivatives of the solution to the boundary value problem. The $n+1$ elements ${\mathbf{uc}}(1:{\mathbf{n}}+1,1)$ contain the coefficients representing the solution
$U\left({x}_{\mathit{i}}\right)$, for $\mathit{i}=0,1,\dots ,n$.
${\mathbf{uc}}(1:{\mathbf{n}}+1,\mathit{j}+1)$ contains the coefficients representing the $\mathit{j}$th derivative of $U$, for $\mathit{j}=1,2,\dots ,m$.
11: $\mathbf{resid}$ – Real (Kind=nag_wp)Output
On exit: the maximum residual resulting from substituting the solution vectors returned in uc into both linear equations of Section 3 representing the linear boundary value problem and associated boundary conditions. That is
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{n}}=\u27e8\mathit{\text{value}}\u27e9$.
Constraint: n is even.
On entry, ${\mathbf{n}}=\u27e8\mathit{\text{value}}\u27e9$.
Constraint: ${\mathbf{n}}\ge 8$.
${\mathbf{ifail}}=2$
On entry, ${\mathbf{a}}=\u27e8\mathit{\text{value}}\u27e9$ and ${\mathbf{b}}=\u27e8\mathit{\text{value}}\u27e9$.
Constraint: ${\mathbf{a}}<{\mathbf{b}}$.
${\mathbf{ifail}}=3$
On entry, ${\mathbf{f}}\left({\mathbf{m}}+1\right)=0.0$.
${\mathbf{ifail}}=6$
On entry, ${\mathbf{m}}=\u27e8\mathit{\text{value}}\u27e9$.
Constraint: $1\le {\mathbf{m}}\le 4$.
${\mathbf{ifail}}=7$
Internal error while unpacking matrix during iterative refinement.
Please contact NAG.
${\mathbf{ifail}}=8$
Singular matrix encountered during iterative refinement.
Please check that your system is well posed.
${\mathbf{ifail}}=9$
During iterative refinement, the maximum number of iterations was reached. $\text{Number of iterations}=\u27e8\mathit{\text{value}}\u27e9$ and $\text{residual achieved}=\u27e8\mathit{\text{value}}\u27e9$.
${\mathbf{ifail}}=10$
During iterative refinement, convergence was achieved, but the residual is more than $100\times \mathit{machineprecision}$. $\text{Residual achieved on convergence}=\u27e8\mathit{\text{value}}\u27e9$.
${\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 for well conditioned boundary value problems.
8Parallelism and Performance
d02uef is threaded by NAG for parallel execution in multithreaded implementations of the NAG Library.
d02uef makes calls to BLAS and/or LAPACK routines, which may be threaded within the vendor library used by this implementation. Consult the documentation for the vendor library for further information.
Please consult the X06 Chapter Introduction for information on how to control and interrogate the OpenMP environment used within this routine. Please also consult the Users' Note for your implementation for any additional implementation-specific information.
9Further Comments
The number of operations is of the order $n\mathrm{log}\left(n\right)$ and the memory requirements are $\mathit{O}\left(n\right)$; thus the computation remains efficient and practical for very fine discretizations (very large values of $n$). Collocation methods will be faster for small problems, but the method of d02uef should be faster for larger discretizations.
10Example
This example solves the third-order problem $4{U}_{xxx}+3{U}_{xx}+2{U}_{x}+U=2\mathrm{sin}x-2\mathrm{cos}x$ on $[-\pi /2,\pi /2]$ subject to the boundary conditions $U[-\pi /2]=0$, $3{U}_{xx}[-\pi /2]+2{U}_{x}[-\pi /2]+U[-\pi /2]=2$, and $3{U}_{xx}[\pi /2]+2{U}_{x}[\pi /2]+U[\pi /2]=-2$ using the Chebyshev integration formulation on a Chebyshev Gauss–Lobatto grid of order $16$.