# NAG FL Interfaced02lzf (ivp_​2nd_​rkn_​interp)

## ▸▿ Contents

Settings help

FL Name Style:

FL Specification Language:

## 1Purpose

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.

## 2Specification

Fortran Interface
 Subroutine d02lzf ( neq, t, y, yp,
 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)
#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.

## 3Description

d02lzf evaluates the first ${\mathbf{nwant}}$ ($\text{}\le {\mathbf{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.

## 4References

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

## 5Arguments

1: $\mathbf{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: $\mathbf{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: $\mathbf{y}\left({\mathbf{neq}}\right)$Real (Kind=nag_wp) array Input
On entry: the $\mathit{i}$th component of the solution at $t$, for $\mathit{i}=1,2,\dots ,{\mathbf{neq}}$, as returned from d02laf.
4: $\mathbf{yp}\left({\mathbf{neq}}\right)$Real (Kind=nag_wp) array Input
On entry: the $\mathit{i}$th component of the derivative at $t$, for $\mathit{i}=1,2,\dots ,{\mathbf{neq}}$, as returned from d02laf.
5: $\mathbf{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: $1\le {\mathbf{nwant}}\le {\mathbf{neq}}$.
6: $\mathbf{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
 $told≤twant≤t,$
or if integration is proceeding in the negative direction
 $told≥twant≥t,$
where told is the previous integration point which is held in an element of the array rwork and is, to within rounding, ${\mathbf{t}}-{\mathbf{hused}}$. (hused is given by d02lyf.) Extrapolation is permitted but not recommended, and ${\mathbf{ifail}}={\mathbf{2}}$ is returned whenever extrapolation is attempted.
7: $\mathbf{ywant}\left({\mathbf{nwant}}\right)$Real (Kind=nag_wp) array Output
On exit: the calculated value of the $\mathit{i}$th component of the solution at $t={\mathbf{twant}}$, for $\mathit{i}=1,2,\dots ,{\mathbf{nwant}}$.
8: $\mathbf{ypwant}\left({\mathbf{nwant}}\right)$Real (Kind=nag_wp) array Output
On exit: the calculated value of the $\mathit{i}$th component of the derivative at $t={\mathbf{twant}}$, for $\mathit{i}=1,2,\dots ,{\mathbf{nwant}}$.
9: $\mathbf{rwork}\left({\mathbf{lrwork}}\right)$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: $\mathbf{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: $\mathbf{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 $-\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).
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.

## 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$
No successful steps, interpolation impossible at ${\mathbf{twant}}=⟨\mathit{\text{value}}⟩$.
On entry, ${\mathbf{lrwork}}=⟨\mathit{\text{value}}⟩$, but in a previous call to the setup routine ${\mathbf{lrwork}}=⟨\mathit{\text{value}}⟩$.
On entry, ${\mathbf{neq}}=⟨\mathit{\text{value}}⟩$, but in a previous call to the setup routine ${\mathbf{neq}}=⟨\mathit{\text{value}}⟩$.
On entry, ${\mathbf{nwant}}=⟨\mathit{\text{value}}⟩$.
Constraint: ${\mathbf{nwant}}\ge 1$.
On entry, ${\mathbf{nwant}}=⟨\mathit{\text{value}}⟩$ and ${\mathbf{neq}}=⟨\mathit{\text{value}}⟩$.
Constraint: ${\mathbf{nwant}}\le {\mathbf{neq}}$.
The integrator routine d02laf has not been called.
${\mathbf{ifail}}=2$
Extrapolation at ${\mathbf{twant}}=⟨\mathit{\text{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).
${\mathbf{ifail}}=3$
Interpolation is not permitted on data from the high order formulas.
${\mathbf{ifail}}=-99$
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 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.