D02XKF (PDF version)
D02 Chapter Contents
D02 Chapter Introduction
NAG Library Manual

NAG Library Routine Document

D02XKF

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.

 Contents

    1  Purpose
    7  Accuracy
    10  Example

1  Purpose

D02XKF 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. It provides C1 interpolation suitable for general use.

2  Specification

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

3  Description

D02XKF evaluates the first m components of the solution of a system of ordinary differential equations at any point using C1 polynomial interpolation based on information generated by the integrator. This information must be passed unchanged to D02XKF. D02XKF should not normally be used to extrapolate outside the range of values obtained from the above routines.
It may be used with the D02N routines only when the BDF integration method is being employed (setup routine D02NVF), provided the Petzold error test was not selected.

4  References

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 XSOL-X×HU0.0. Extrapolation is permitted but not recommended.
2:     SOLM – REAL (KIND=nag_wp) arrayOutput
On exit: the calculated value of the ith component of the solution at XSOL, for i=1,2,,m.
3:     M – INTEGERInput
On entry: the number of components of the solution whose values at XSOL are required. The first m components are evaluated.
Constraint: 1MNEQ.
4:     YSAVLDYSAVSDYSAV – 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: LDYSAV1.
6:     SDYSAV – INTEGERInput
On entry: the value used for the parameter SDYSAV when calling the integrator.
Constraint: SDYSAVNQU+1.
7:     ACORNEQ – REAL (KIND=nag_wp) arrayInput
On entry: the value returned in position LDYSAV+50+i, for i=1,2,,NEQ, of the parameter RWORK returned by the integrator. If one of the forward communication D02N routines is being employed and D02XKF is to be used in MONITR, then ACORi must contain the value given in position i,2 of the MONITR parameter ACOR, for i=1,2,,NEQ (e.g., see D02NBF).
8:     NEQ – INTEGERInput
On entry: the value used for the parameter NEQ when calling the integrator.
Constraint: 1NEQLDYSAV.
9:     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.
10:   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: NQU1.
11:   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.
12:   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.
13:   IFAIL – INTEGERInput/Output
On entry: IFAIL must be set to 0, -1​ 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​ 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 -1​ or ​1 is used it is essential to test the value of IFAIL on exit.
On exit: IFAIL=0 unless the routine detects an error or a warning has been flagged (see Section 6).
If D02XKF 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 IFAIL=1 or 2.

6  Error Indicators and Warnings

If on entry 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:
IFAIL=1
On entry,M<1,
orNEQ<1,
orLDYSAV<1,
orNEQ>LDYSAV,
orM>NEQ,
orNQU<1,
orSDYSAV<NQU+1,
orthe BDF integrator was not previously used,
orthe Petzold error test, if applicable, was used.
IFAIL=2
On entry, HU=0.0 or 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 D02XKF.
IFAIL=3
D02XKF has been called for extrapolation. Before returning with this error exit, the value of the solution at XSOL is calculated and placed in SOL.
IFAIL=-99
An unexpected error has been triggered by this routine. Please contact NAG.
See Section 3.8 in the Essential Introduction for further information.
IFAIL=-399
Your licence key may have expired or may not have been installed correctly.
See Section 3.7 in the Essential Introduction for further information.
IFAIL=-999
Dynamic memory allocation failed.
See Section 3.6 in the Essential Introduction for further information.

7  Accuracy

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

8  Parallelism and Performance

Not applicable.

9  Further Comments

D02XKF provides a C1 interpolant and as such is ideal for most applications, for example for tabulation and root-finding. In general D02XKF should be preferred to D02XJF for interpolation as the latter provides only a C0 interpolant. D02XJF is the natural interpolant employed by the BDF method and it is supplied only to permit you to reproduce the internal values used by the integrator.

10  Example

See Section 10 in D02NDF and D02NMF.

D02XKF (PDF version)
D02 Chapter Contents
D02 Chapter Introduction
NAG Library Manual

© The Numerical Algorithms Group Ltd, Oxford, UK. 2015