NAG Library Routine Document

d02xkf  (ivp_stiff_c1_interp)

 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

Fortran Interface
Subroutine d02xkf ( xsol, sol, m, ysav, ldysav, sdysav, acor, neq, x, nqu, hu, h, ifail)
Integer, Intent (In):: m, ldysav, sdysav, neq, nqu
Integer, Intent (Inout):: ifail
Real (Kind=nag_wp), Intent (In):: xsol, ysav(ldysav,sdysav), acor(neq), x, hu, h
Real (Kind=nag_wp), Intent (Out):: sol(m)
C Header Interface
#include nagmk26.h
void  d02xkf_ ( const double *xsol, double sol[], const Integer *m, const double ysav[], const Integer *ldysav, const Integer *sdysav, const double acor[], const Integer *neq, const double *x, const Integer *nqu, const double *hu, const double *h, Integer *ifail)

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
Arguments

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 argument ysav on return from the integrator.
5:     ldysav – IntegerInput
On entry: the value used for the argument ldysav when calling the integrator.
Constraint: ldysav1.
6:     sdysav – IntegerInput
On entry: the value used for the argument 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 argument rwork returned by the integrator. If one of the direct communication D02N routines is being employed and d02xkf is to be used in monitr, acori must contain the value given in position i,2 of the monitr argument acor, for i=1,2,,neq (e.g., see d02nbf).
8:     neq – IntegerInput
On entry: the value used for the argument 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 argument 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 argument 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 argument 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 argument 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 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​ 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 -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.9 in How to Use the NAG Library and its Documentation for further information.
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.
ifail=-999
Dynamic memory allocation failed.
See Section 3.7 in How to Use the NAG Library and its Documentation 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

d02xkf is not thread safe and should not be called from a multithreaded user program. Please see Section 3.12.1 in How to Use the NAG Library and its Documentation for more information on thread safety.
d02xkf is not threaded in any implementation.

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.
© The Numerical Algorithms Group Ltd, Oxford, UK. 2017