where yy is the vector of nn solution components and tt is the independent variable.

nag_ode_ivp_rk_onestep (d02pd) computes the solution at the end of an integration step. Using the information computed on that step nag_ode_ivp_rk_interp (d02px) computes the solution by interpolation at any point on that step. It cannot be used if method = 3method=3 was specified in the call to setup function nag_ode_ivp_rk_setup (d02pv).

Accuracy

Further Comments

None.

Example

This example solves the equation

y ′ ′ = − y, y(0) = 0, y′(0) = 1

y′′=-y, y(0)=0, y′(0)=1

reposed as

y1 ′ = y2

y1′=y2

y2 ′ = − y1

y2′=-y1

over the range [0,2π][0,2π] with initial conditions y1 = 0.0y1=0.0 and y2 = 1.0y2=1.0. Relative error control is used with threshold values of 1.0e−81.0e−8 for each solution component. nag_ode_ivp_rk_onestep (d02pd) is used to integrate the problem one step at a time and nag_ode_ivp_rk_interp (d02px) is used to compute the first component of the solution and its derivative at intervals of length π / 8π/8 across the range whenever these points lie in one of those integration steps. A moderate order Runge–Kutta method (method = 2method=2) is also used with tolerances tol = 1.0e−3tol=1.0e−3 and tol = 1.0e−4tol=1.0e−4 in turn so that solutions may be compared. The value of ππ is obtained by using nag_math_pi (x01aa).