D02 Chapter Contents
D02 Chapter Introduction
NAG Library Manual

# NAG Library Routine DocumentD02MZF

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

D02MZF interpolates components of the solution of a system of first-order differential equations from information provided by those integrators in sub-chapter D02M–N using methods set up by calls to D02MVF, D02NVF or D02NWF.

## 2  Specification

 SUBROUTINE D02MZF ( TSOL, SOL, M, LDYSAV, NEQ, YSAV, SDYSAV, RWORK, IFAIL)
 INTEGER M, LDYSAV, NEQ, SDYSAV, IFAIL REAL (KIND=nag_wp) TSOL, SOL(M), YSAV(LDYSAV,SDYSAV), RWORK(50+4*NEQ)

## 3  Description

D02MZF 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 D02MZF. D02MZF should not normally be used to extrapolate outside the range of values obtained from the above routine.

## 4  References

See the D02M–N sub-chapter Introduction.

## 5  Parameters

1:     TSOL – REAL (KIND=nag_wp)Input
On entry: the point at which the first M components of the solution are to be evaluated. TSOL should not normally be an extrapolation point. Extrapolation is permitted but not recommended.
2:     SOL(M) – REAL (KIND=nag_wp) arrayOutput
On exit: the calculated value of the solution at TSOL.
3:     M – INTEGERInput
On entry: the number of components of the solution whose values are required.
Constraint: $1\le {\mathbf{M}}\le {\mathbf{NEQ}}$.
4:     LDYSAV – INTEGERInput
On entry: the value used for the parameter LDYSAV when calling the integrator.
Constraint: ${\mathbf{LDYSAV}}\ge 1$.
5:     NEQ – INTEGERInput
On entry: the value used for the parameter NEQ when calling the integrator.
Constraint: $1\le {\mathbf{NEQ}}\le {\mathbf{LDYSAV}}$.
6:     YSAV(LDYSAV,SDYSAV) – REAL (KIND=nag_wp) arrayInput
On entry: the values provided in the array YSAV on return from the integrator.
7:     SDYSAV – INTEGERInput
On entry: the value used for the parameter SDYSAV when calling the integrator.
8:     RWORK($50+4×{\mathbf{NEQ}}$) – REAL (KIND=nag_wp) arrayInput
On entry: the values provided in the array RWORK on return from the integrator.
9:     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).

## 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{LDYSAV}}<1$, or ${\mathbf{NEQ}}<1$, or ${\mathbf{M}}>{\mathbf{NEQ}}$, or ${\mathbf{NEQ}}>{\mathbf{LDYSAV}}$.
${\mathbf{IFAIL}}=2$
On entry, when accessing an element of the array RWORK an unexpected quantity was found. You have not passed the correct array to D02MZF or has overwritten elements of this array.
${\mathbf{IFAIL}}=3$
On entry, D02MZF has been called for extrapolation. Before returning with this error exit, the value of the solution at TSOL is calculated and placed in SOL.

## 7  Accuracy

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

None.

## 9  Example

This example solves the well-known stiff Robertson problem written in implicit form
 $r1 = -0.04a + 1.0E4bc - a′ r2 = 0.04a - 1.0E4bc - 3.0E7⁢b2 - b′ r3 = 3.0E7⁢b2 - c′$
with initial conditions $a=1.0$ and $b=c=0.0$ over the range $\left[0,0.1\right]$ with vector error control (${\mathbf{ITOL}}=4$), the BDF method (setup routine D02NVF) and functional iteration. The Jacobian is calculated numerically if the functional iteration encounters difficulty and the integration is in one-step mode (${\mathbf{ITASK}}=2$), with natural interpolation to calculate the solution at intervals of $0.02$ using D02MZF externally. D02NBY is used for MONITR.

### 9.1  Program Text

Program Text (d02mzfe.f90)

### 9.2  Program Data

Program Data (d02mzfe.d)

### 9.3  Program Results

Program Results (d02mzfe.r)