Settings help

CL Name Style:

## 1Purpose

d02qzc interpolates components of the solution of a non-stiff system of first order ordinary differential equations from information provided by d02qfc. Normally this function will be used in conjunction with the integration function, d02qfc, operating in one-step mode.

## 2Specification

 #include
 void d02qzc (Integer neqf, double twant, Integer nwant, double ywant[], double ypwant[], Nag_ODE_Adams *opt, NagError *fail)
The function may be called by the names: d02qzc or nag_ode_ivp_adams_interp.

## 3Description

d02qzc evaluates the first nwant components of the solution of a non-stiff system of first order ordinary differential equations at any point using the method of Watts and Shampine (1986) and information generated by d02qfc. d02qzc should not normally be used to extrapolate outside the current range of the values produced by the integration function.

## 4References

Watts H A and Shampine L F (1986) Smoother interpolants for Adams codes SIAM J. Sci. Statist. Comput. 7 334–345

## 5Arguments

1: $\mathbf{neqf}$Integer Input
On entry: the number of differential equations.
Constraint: ${\mathbf{neqf}}\ge 1$.
2: $\mathbf{twant}$double Input
On entry: the point at which components of the solution and derivative are to be evaluated. twant should not normally be an extrapolation point, that is twant should satisfy
$\mathbf{opt}\mathbf{\to }\mathbf{tcurr}-\mathbf{opt}\mathbf{\to }\mathbf{hlast}\le {\mathbf{twant}}\le \mathbf{opt}\mathbf{\to }\mathbf{tcurr}$.
or if integration is proceeding in the negative direction
$\mathbf{opt}\mathbf{\to }\mathbf{tcurr}-\mathbf{opt}\mathbf{\to }\mathbf{hlast}\ge {\mathbf{twant}}\ge \mathbf{opt}\mathbf{\to }\mathbf{tcurr}$.
Extrapolation is permitted but not recommended and a fail value of NW_EXTRAPOLATION is returned whenever extrapolation is attempted.
3: $\mathbf{nwant}$Integer Input
On entry: the number of components of the solution and derivative whose values, at twant, are required. The first nwant components are evaluated.
Constraint: $1\le {\mathbf{nwant}}\le {\mathbf{neqf}}$.
4: $\mathbf{ywant}\left[{\mathbf{nwant}}\right]$double Output
On exit: ${\mathbf{ywant}}\left[\mathit{i}-1\right]$ contains the calculated value of the $\mathit{i}$th component of the solution at twant, for $\mathit{i}=1,2,\dots ,{\mathbf{nwant}}$.
5: $\mathbf{ypwant}\left[{\mathbf{nwant}}\right]$double Output
On exit: ${\mathbf{ypwant}}\left[\mathit{i}-1\right]$ contains the calculated value of the $\mathit{i}$th component of the derivative at twant, for $\mathit{i}=1,2,\dots ,{\mathbf{nwant}}$.
6: $\mathbf{opt}$Nag_ODE_Adams * Input
On entry: the structure of type Nag_ODE_Adams as output from the integration function d02qfc. The structure must be passed unchanged. (See Section 9 for comments about deallocation of memory from opt.)
7: $\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_INT_ARG_LT
On entry, ${\mathbf{nwant}}=⟨\mathit{\text{value}}⟩$.
Constraint: ${\mathbf{nwant}}\ge 1$.
NE_NEQF
The value of neqf supplied is not the same as that given to the setup function d02qwc. ${\mathbf{neqf}}=⟨\mathit{\text{value}}⟩$ but the value given to d02qwc was $⟨\mathit{\text{value}}⟩$.
NE_NO_INTEGRATE
The integrator function d02qfc has not been called.
NE_NO_STEPS
No successful integration steps were taken in the call(s) to the integration function d02qfc.
NE_NWANT_GT
nwant is greater than the value of neqf given to the setup function d02qwc. ${\mathbf{nwant}}=⟨\mathit{\text{value}}⟩$, ${\mathbf{neqf}}=⟨\mathit{\text{value}}⟩$.
NW_EXTRAPOLATION
Extrapolation requested, ${\mathbf{twant}}=⟨\mathit{\text{value}}⟩$.

## 7Accuracy

The error in interpolation is of a similar order to the error arising from the integration. The same order of accuracy can be expected when extrapolating using d02qzc. However, the actual error in extrapolation will, in general, be much larger than for interpolation.

## 8Parallelism and Performance

d02qzc is not threaded in any implementation.

When interpolation for only a few components is required then it is more efficient to order the components of interest so that they are numbered first.
The structure opt will contain pointers which have been allocated memory during a call to d02qwc. This allocated memory is used by d02qfc and d02qzc. When all calls to these functions have been completed the function d02qyc may be called to free the allocated memory from the structure.

## 10Example

This example solves the equation
 $y ′′ = -y , y (0) = 0 , y ′ (0) = 1$
reposed as
 $y 1 ′ = y 2 y 2 ′ = - y 1$
over the range $\left[0,\pi /2\right]$ with initial conditions ${y}_{1}=0$ and ${y}_{2}=1$ using vector error control (${\mathbf{vectol}}=\mathrm{Nag_TRUE}$) and d02qfc in one-step mode (${\mathbf{one_step}}=\mathrm{Nag_TRUE}$). d02qzc is used to provide solution values at intervals of $\pi /16$.

### 10.1Program Text

Program Text (d02qzce.c)

None.

### 10.3Program Results

Program Results (d02qzce.r)