# NAG CL Interfaced02pjc (ivp_​rk_​interp_​eval)

Settings help

CL Name Style:

## 1Purpose

d02pjc evaluates the interpolant calculated by d02phc, following an integration step performed by d02pgc to solve an initial value problem.

## 2Specification

 #include
 void d02pjc (Nag_Boolean icheck, Integer n, Integer nwant, double t, Integer ideriv, double sol[], double wcomm[], Integer lwcomm, Integer iwsav[], double rwsav[], NagError *fail)
The function may be called by the names: d02pjc or nag_ode_ivp_rk_interp_eval.

## 3Description

When integrating using the reverse communication Runge–Kutta integrator d02pgc, the solution or its derivatives can be obtained inexpensively between steps by interpolation. d02phc is called after a step by d02pgc from a previous value of $t$ ($={t}_{k-1}$) to its current value, $t={t}_{k}$ (i.e., a $k$th successful time-step has been taken). d02pjc can then be called to evaluate interpolated approximations of the function or its derivatives at any value of $t$ in the interval $\left({t}_{k-1},{t}_{k}\right)$.

## 4References

Brankin R W, Gladwell I and Shampine L F (1991) RKSUITE: A suite of Runge–Kutta codes for the initial value problems for ODEs SoftReport 91-S1 Southern Methodist University

## 5Arguments

1: $\mathbf{icheck}$Nag_Boolean Input
On entry: indicates whether consistency checks on input arguments should be performed
${\mathbf{icheck}}=\mathrm{Nag_FALSE}$
Don't perform checks on input arguments.
${\mathbf{icheck}}=\mathrm{Nag_TRUE}$
Perform consistency checks on input arguments.
It is recommended to use ${\mathbf{icheck}}=\mathrm{Nag_TRUE}$ on the first call following a call to d02phc and to set ${\mathbf{icheck}}=\mathrm{Nag_FALSE}$ on subsequent calls within the last step to avoid the overhead of argument checking.
2: $\mathbf{n}$Integer Input
On entry: $n$, the dimension of the system of ODEs being integrated.
Constraint: this must be the same value as supplied in a previous call to d02pqc.
3: $\mathbf{nwant}$Integer Input
On entry: only the first nwant system components to be computed. This should be the same value as passed to d02phc when computing the interpolant.
Constraint: ${\mathbf{nwant}}={\mathbf{nwant}}$ passed to d02phc.
4: $\mathbf{t}$double Input
On entry: $t$, the value of the independent variable where a solution is desired. Although any value of $t$ can be supplied, accurate solutions can only be obtained for values in the range of the last time-step taken by d02pgc.
5: $\mathbf{ideriv}$Integer Input
On entry:
${\mathbf{ideriv}}=0$
Compute approximations to the first nwant components of the solution $y\left(t\right)$.
${\mathbf{ideriv}}=1$
Compute approximations to the first nwant components of the first derivatives of the solution ${y}^{\prime }\left(t\right)$.
Constraint: ${\mathbf{ideriv}}=0$ or $1$.
6: $\mathbf{sol}\left[{\mathbf{nwant}}\right]$double Output
On exit:
${\mathbf{ideriv}}=0$
The first nwant components of the solution $y\left(t\right)$.
${\mathbf{ideriv}}=1$
The first nwant components of the first derivatives of the solution ${y}^{\prime }\left(t\right)$.
7: $\mathbf{wcomm}\left[{\mathbf{lwcomm}}\right]$double Communication Array
On entry: this must be the same array supplied in a previous call to d02phc. It must remain unchanged between calls.
8: $\mathbf{lwcomm}$Integer Input
On entry: length of wcomm. This should be the same value as supplied in a previous call to d02phc.
If in a previous call to d02pqc:
• ${\mathbf{method}}=\mathrm{Nag_RK_2_3}$, lwcomm must be at least $1$.
• ${\mathbf{method}}=\mathrm{Nag_RK_4_5}$, lwcomm must be at least ${\mathbf{n}}+\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left({\mathbf{n}},5×{\mathbf{nwant}}\right)$.
• ${\mathbf{method}}=\mathrm{Nag_RK_7_8}$, ${\mathbf{lwcomm}}\ge 8×{\mathbf{nwant}}$.
9: $\mathbf{iwsav}\left[130\right]$Integer Communication Array
10: $\mathbf{rwsav}\left[32×{\mathbf{n}}+350\right]$double Communication Array
On entry: these must be the same arrays supplied in a previous call d02pgc. They must remain unchanged between calls.
On exit: information about the integration for use on subsequent calls to d02pgc, d02phc or other associated functions.
11: $\mathbf{fail}$NagError * Input/Output
The NAG error argument (see Section 7 in the Introduction to the NAG Library CL Interface).

