D02TYF (PDF version)
D02 Chapter Contents
D02 Chapter Introduction
NAG Library Manual

NAG Library Routine Document


Note:  before using this routine, please read the Users' Note for your implementation to check the interpretation of bold italicised terms and other implementation-dependent details.

+ Contents

    1  Purpose
    7  Accuracy

1  Purpose

D02TYF interpolates on the solution of a general two-point boundary value problem computed by D02TKF.

2  Specification

REAL (KIND=nag_wp)  X, Y(NEQ,0:MMAX-1), RWORK(*)

3  Description

D02TYF and its associated routines (D02TKF, D02TVF, D02TXF and D02TZF) solve the two-point boundary value problem for a nonlinear mixed order system of ordinary differential equations
y1m1 x = f1 x,y1,y11,,y1m1-1,y2,,ynmn-1 y2m2 x = f2 x,y1,y11,,y1m1-1,y2,,ynmn-1 ynmn x = fn x,y1,y11,,y1m1-1,y2,,ynmn-1
over an interval a,b subject to p (>0) nonlinear boundary conditions at a and q (>0) nonlinear boundary conditions at b, where p+q = i=1 n mi . Note that yi m x is the mth derivative of the ith solution component. Hence yi 0 x=yix. The left boundary conditions at a are defined as
gizya=0,  i=1,2,,p,
and the right boundary conditions at b as
g-jzyb=0,  j=1,2,,q,
where y=y1,y2,,yn and
zyx = y1x, y11 x ,, y1m1-1 x ,y2x,, ynmn-1 x .
First, D02TVF must be called to specify the initial mesh, error requirements and other details. Then, D02TKF can be used to solve the boundary value problem. After successful computation, D02TZF can be used to ascertain details about the final mesh and other details of the solution procedure, and D02TYF can be used to compute the approximate solution anywhere on the interval a,b using interpolation.
The routines are based on modified versions of the codes COLSYS and COLNEW (see Ascher et al. (1979) and Ascher and Bader (1987)). A comprehensive treatment of the numerical solution of boundary value problems can be found in Ascher et al. (1988) and Keller (1992).

4  References

Ascher U M and Bader G (1987) A new basis implementation for a mixed order boundary value ODE solver SIAM J. Sci. Stat. Comput. 8 483–500
Ascher U M, Christiansen J and Russell R D (1979) A collocation solver for mixed order systems of boundary value problems Math. Comput. 33 659–679
Ascher U M, Mattheij R M M and Russell R D (1988) Numerical Solution of Boundary Value Problems for Ordinary Differential Equations Prentice–Hall
Grossman C (1992) Enclosures of the solution of the Thomas–Fermi equation by monotone discretization J. Comput. Phys. 98 26–32
Keller H B (1992) Numerical Methods for Two-point Boundary-value Problems Dover, New York

5  Parameters

1:     X – REAL (KIND=nag_wp)Input
On entry: x, the independent variable.
Constraint: aXb.
2:     Y(NEQ,0:MMAX-1) – REAL (KIND=nag_wp) arrayOutput
On exit: Yij contains an approximation to yi j x, for i=1,2,,NEQ and j=0,1,,mi-1. The remaining elements of Y (where mi<MMAX) are initialized to 0.0.
3:     NEQ – INTEGERInput
On entry: the number of differential equations.
Constraint: NEQ must be the same value as supplied to D02TVF.
4:     MMAX – INTEGERInput
On entry: the maximal order of the differential equations, maxmi, for i=1,2,,NEQ.
Constraint: MMAX must contain the maximum value of the components of the parameter M as supplied to D02TVF.
5:     RWORK(*) – REAL (KIND=nag_wp) arrayCommunication Array
Note: the dimension of the array RWORK must be at least LRWORK (see D02TVF).
On entry: this must be the same array as supplied to D02TKF and must remain unchanged between calls.
On exit: contains information about the solution for use on subsequent calls to associated routines.
6:     IWORK(*) – INTEGER arrayCommunication Array
Note: the dimension of the array IWORK must be at least LIWORK (see D02TVF).
On entry: this must be the same array as supplied to D02TKF and must remain unchanged between calls.
On exit: contains information about the solution for use on subsequent calls to associated routines.
7:     IFAIL – INTEGERInput/Output
On entry: IFAIL must be set to 0, -1​ or ​1. If you are unfamiliar with this parameter you should refer to Section 3.3 in the Essential Introduction for details.
For environments where it might be inappropriate to halt program execution when an error is detected, the value -1​ or ​1 is recommended. If the output of error messages is undesirable, then the value 1 is recommended. Otherwise, because for this routine the values of the output parameters may be useful even if IFAIL0 on exit, the recommended value is -1. When the value -1​ or ​1 is used it is essential to test the value of IFAIL on exit.
On exit: IFAIL=0 unless the routine detects an error or a warning has been flagged (see Section 6).

6  Error Indicators and Warnings

If on entry IFAIL=0 or -1, explanatory error messages are output on the current error message unit (as defined by X04AAF).
Note: D02TYF may return useful information for one or more of the following detected errors or warnings.
Errors or warnings detected by the routine:
On entry, an invalid value for NEQ, MMAX (maxmi for some i) or X (outside the range a,b) was detected, or an invalid call to D02TYF was made, for example without a previous call to the solver routine D02TKF.
The solver routine D02TKF did not converge to a solution or did not satisfy the error requirements. The last solution computed by D02TKF, for which convergence was obtained, has been used for interpolation by D02TYF. The results returned by D02TYF should be treated with extreme caution as regarding either their quality or accuracy. See Section 8.

7  Accuracy

If D02TYF returns the value IFAIL=0, the computed values of the solution components yi should be of similar accuracy to that specified by the parameter TOLS of D02TVF. Note that during the solution process the error in the derivatives yij, for j=1,2,,mi-1, has not been controlled and that the derivative values returned by D02TYF are computed via differentiation of the piecewise polynomial approximation to yi. See also Section 8.

8  Further Comments

If D02TYF returns the value IFAIL=2, and the solver routine D02TKF returned IFAIL=5, then the accuracy of the interpolated values may be proportional to the quantity ERMX as returned by D02TZF.
If D02TKF returned any other nonzero value for IFAIL, then nothing can be said regarding either the quality or accuracy of the values computed by D02TYF.

9  Example

The following example is used to illustrate that a system with singular coefficients can be treated without modification of the system definition. See also D02TKF, D02TVF, D02TXF and D02TZF, 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
with boundary conditions
y0= 1,   ya= 0,   a> 0.
The coefficient x-1/2 implies a singularity at the left-hand boundary x=0.
We use the initial approximation yx=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 D02TKF) 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 yx is positive for all x<a.

9.1  Program Text

Program Text (d02tyfe.f90)

9.2  Program Data

Program Data (d02tyfe.d)

9.3  Program Results

Program Results (d02tyfe.r)

Produced by GNUPLOT 4.4 patchlevel 0 -2 -1.5 -1 -0.5 0 0.5 1 0 0.2 0.4 0.6 0.8 1 Effective Nuclear Charge Relative Distance Example Program Thomas-Fermi Equation for Determining Effective Nuclear Charge in Heavy Atoms nuclear charge charge gradient

D02TYF (PDF version)
D02 Chapter Contents
D02 Chapter Introduction
NAG Library Manual

© The Numerical Algorithms Group Ltd, Oxford, UK. 2012