I want to use the explicit Runge-Kutta method ode45 (alias rk45dp7) from the deSolve R package in order to solve an ODE problem with variable step size.
According to the deSolve documentation, it is possible to use adaptive or variable time steps for the rk solver function with the ode45 method instead of equidistant time steps but I'm at loss how to do this.
The rk funcion is called like this:
rk(y, times, func, parms, rtol = 1e-6, atol = 1e-6, verbose = FALSE, tcrit = NULL,
hmin = 0, hmax = NULL, hini = hmax, ynames = TRUE, method = rkMethod("rk45dp7", ... ),
maxsteps = 5000, dllname = NULL, initfunc = dllname, initpar = parms, rpar = NULL,
ipar = NULL, nout = 0, outnames = NULL, forcings = NULL, initforc = NULL, fcontrol =
NULL, events = NULL, ...)
with times being the vector of times at which explicit estimates for y are desired.
For equdistant time steps with a distance of 0.01 I can write times as
times <- seq(0, 100, 0.01)
Supposing I want to solve the equation for the interval from 0 to 100 how do I define times without giving a step size?
Any help would be greatly appreciated.