NAG CL Interface
d02qzc (ivp_​adams_​interp)

Settings help

CL Name Style:


1 Purpose

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.

2 Specification

#include <nag.h>
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.

3 Description

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.

4 References

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

5 Arguments

1: neqf Integer Input
On entry: the number of differential equations.
Constraint: neqf1 .
2: 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
opttcurr - opthlast twant opttcurr.
or if integration is proceeding in the negative direction
opttcurr - opthlast twant opttcurr.
Extrapolation is permitted but not recommended and a fail value of NW_EXTRAPOLATION is returned whenever extrapolation is attempted.
3: 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 nwant neqf .
4: ywant[nwant] double Output
On exit: ywant[i-1] contains the calculated value of the i th component of the solution at twant, for i=1,2,,nwant.
5: ypwant[nwant] double Output
On exit: ypwant[i-1] contains the calculated value of the i th component of the derivative at twant, for i=1,2,,nwant.
6: 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: fail NagError * Input/Output
The NAG error argument (see Section 7 in the Introduction to the NAG Library CL Interface).

6 Error Indicators and Warnings

NE_INT_ARG_LT
On entry, nwant=value.
Constraint: nwant1.
NE_NEQF
The value of neqf supplied is not the same as that given to the setup function d02qwc. neqf=value but the value given to d02qwc was 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. nwant=value , neqf=value .
NW_EXTRAPOLATION
Extrapolation requested, twant=value .

7 Accuracy

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.

8 Parallelism and Performance

d02qzc is not threaded in any implementation.

9 Further Comments

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.

10 Example

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 [0,π/2] with initial conditions y 1 = 0 and y 2 = 1 using vector error control ( vectol=Nag_TRUE ) and d02qfc in one-step mode ( one_step=Nag_TRUE ). d02qzc is used to provide solution values at intervals of π/16 .

10.1 Program Text

Program Text (d02qzce.c)

10.2 Program Data

None.

10.3 Program Results

Program Results (d02qzce.r)