D02 Chapter Contents
D02 Chapter Introduction
NAG Library Manual

# NAG Library Routine DocumentD02QYF

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

D02QYF is a diagnostic routine which may be called after a call to the integrator routines D02QFF or D02QGF.

## 2  Specification

 SUBROUTINE D02QYF ( NEQG, INDEX, ITYPE, EVENTS, RESIDS, RWORK, LRWORK, IWORK, LIWORK, IFAIL)
 INTEGER NEQG, INDEX, ITYPE, EVENTS(NEQG), LRWORK, IWORK(LIWORK), LIWORK, IFAIL REAL (KIND=nag_wp) RESIDS(NEQG), RWORK(LRWORK)

## 3  Description

D02QYF should be called only after a call to D02QFF or D02QGF results in the output value ${\mathbf{ROOT}}=\mathrm{.TRUE.}$, indicating that a root has been detected. D02QYF permits you to examine information about the root detected, such as the indices of the event equations for which there is a root, the type of root (odd or even) and the residuals of the event equations.

None.

## 5  Parameters

1:     NEQG – INTEGERInput
On entry: the number of event functions defined for the integration routine. It must be the same parameter NEQG supplied to the setup routine D02QWF and to the integration routine (D02QFF or D02QGF).
2:     INDEX – INTEGEROutput
On exit: the index $k$ of the event equation ${g}_{k}\left(x,y,{y}^{\prime }\right)=0$ for which the root has been detected.
3:     ITYPE – INTEGEROutput
On exit: information about the root detected for the event equation defined by INDEX. The possible values of ITYPE with their interpretations are as follows:
${\mathbf{ITYPE}}=1$
A simple root, or lack of distinguishing information available.
${\mathbf{ITYPE}}=2$
A root of even multiplicity is believed to have been detected, that is no change in sign of the event function was found.
${\mathbf{ITYPE}}=3$
A high-order root of odd multiplicity.
${\mathbf{ITYPE}}=4$
A possible root, but due to high multiplicity or a clustering of roots accurate evaluation of the event function was prohibited by round-off error and/or cancellation.
In general, the accuracy of the root is less reliable for values of ${\mathbf{ITYPE}}>1$.
4:     EVENTS(NEQG) – INTEGER arrayOutput
On exit: information about the $k$th event function on a very small interval containing the root, T (see D02QFF and D02QGF), as output from the integration routine. All roots lying in this interval are considered indistinguishable numerically and therefore should be regarded as defining a root at T. The possible values of ${\mathbf{EVENTS}}\left(k\right)$ with their interpretations are as follows:
${\mathbf{EVENTS}}\left(k\right)=0$
The $k$th event function did not have a root.
${\mathbf{EVENTS}}\left(k\right)=-1$
The $k$th event function changed sign from positive to negative about a root, in the direction of integration.
${\mathbf{EVENTS}}\left(k\right)=1$
The $k$th event function changed sign from negative to positive about a root, in the direction of integration.
${\mathbf{EVENTS}}\left(k\right)=2$
A root was identified, but no change in sign was observed.
5:     RESIDS(NEQG) – REAL (KIND=nag_wp) arrayOutput
On exit: the value of the $k$th event function computed at the root, T (see D02QFF and D02QGF).
6:     RWORK(LRWORK) – REAL (KIND=nag_wp) arrayCommunication Array
On entry: this must be the same parameter RWORK as supplied to D02QFF or D02QGF. It is used to pass information from the integration routine to D02QYF and therefore the contents of this array must not be changed before calling D02QYF.
7:     LRWORK – INTEGERInput
On entry: the dimension of the array RWORK as declared in the (sub)program from which D02QYF is called.
This must be the same parameter LRWORK as supplied to D02QWF.
8:     IWORK(LIWORK) – INTEGER arrayCommunication Array
On entry: this must be the same parameter IWORK as supplied to D02QFF or D02QGF. It is used to pass information from the integration routine to D02QYF and therefore the contents of this array must not be changed before calling D02QYF.
9:     LIWORK – INTEGERInput
On entry: the dimension of the array IWORK as declared in the (sub)program from which D02QYF is called.
This must be the same parameter LIWORK as supplied to D02QWF.
10:   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$
An integration routine (D02QFF or D02QGF) has not been called, no root was detected or one or more of the parameters LRWORK, LIWORK and NEQG does not match the corresponding values supplied to D02QWF. Values for the arguments INDEX, ITYPE, EVENTS and RESIDS will not have been set.
This error exit may be caused by overwriting elements of IWORK.

Not applicable.