## 6Error Indicators and Warnings

NE_ALLOC_FAIL
Dynamic memory allocation failed.
See Section 3.1.2 in the Introduction to the NAG Library CL Interface for further information.
On entry, argument $⟨\mathit{\text{value}}⟩$ had an illegal value.
NE_INT
On entry, ${\mathbf{ideriv}}=⟨\mathit{\text{value}}⟩$.
Constraint: ${\mathbf{ideriv}}=0$ or $1$.
On entry, ${\mathbf{lwcomm}}=⟨\mathit{\text{value}}⟩$.
Constraint: for ${\mathbf{method}}=\mathrm{Nag_RK_2_3}$, ${\mathbf{lwcomm}}\ge 1$.
NE_INT_2
On entry, ${\mathbf{lwcomm}}=⟨\mathit{\text{value}}⟩$ and ${\mathbf{nwant}}=⟨\mathit{\text{value}}⟩$.
Constraint: for ${\mathbf{method}}=\mathrm{Nag_RK_7_8}$, ${\mathbf{lwcomm}}\ge 8×{\mathbf{nwant}}$.
NE_INT_3
On entry, ${\mathbf{lwcomm}}=⟨\mathit{\text{value}}⟩$, ${\mathbf{n}}=⟨\mathit{\text{value}}⟩$ and ${\mathbf{nwant}}=⟨\mathit{\text{value}}⟩$.
Constraint: for ${\mathbf{method}}=\mathrm{Nag_RK_4_5}$, ${\mathbf{lwcomm}}\ge {\mathbf{n}}+\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left({\mathbf{n}},5×{\mathbf{nwant}}\right)$.
NE_INT_CHANGED
On entry, ${\mathbf{n}}=⟨\mathit{\text{value}}⟩$, but the value passed to the setup routine was ${\mathbf{n}}=⟨\mathit{\text{value}}⟩$.
On entry, ${\mathbf{nwant}}=⟨\mathit{\text{value}}⟩$, but on interpolation setup ${\mathbf{nwant}}=⟨\mathit{\text{value}}⟩$.
Constraint: nwant must be unchanged from setup.
NE_INTERNAL_ERROR
An internal error has occurred in this function. Check the function call and any array sizes. If the call is correct then please contact NAG for assistance.
See Section 7.5 in the Introduction to the NAG Library CL Interface for further information.
NE_MISSING_CALL
On entry, a previous call to the setup function has not been made or the communication arrays have become corrupted, or a catastrophic error has already been detected elsewhere.
You cannot continue integrating the problem.
You cannot call this function before you have called the interpolation setup.
NE_NO_LICENCE
Your licence key may have expired or may not have been installed correctly.
See Section 8 in the Introduction to the NAG Library CL Interface for further information.
NE_PREV_CALL_INI
The previous call to the interpolation setup function returned an error.

## 7Accuracy

The computed values will be of a similar accuracy to that computed by d02pgc.

## 8Parallelism and Performance

d02pjc is not threaded in any implementation.