D02 Chapter Contents
D02 Chapter Introduction
NAG Library Manual

# NAG Library Routine DocumentD02XJF

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.

## 1  Purpose

D02XJF interpolates components of the solution of a system of first-order ordinary differential equations from information provided by the integrators in sub-chapter D02M–N.

## 2  Specification

 SUBROUTINE D02XJF ( XSOL, SOL, M, YSAV, LDYSAV, SDYSAV, NEQ, X, NQU, HU, H, IFAIL)
 INTEGER M, LDYSAV, SDYSAV, NEQ, NQU, IFAIL REAL (KIND=nag_wp) XSOL, SOL(M), YSAV(LDYSAV,SDYSAV), X, HU, H

## 3  Description

D02XJF evaluates the first $m$ components of the solution of a system of ordinary differential equations at any point using natural polynomial interpolation based on information generated by the integrator. This information must be passed unchanged to D02XJF. D02XJF should not normally be used to extrapolate outside the range of values obtained from the above routines.

None.

## 5  Parameters

1:     XSOL – REAL (KIND=nag_wp)Input
On entry: the point at which the first $m$ components of the solution are to be evaluated. XSOL should not be an extrapolation point, that is XSOL should satisfy $\left({\mathbf{XSOL}}-{\mathbf{X}}\right)×{\mathbf{HU}}\le 0.0$. Extrapolation is permitted but not recommended.
2:     SOL(M) – REAL (KIND=nag_wp) arrayOutput
On exit: the calculated value of the $\mathit{i}$th component of the solution at XSOL, for $\mathit{i}=1,2,\dots ,m$.
3:     M – INTEGERInput
On entry: $m$, the number of components of the solution whose values at XSOL are required. The first M components are evaluated.
Constraint: $1\le {\mathbf{M}}\le {\mathbf{NEQ}}$.
4:     YSAV(LDYSAV,SDYSAV) – REAL (KIND=nag_wp) arrayInput
On entry: the values provided in the parameter YSAV on return from the integrator.
5:     LDYSAV – INTEGERInput
On entry: the value used for the parameter LDYSAV when calling the integrator.
Constraint: ${\mathbf{LDYSAV}}\ge 1$.
6:     SDYSAV – INTEGERInput
On entry: the value used for the parameter SDYSAV when calling the integrator.
Constraint: ${\mathbf{SDYSAV}}\ge {\mathbf{NQU}}+1$.
7:     NEQ – INTEGERInput
On entry: the value used for the parameter NEQ when calling the integrator.
Constraint: $1\le {\mathbf{NEQ}}\le {\mathbf{LDYSAV}}$.
8:     X – REAL (KIND=nag_wp)Input
On entry: the latest value at which the solution has been computed, as provided in the parameter TCUR on return from the optional output D02NYF.
9:     NQU – INTEGERInput
On entry: the order of the method used up to the latest value at which the solution has been computed, as provided in the parameter NQU on return from the optional output D02NYF.
Constraint: ${\mathbf{NQU}}\ge 1$.
10:   HU – REAL (KIND=nag_wp)Input
On entry: the last successful step used, that is the step used in the integration to get to X, as provided in the parameter HU on return from the optional output D02NYF.
11:   H – REAL (KIND=nag_wp)Input
On entry: the next step size to be attempted in the integration, as provided in the parameter H on return from the optional output D02NYF.
12:   IFAIL – INTEGERInput/Output
On entry: IFAIL must be set to $0$, $-1\text{​ 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\text{​ 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 parameter, the recommended value is $0$. When the value $-\mathbf{1}\text{​ 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 D02XJF is to be used for extrapolation, IFAIL must be set to $1$ before entry. It is then essential to test the value of IFAIL on exit for ${\mathbf{IFAIL}}={\mathbf{1}}$ or ${\mathbf{2}}$.

## 6  Error Indicators and Warnings

If on entry ${\mathbf{IFAIL}}={\mathbf{0}}$ or $-{\mathbf{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$
 On entry, ${\mathbf{M}}<1$, or ${\mathbf{NEQ}}<1$, or ${\mathbf{LDYSAV}}<1$, or ${\mathbf{NEQ}}>{\mathbf{LDYSAV}}$, or ${\mathbf{M}}>{\mathbf{NEQ}}$, or ${\mathbf{NQU}}<1$, or ${\mathbf{SDYSAV}}<{\mathbf{NQU}}+1$.
${\mathbf{IFAIL}}=2$
On entry, ${\mathbf{HU}}=0.0$ or ${\mathbf{H}}=0.0$. This error can only occur if H and HU have been changed by you or possibly if the integrator has failed before calling D02XJF.
${\mathbf{IFAIL}}=3$
D02XJF has been called for extrapolation. Before returning with this error exit, the value of the solution at XSOL is calculated and placed in SOL.

## 7  Accuracy

The solution values returned will be of a similar accuracy to those computed by the integrator.

D02XJF is that employed for prediction purposes internally by the integrator. It is supplied for purposes of consistency only. You are recommended to employ the ${C}^{1}$ interpolant provided by D02XKF wherever possible.