title: Adaptive time step for Runge-Kutta method ode45 in deSolve
body: <p>I want to use the explicit Runge-Kutta method <strong>ode45</strong> (alias rk45dp7) from the <strong>deSolve</strong> R package in order to solve an ODE problem with variable step size.</p>
  <p>According to the deSolve documentation, it is possible to use adaptive or variable time steps for the <strong><a href="http://www.inside-r.org/packages/cran/deSolve/docs/rk" rel="nofollow noreferrer">rk</a></strong> solver function with the ode45 method instead of equidistant time steps but I'm at loss how to do this.</p>
  <p>The rk funcion is called like this:</p>
  <pre><code>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(&quot;rk45dp7&quot;, ... ), 
  maxsteps = 5000, dllname = NULL, initfunc = dllname, initpar = parms, rpar = NULL, 
  ipar = NULL, nout = 0, outnames = NULL, forcings = NULL, initforc = NULL, fcontrol = 
  NULL, events = NULL, ...)
  </code></pre>
  <p>with <em>times</em> being the vector of times at which explicit estimates for y are desired.</p>
  <p>For equdistant time steps with a distance of 0.01 I can write <em>times</em> as</p>
  <pre><code>times &lt;- seq(0, 100, 0.01)
  </code></pre>
  <p>Supposing I want to solve the equation for the interval from 0 to 100 how do I define <em>times</em> without giving a step size?</p>
  <p>Any help would be greatly appreciated.</p>