NAG Library Function Document
nag_ode_ivp_adams_interp (d02qzc) interpolates components of the solution of a non-stiff system of first order ordinary differential equations from information provided by nag_ode_ivp_adams_roots (d02qfc)
. Normally this function will be used in conjunction with the integration function, nag_ode_ivp_adams_roots (d02qfc)
, operating in one-step mode.
nag_ode_ivp_adams_interp (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 nag_ode_ivp_adams_roots (d02qfc)
. nag_ode_ivp_adams_interp (d02qzc) should not normally be used to extrapolate outside the current range of the values produced by the integration function.
Watts H A and Shampine L F (1986) Smoother interpolants for Adams codes SIAM J. Sci. Statist. Comput. 7 334–345
neqf – IntegerInput
On entry: the number of differential equations.
twant – doubleInput
: 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
or if integration is proceeding in the negative direction
Extrapolation is permitted but not recommended and a fail
value of NW_EXTRAPOLATION
is returned whenever extrapolation is attempted.
nwant – IntegerInput
: the number of components of the solution and derivative whose values, at twant
, are required. The first nwant
components are evaluated.
ywant[nwant] – doubleOutput
contains the calculated value of the
th component of the solution at twant
ypwant[nwant] – doubleOutput
contains the calculated value of the
th component of the derivative at twant
opt – Nag_ODE_Adams *Input
: the structure of type Nag_ODE_Adams as output from the integration function nag_ode_ivp_adams_roots (d02qfc)
. The structure must
be passed unchanged. (See Section 8
for comments about deallocation of memory from opt
fail – NagError *Input/Output
The NAG error argument (see Section 3.6
in the Essential Introduction).
6 Error Indicators and Warnings
On entry, .
The value of neqf
supplied is not the same as that given to the setup function
but the value given to
The integrator function nag_ode_ivp_adams_roots (d02qfc)
has not been called.
No successful integration steps were taken in the call(s) to the integration function nag_ode_ivp_adams_roots (d02qfc)
is greater than the value of neqf
given to the setup function nag_ode_ivp_adams_setup (d02qwc)
Extrapolation requested, .
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 nag_ode_ivp_adams_interp (d02qzc). However, the actual error in extrapolation will, in general, be much larger than for interpolation.
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 nag_ode_ivp_adams_setup (d02qwc)
. This allocated memory is used by nag_ode_ivp_adams_roots (d02qfc)
and nag_ode_ivp_adams_interp (d02qzc). When all calls to these functions have been completed the function nag_ode_ivp_adams_free (d02qyc)
may be called to free the allocated memory from the structure.
This example solves the equation
over the range
with initial conditions
using vector error control (
) and nag_ode_ivp_adams_roots (d02qfc)
in one-step mode (
). nag_ode_ivp_adams_interp (d02qzc) is used to provide solution values at intervals of
9.1 Program Text
Program Text (d02qzce.c)
9.2 Program Data
9.3 Program Results
Program Results (d02qzce.r)