NAG FL Interface
d02lzf (ivp_​2nd_​rkn_​interp)

Settings help

FL Name Style:


FL Specification Language:


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 <nag.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)
The routine may be called by the names d02lzf or nagf_ode_ivp_2nd_rkn_interp.

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 Integer Input
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: y(neq) Real (Kind=nag_wp) array Input
On entry: the ith component of the solution at t, for i=1,2,,neq, as returned from d02laf.
4: yp(neq) Real (Kind=nag_wp) array Input
On entry: the ith component of the derivative at t, for i=1,2,,neq, as returned from d02laf.
5: nwant Integer Input
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: ywant(nwant) Real (Kind=nag_wp) array Output
On exit: the calculated value of the ith component of the solution at t=twant, for i=1,2,,nwant.
8: ypwant(nwant) Real (Kind=nag_wp) array Output
On exit: the calculated value of the ith component of the derivative at t=twant, for i=1,2,,nwant.
9: rwork(lrwork) Real (Kind=nag_wp) array Communication 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 Integer Input
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 Integer Input/Output
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 -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
No successful steps, interpolation impossible at twant=value.
On entry, lrwork=value, but in a previous call to the setup routine lrwork=value.
On entry, neq=value, but in a previous call to the setup routine neq=value.
On entry, nwant=value.
Constraint: nwant1.
On entry, nwant=value and neq=value.
Constraint: nwantneq.
The integrator routine d02laf has not been called.
ifail=2
Extrapolation at twant=value.
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
Interpolation is not permitted on data from the high order formulas.
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.
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.
ifail=-999
Dynamic memory allocation failed.
See Section 9 in the Introduction to the NAG Library FL Interface 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

Background information to multithreading can be found in the Multithreading documentation.
d02lzf is not thread safe and should not be called from a multithreaded user program. Please see Section 1 in FL Interface Multithreading 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 d02laf.