nag_ode_ivp_rk_diag (d02py) provides details about an integration performed by either
nag_ode_ivp_rk_range (d02pc) or
nag_ode_ivp_rk_onestep (d02pd).
Note: this function is scheduled to be withdrawn, please see
d02py in
Advice on Replacement Calls for Withdrawn/Superseded Routines..
nag_ode_ivp_rk_diag (d02py) and its associated functions (
nag_ode_ivp_rk_range (d02pc),
nag_ode_ivp_rk_onestep (d02pd),
nag_ode_ivp_rk_setup (d02pv),
nag_ode_ivp_rk_reset_tend (d02pw),
nag_ode_ivp_rk_interp (d02px) and
nag_ode_ivp_rk_errass (d02pz)) 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.
After a call to
nag_ode_ivp_rk_range (d02pc) or
nag_ode_ivp_rk_onestep (d02pd),
nag_ode_ivp_rk_diag (d02py) can be called to obtain information about the cost of the integration and the size of the next step.
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
None.
None.
Not applicable.
When a secondary integration has taken place, that is when global error assessment has been specified using
in a prior call to
nag_ode_ivp_rk_setup (d02pv), then the approximate extra number of evaluations of
used is given by
for
or
and
for
.
function d02py_example
fprintf('d02py example results\n\n');
tstart = 0;
ystart = [0; 1];
tend = 6.283185307179586;
tol = 0.001;
thres = [1e-08; 1e-08];
method = int64(2);
task = 'Complex Task';
errass = false;
lenwrk = int64(64);
neq = int64(2);
twant = 0.3926990816987241;
reqest = 'Both';
nwant = int64(1);
wrkint = zeros(7, 1);
[work, ifail] = ...
d02pv(tstart, ystart, tend, tol, thres, method, task, errass, lenwrk);
npts = 16;
tnow = tend-1;
while (tnow < tend)
[tnow, ynow, ypnow, work, ifail] = d02pd(@f, neq, work);
j = npts -1;
tinc = tend/npts;
while (twant <= tnow)
[ywant, ypwant, work, wrkint, ifail] = ...
d02px(neq, twant, reqest, nwant, @f, work, wrkint);
j = j-1;
twant = tend -j*tinc;
end
end
[totfcn, stpcst, waste, stpsok, hnext, ifail] = d02py
function [yp] = f(t, y)
yp = zeros(2, 1);
yp(1) = y(2);
yp(2) = -y(1);