# NAG FL Interfaced02xkf (ivp_​stiff_​c1_​interp)

## ▸▿ Contents

Settings help

FL Name Style:

FL Specification Language:

## 1Purpose

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 ${C}^{1}$ interpolation suitable for general use.

## 2Specification

Fortran Interface
 Subroutine d02xkf ( xsol, sol, m, ysav, acor, neq, x, nqu, hu, h,
 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)
#include <nag.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)
The routine may be called by the names d02xkf or nagf_ode_ivp_stiff_c1_interp.

## 3Description

d02xkf evaluates the first $m$ components of the solution of a system of ordinary differential equations at any point using ${C}^{1}$ 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.

None.

## 5Arguments

1: $\mathbf{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 $\left({\mathbf{xsol}}-{\mathbf{x}}\right)×{\mathbf{hu}}\le 0.0$. Extrapolation is permitted but not recommended.
2: $\mathbf{sol}\left({\mathbf{m}}\right)$Real (Kind=nag_wp) array Output
On exit: the calculated value of the $\mathit{i}$th component of the solution at xsol, for $\mathit{i}=1,2,\dots ,m$.
3: $\mathbf{m}$Integer Input
On entry: the number of components of the solution whose values at xsol are required. The first $m$ components are evaluated.
Constraint: $1\le {\mathbf{m}}\le {\mathbf{neq}}$.
4: $\mathbf{ysav}\left({\mathbf{ldysav}},{\mathbf{sdysav}}\right)$Real (Kind=nag_wp) array Communication Array
On entry: the values provided in the argument ysav on return from the integrator.
5: $\mathbf{ldysav}$Integer Input
On entry: the value used for the argument ldysav when calling the integrator.
Constraint: ${\mathbf{ldysav}}\ge {\mathbf{neq}}$.
6: $\mathbf{sdysav}$Integer Input
On entry: the value used for the argument sdysav when calling the integrator.
Constraint: ${\mathbf{sdysav}}\ge {\mathbf{nqu}}+1$.
7: $\mathbf{acor}\left({\mathbf{neq}}\right)$Real (Kind=nag_wp) array Input
On entry: the value returned in position $\left({\mathbf{ldysav}}+50+\mathit{i}\right)$, for $\mathit{i}=1,2,\dots ,{\mathbf{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, ${\mathbf{acor}}\left(\mathit{i}\right)$ must contain the value given in position $\left(\mathit{i},2\right)$ of the monitr argument acor, for $\mathit{i}=1,2,\dots ,{\mathbf{neq}}$ (e.g., see d02nbf).
8: $\mathbf{neq}$Integer Input
On entry: the value used for the argument neq when calling the integrator.
Constraint: $1\le {\mathbf{neq}}$.
9: $\mathbf{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: $\mathbf{nqu}$Integer Input
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: ${\mathbf{nqu}}\ge 1$.
11: $\mathbf{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: $\mathbf{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: $\mathbf{ifail}$Integer Input/Output
On entry: ifail must be set to $0$, $-1$ or $1$ to set behaviour on detection of an error; these values have no effect when no error is detected.
A value of $0$ causes the printing of an error message and program execution will be halted; otherwise program execution continues. A value of $-1$ means that an error message is printed while a value of $1$ means that it is not.
If halting is not appropriate, the value $-1$ or $1$ is recommended. If message printing is undesirable, then the value $1$ is recommended. Otherwise, the value $0$ is recommended. When the value $-\mathbf{1}$ 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).
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 ${\mathbf{ifail}}={\mathbf{1}}$ or ${\mathbf{2}}$.

## 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{ldysav}}=⟨\mathit{\text{value}}⟩$.
Constraint: ${\mathbf{ldysav}}\ge 1$.
On entry, ${\mathbf{m}}=⟨\mathit{\text{value}}⟩$.
Constraint: ${\mathbf{m}}\ge 1$.
On entry, ${\mathbf{m}}=⟨\mathit{\text{value}}⟩$ and ${\mathbf{neq}}=⟨\mathit{\text{value}}⟩$.
Constraint: ${\mathbf{m}}\le {\mathbf{neq}}$.
On entry, ${\mathbf{neq}}=⟨\mathit{\text{value}}⟩$.
Constraint: ${\mathbf{neq}}\ge 1$.
On entry, ${\mathbf{neq}}=⟨\mathit{\text{value}}⟩$ and ${\mathbf{ldysav}}=⟨\mathit{\text{value}}⟩$.
Constraint: ${\mathbf{neq}}\le {\mathbf{ldysav}}$.
On entry, ${\mathbf{nqu}}=⟨\mathit{\text{value}}⟩$.
Constraint: ${\mathbf{nqu}}\ge 1$.
On entry, ${\mathbf{sdysav}}=⟨\mathit{\text{value}}⟩$ and ${\mathbf{nqu}}=⟨\mathit{\text{value}}⟩$.
Constraint: ${\mathbf{sdysav}}\ge {\mathbf{nqu}}+1$.
The BDF integration method is not being used.
The Petzold error test was selected.
${\mathbf{ifail}}=2$
On entry, ${\mathbf{h}}=0.0$.
On entry, ${\mathbf{hu}}=0.0$.
${\mathbf{ifail}}=3$
Extrapolation has been performed.
${\mathbf{ifail}}=-99$
See Section 7 in the Introduction to the NAG Library FL Interface for further information.
${\mathbf{ifail}}=-399$
Your licence key may have expired or may not have been installed correctly.
See Section 8 in the Introduction to the NAG Library FL Interface for further information.
${\mathbf{ifail}}=-999$
Dynamic memory allocation failed.
See Section 9 in the Introduction to the NAG Library FL Interface for further information.

## 7Accuracy

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

## 8Parallelism and Performance

d02xkf provides a ${C}^{1}$ 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 ${C}^{0}$ 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.