The function may be called by the names: d02tyc or nag_ode_bvp_coll_nlin_interp.
3Description
d02tyc and its associated functions (d02tlc,d02tvc,d02txcandd02tzc) solve the two-point boundary value problem for a nonlinear mixed order system of ordinary differential equations
over an interval $[a,b]$ subject to $p$ ($\text{}>0$) nonlinear boundary conditions at $a$ and $q$ ($\text{}>0$) nonlinear boundary conditions at $b$, where $p+q={\displaystyle \sum _{i=1}^{n}}{m}_{i}$. Note that ${y}_{i}^{\left(m\right)}\left(x\right)$ is the $m$th derivative of the $i$th solution component. Hence ${y}_{i}^{\left(0\right)}\left(x\right)={y}_{i}\left(x\right)$. The left boundary conditions at $a$ are defined as
First, d02tvc must be called to specify the initial mesh, error requirements and other details. Then, d02tlc can be used to solve the boundary value problem. After successful computation, d02tzc can be used to ascertain details about the final mesh and other details of the solution procedure, and d02tyc can be used to compute the approximate solution anywhere on the interval $[a,b]$ using interpolation.
Note: where ${\mathbf{Y}}(i,j)$ appears in this document, it refers to the array element
${\mathbf{y}}\left[j\times {\mathbf{neq}}+i-1\right]$.
On exit: ${\mathbf{Y}}(\mathit{i},\mathit{j})$ contains an approximation to ${y}_{\mathit{i}}^{\left(\mathit{j}\right)}\left(x\right)$, for $\mathit{i}=1,2,\dots ,{\mathbf{neq}}$ and $\mathit{j}=0,1,\dots ,{m}_{\mathit{i}}-1$. The remaining elements of y (where ${m}_{i}<{\mathbf{mmax}}$) are initialized to $0.0$.
3: $\mathbf{neq}$ – IntegerInput
On entry: the number of differential equations.
Constraint:
${\mathbf{neq}}$ must be the same value as supplied to d02tvc.
4: $\mathbf{mmax}$ – IntegerInput
On entry: the maximal order of the differential equations,
$\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left({m}_{\mathit{i}}\right)$, for $\mathit{i}=1,2,\dots ,{\mathbf{neq}}$.
Constraint:
${\mathbf{mmax}}$ must contain the maximum value of the components of the argument m as supplied to d02tvc.
Note: the dimension, $\mathit{dim}$, of this array is dictated by the requirements of associated functions that must have been previously called. This array MUST be the same array passed as argument rcomm in the previous call to d02tlc.
On entry: this must be the same array as supplied to d02tlc and must remain unchanged between calls.
On exit: contains information about the solution for use on subsequent calls to associated functions.
Note: the dimension, $\mathit{dim}$, of this array is dictated by the requirements of associated functions that must have been previously called. This array MUST be the same array passed as argument icomm in the previous call to d02tlc.
On entry: this must be the same array as supplied to d02tlc and must remain unchanged between calls.
On exit: contains information about the solution for use on subsequent calls to associated functions.
7: $\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.
NE_BAD_PARAM
On entry, argument $\u27e8\mathit{\text{value}}\u27e9$ had an illegal value.
NE_CONVERGENCE_SOL
The solver function did not produce any results suitable for interpolation.
NE_INT_2
On entry, ${\mathbf{mmax}}=\u27e8\mathit{\text{value}}\u27e9$ and $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left({\mathbf{m}}\left[i\right]\right)=\u27e8\mathit{\text{value}}\u27e9$ in d02tvc.
Constraint: ${\mathbf{mmax}}=\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left({\mathbf{m}}\left[i\right]\right)$ in d02tvc.
NE_INT_CHANGED
On entry, ${\mathbf{neq}}=\u27e8\mathit{\text{value}}\u27e9$ and ${\mathbf{neq}}=\u27e8\mathit{\text{value}}\u27e9$ in d02tvc.
Constraint: ${\mathbf{neq}}={\mathbf{neq}}$ in d02tvc.
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_MISSING_CALL
The solver function does not appear to have been called.
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}}=\u27e8\mathit{\text{value}}\u27e9$.
Constraint: ${\mathbf{x}}\le \u27e8\mathit{\text{value}}\u27e9$.
On entry, ${\mathbf{x}}=\u27e8\mathit{\text{value}}\u27e9$.
Constraint: ${\mathbf{x}}\ge \u27e8\mathit{\text{value}}\u27e9$.
NW_NOT_CONVERGED
The solver function did not converge to a suitable solution.
A converged intermediate solution has been used.
Interpolated values should be treated with caution.
NW_TOO_MUCH_ACC_REQUESTED
The solver function did not satisfy the error requirements.
Interpolated values should be treated with caution.
7Accuracy
If d02tyc returns the value ${\mathbf{fail}}\mathbf{.}\mathbf{code}=$ NE_NOERROR, the computed values of the solution components ${y}_{i}$ should be of similar accuracy to that specified by the argument tols of d02tvc. Note that during the solution process the error in the derivatives ${y}_{i}^{\left(\mathit{j}\right)}$, for $\mathit{j}=1,2,\dots ,{m}_{i}-1$, has not been controlled and that the derivative values returned by d02tyc are computed via differentiation of the piecewise polynomial approximation to ${y}_{i}$. See also Section 9.
8Parallelism and Performance
d02tyc 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 function. Please also consult the Users' Note for your implementation for any additional implementation-specific information.
9Further Comments
If d02tyc returns the value
fail.code$={\mathbf{NW\_NOT\_CONVERGED}}$,
then the accuracy of the interpolated values may be proportional to the quantity ermx as returned by d02tzc.
If d02tlc returned a value for
fail.code
other than ${\mathbf{fail}}\mathbf{.}\mathbf{code}=$ NE_NOERROR, then nothing can be said regarding either the quality or accuracy of the values computed by d02tyc.
10Example
The following example is used to illustrate that a system with singular coefficients can be treated without modification of the system definition. See also d02tlc,d02tvc,d02txcandd02tzc, for the illustration of other facilities.
Consider the Thomas–Fermi equation used in the investigation of potentials and charge densities of ionized atoms. See Grossman (1992), for example, and the references therein. The equation is
The coefficient ${x}^{-1/2}$ implies a singularity at the left-hand boundary $x=0$.
We use the initial approximation $y\left(x\right)=1-x/a$, which satisfies the boundary conditions, on a uniform mesh of six points. For illustration we choose $a=1$, as in Grossman (1992). Note that in ffun and fjac (see d02tlc) we have taken the precaution of setting the function value and Jacobian value to $0.0$ in case a value of $y$ becomes negative, although starting from our initial solution profile this proves unnecessary during the solution phase. Of course the true solution $y\left(x\right)$ is positive for all $x<a$.