NAG Library Routine Document

d02lzf  (ivp_2nd_rkn_interp)

 Contents

    1  Purpose
    7  Accuracy
    10  Example

1
Purpose

d02lzf interpolates components of the solution of a non-stiff system of second-order differential equations from information provided by the integrator d02laf, when the low-order method has been used.

2
Specification

Fortran Interface
Subroutine d02lzf ( neq, t, y, yp, nwant, twant, ywant, ypwant, rwork, lrwork, ifail)
Integer, Intent (In):: neq, nwant, lrwork
Integer, Intent (Inout):: ifail
Real (Kind=nag_wp), Intent (In):: t, y(neq), yp(neq), twant, rwork(lrwork)
Real (Kind=nag_wp), Intent (Out):: ywant(nwant), ypwant(nwant)
C Header Interface
#include nagmk26.h
void  d02lzf_ ( const Integer *neq, const double *t, const double y[], const double yp[], const Integer *nwant, const double *twant, double ywant[], double ypwant[], const double rwork[], const Integer *lrwork, Integer *ifail)

3
Description

d02lzf evaluates the first nwant (neq) components of the solution of a non-stiff system of second-order ordinary differential equations at any point using a special Runge–Kutta–Nystrom formula (see Dormand and Prince (1986)) and information generated by d02laf when the low-order method has been used. This information must be presented unchanged to d02lzf. d02lzf should not normally be used to extrapolate outside the range of the values from d02laf.

4
References

Dormand J R and Prince P J (1986) Runge–Kutta–Nystrom triples Mathematical Report TP-CS-86-05 Teesside Polytechnic

5
Arguments

1:     neq – IntegerInput
On entry: the number of second-order ordinary differential equations being solved by d02laf. It must contain the same value as the argument neq in a prior call to d02laf.
2:     t – Real (Kind=nag_wp)Input
On entry: t, the current value at which the solution and its derivative have been computed (as returned in argument t on output from d02laf).
3:     yneq – Real (Kind=nag_wp) arrayInput
On entry: the ith component of the solution at t, for i=1,2,,neq, as returned from d02laf.
4:     ypneq – Real (Kind=nag_wp) arrayInput
On entry: the ith component of the derivative at t, for i=1,2,,neq, as returned from d02laf.
5:     nwant – IntegerInput
On entry: the number of components of the solution and derivative whose values at twant are required. The first nwant components are evaluated.
Constraint: 1nwantneq.
6:     twant – Real (Kind=nag_wp)Input
On entry: the point at which components of the solution and derivative are to be evaluated. twant should not normally be an extrapolation point, that is twant should satisfy
toldtwantt,  
or if integration is proceeding in the negative direction
toldtwantt,  
where told is the previous integration point which is held in an element of the array rwork and is, to within rounding, t-hused. (hused is given by d02lyf.) Extrapolation is permitted but not recommended, and ifail=2 is returned whenever extrapolation is attempted.
7:     ywantnwant – Real (Kind=nag_wp) arrayOutput
On exit: the calculated value of the ith component of the solution at t=twant, for i=1,2,,nwant.
8:     ypwantnwant – Real (Kind=nag_wp) arrayOutput
On exit: the calculated value of the ith component of the derivative at t=twant, for i=1,2,,nwant.
9:     rworklrwork – Real (Kind=nag_wp) arrayCommunication Array
On entry: this must be the same argument rwork as supplied to d02laf. It is used to pass information from d02laf to d02lzf and therefore the contents of this array must not be changed before calling d02lzf.
10:   lrwork – IntegerInput
On entry: the dimension of the array rwork as declared in the (sub)program from which d02lzf is called.
This must be the same argument lrwork as supplied to the setup routine d02lxf.
11:   ifail – IntegerInput/Output
On entry: ifail must be set to 0, -1​ or ​1. If you are unfamiliar with this argument you should refer to Section 3.4 in How to Use the NAG Library and its Documentation 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, if you are not familiar with this argument, the recommended value is 0. 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).
If d02lzf is to be used for extrapolation at twant, ifail should be set to 1 before entry. It is then essential to test the value of ifail on exit.

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).
Errors or warnings detected by the routine:
ifail=1
Illegal input detected, i.e., one of the following conditions:
d02laf has not been called;
one or both of the arguments neq and lrwork does not match the corresponding argument supplied to the setup routine d02lxf;
no integration steps have been taken since the last call to d02lxf with start=.TRUE.;
nwant<1 or nwant>neq.
This error exit can be caused if elements of rwork have been overwritten.
ifail=2
d02lzf has been called for extrapolation. The values of the solution and its derivative at twant have been calculated and placed in ywant and ypwant before returning with this error number (see Section 7).
ifail=3
d02laf last used the high order method to integrate the system of differential equations. Interpolation is not permitted with this method.
ifail=-99
An unexpected error has been triggered by this routine. Please contact NAG.
See Section 3.9 in How to Use the NAG Library and its Documentation for further information.
ifail=-399
Your licence key may have expired or may not have been installed correctly.
See Section 3.8 in How to Use the NAG Library and its Documentation for further information.
ifail=-999
Dynamic memory allocation failed.
See Section 3.7 in How to Use the NAG Library and its Documentation for further information.

7
Accuracy

The error in interpolation is of a similar order to the error arising from the integration using d02laf with the lower order method.
The same order of accuracy can be expected when extrapolating using d02lzf. However, the actual error in extrapolation will, in general, be much larger than for interpolation.

8
Parallelism and Performance

d02lzf is not thread safe and should not be called from a multithreaded user program. Please see Section 3.12.1 in How to Use the NAG Library and its Documentation for more information on thread safety.
d02lzf is not threaded in any implementation.

9
Further Comments

When interpolation for only a few components is required then it is more efficient to order the components of interest so that they are numbered first.

10
Example

See Section 10 in d02laf.
© The Numerical Algorithms Group Ltd, Oxford, UK. 2017