# NAG Library Routine Document

## 1Purpose

d02nyf is a diagnostic routine which you may call either after any user-specified exit or after a mid-integration error exit from any of those integrators in Sub-chapter D02M–N that use methods set up by calls to d02mvf, d02nvf or d02nwf.

## 2Specification

Fortran Interface
 Subroutine d02nyf ( neq, hu, h, tcur, nst, nre, nje, nqu, nq,
 Integer, Intent (In) :: neq, neqmax, inform(23) Integer, Intent (Inout) :: ifail Integer, Intent (Out) :: nst, nre, nje, nqu, nq, niter, imxer Real (Kind=nag_wp), Intent (In) :: rwork(50+4*neq) Real (Kind=nag_wp), Intent (Out) :: hu, h, tcur, tolsf Logical, Intent (Out) :: algequ(neq)
#include nagmk26.h
 void d02nyf_ ( const Integer *neq, const Integer *neqmax, double *hu, double *h, double *tcur, double *tolsf, const double rwork[], Integer *nst, Integer *nre, Integer *nje, Integer *nqu, Integer *nq, Integer *niter, Integer *imxer, logical algequ[], const Integer inform[], Integer *ifail)

## 3Description

d02nyf permits you to inspect statistics produced by any integrator in this sub-chapter that has been set up a call to one of d02mvf, d02nvf or d02nwf. These statistics concern the integration only.

## 4References

See the D02M–N Sub-chapter Introduction.

## 5Arguments

1:     $\mathbf{neq}$ – IntegerInput
On entry: the value used for the argument neq when calling the integrator.
Constraint: ${\mathbf{neq}}\ge 1$.
2:     $\mathbf{neqmax}$ – IntegerInput
On entry: the value used for the argument neqmax when calling the integrator.
Constraint: ${\mathbf{neqmax}}\ge {\mathbf{neq}}$.
3:     $\mathbf{hu}$ – Real (Kind=nag_wp)Output
On exit: the last successful step size.
4:     $\mathbf{h}$ – Real (Kind=nag_wp)Output
On exit: the proposed next step size for continuing the integration.
5:     $\mathbf{tcur}$ – Real (Kind=nag_wp)Output
On exit: $t$, the value of the independent variable which the integrator has actually reached. tcur will always be at least as far as the output value of the argument $t$ in the direction of integration, but may be further (if overshooting and interpolation at tout was specified, e.g., see d02nbf).
6:     $\mathbf{tolsf}$ – Real (Kind=nag_wp)Output
On exit: a tolerance scale factor, ${\mathbf{tolsf}}\ge 1.0$, which is computed when a request for too much accuracy is detected by the integrator (indicated by a return with ${\mathbf{ifail}}={\mathbf{3}}$ or ${\mathbf{14}}$). If itol is left unaltered but rtol and atol are uniformly scaled up by a factor of tolsf the next call to the integrator is deemed likely to succeed.
7:     $\mathbf{rwork}\left(50+4×{\mathbf{neq}}\right)$ – Real (Kind=nag_wp) arrayCommunication Array
On entry: contains information supplied by the integrator.
8:     $\mathbf{nst}$ – IntegerOutput
On exit: the number of steps taken in the integration so far.
9:     $\mathbf{nre}$ – IntegerOutput
On exit: the number of function or residual evaluations (fcn (e.g., see d02nbf) or resid (e.g., see d02ngf) calls) used in the integration so far.
10:   $\mathbf{nje}$ – IntegerOutput
On exit: the number of Jacobian evaluations used in the integration so far. This equals the number of matrix $LU$ decompositions.
11:   $\mathbf{nqu}$ – IntegerOutput
On exit: the order of the method last used (successfully) in the integration.
12:   $\mathbf{nq}$ – IntegerOutput
On exit: the proposed order of the method for continuing the integration.
13:   $\mathbf{niter}$ – IntegerOutput
On exit: the number of iterations performed in the integration so far by the nonlinear equation solver.
14:   $\mathbf{imxer}$ – IntegerOutput
On exit: the index of the component of largest magnitude in the weighted local error vector $\left({e}_{\mathit{i}}/{w}_{\mathit{i}}\right)$, for $\mathit{i}=1,2,\dots ,{\mathbf{neq}}$.
15:   $\mathbf{algequ}\left({\mathbf{neq}}\right)$ – Logical arrayOutput
On exit: ${\mathbf{algequ}}\left(\mathit{i}\right)=\mathrm{.TRUE.}$ if the $\mathit{i}$th equation integrated was detected to be algebraic, otherwise ${\mathbf{algequ}}\left(\mathit{i}\right)=\mathrm{.FALSE.}$. Note that when the integrators for explicit equations are being used, then ${\mathbf{algequ}}\left(\mathit{i}\right)=\mathrm{.FALSE.}$, for $\mathit{i}=1,2,\dots ,{\mathbf{neq}}$.
16:   $\mathbf{inform}\left(23\right)$ – Integer arrayCommunication Array
On entry: contains information supplied by the integrator.
17:   $\mathbf{ifail}$ – IntegerInput/Output
On entry: ifail must be set to $0$, $-1\text{​ 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\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 argument, 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).

## 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$
 On entry, ${\mathbf{neq}}<1$, or ${\mathbf{neqmax}}<1$, or ${\mathbf{neq}}>{\mathbf{neqmax}}$.
${\mathbf{ifail}}=-99$
See Section 3.9 in How to Use the NAG Library and its Documentation for further information.
${\mathbf{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.
${\mathbf{ifail}}=-999$
Dynamic memory allocation failed.
See Section 3.7 in How to Use the NAG Library and its Documentation for further information.

Not applicable.

## 8Parallelism and Performance

d02nyf is not threaded in any implementation.