# naginterfaces.library.ode.ivp_​rk_​interp_​setup¶

naginterfaces.library.ode.ivp_rk_interp_setup(irevcm, nwant, yp, comm)[source]

ivp_rk_interp_setup is a reverse communication function that computes the interpolant for evaluation by ivp_rk_interp_eval() anywhere on an integration step taken by ivp_rk_step_revcomm(). The direct communication version of the ivp_rk_interp_setup and ivp_rk_interp_eval() pair is ivp_rkts_interp(). A significant difference in functionality between the forward and reverse communication versions is that ivp_rk_interp_setup and ivp_rk_interp_eval() can interpolate for the high-order Runge–Kutta method.

For full information please refer to the NAG Library document for d02ph

https://www.nag.com/numeric/nl/nagdoc_28.6/flhtml/d02/d02phf.html

Parameters
irevcmint

On initial entry: must be set to zero to indicate that the interpolant for a new step is being taken.

On intermediate entry: should remain unchanged.

nwantint

The number of components of the solution to be computed. The first components are evaluated.

ypfloat, array-like, shape

On initial entry: need not be set.

On intermediate entry: must contain the values of the derivatives for the given values of the parameters , .

commdict, communication object, modified in place

Communication structure.

This argument must have been initialized by a prior call to ivp_rkts_setup().

Returns
irevcmint

On intermediate exit: returns a value to indicate that a function evaluation is required prior to re-entry; the value of the derivatives must be returned in where the value of is supplied in and the values are supplied in the array .

On final exit:

Successful exit; [‘rwsav’] and [‘wcomm’] contain details of the interpolant.

Error exit; should be interrogated to determine the nature of the error.

tfloat

On intermediate exit: contains the value of the independent variable at which the derivatives are to be evaluated.

On final exit: contains no useful information.

yfloat, ndarray, shape

On intermediate exit: contains the value of the solution at which the derivatives are to be evaluated.

On final exit: contains no useful information.

Raises
NagValueError
(errno )

You cannot call this function after the integrator has returned an error.

(errno )

You cannot call this function before you have called the step integrator.

(errno )

You cannot call this function after the range integrator has been called.

(errno )

On entry, , but the value passed to the setup function was .

(errno )

On entry, and .

Constraint: .

(errno )

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.

Notes

ivp_rk_interp_setup and its associated functions (ivp_rk_step_revcomm(), ivp_rk_interp_eval(), ivp_rkts_setup(), ivp_rkts_reset_tend(), ivp_rkts_diag() and ivp_rkts_errass()) solve the initial value problem for a first-order system of ordinary differential equations. The functions, based on Runge–Kutta methods and derived from RKSUITE (see Brankin et al. (1991)), integrate

where is the vector of solution components and is the independent variable.

ivp_rk_step_revcomm() computes the solution at the end of an integration step. Using the information computed on that step ivp_rk_interp_setup computes the interpolant which can be evaluated at any point on that step by ivp_rk_interp_eval(). If or then there is enough information available from the stages of the last step to provide an interpolant of sufficient order of accuracy; no further derivative evaluations will, therefore, be requested. If or then the interpolant is an order continuous Runge–Kutta process that requires a further stages of derivative evaluations that will be requested in turn before a final exit. If or was specified in the call to setup function ivp_rkts_setup() then the interpolant is a continuous Runge–Kutta process requiring a further stages of derivative evaluations that will be requested in turn.

References

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