[R-sig-dyn-mod] Time steps of integration

Thomas Petzoldt Thomas.Petzoldt at TU-Dresden.de
Mon Nov 18 22:01:35 CET 2013


Dear Justin and others,

many thanks for your thoughts and the really nice example, but I don't
think "variable internal steps" would seamlessly fit in deSolve's
philosophy:

odepack provides are a standard set of solvers. They have been already
modified by us to include forcings and events. However, interpolation
was already built in. We are happy with this, and I do not think, that
it would be wise to rewrite the odepack functions.

The Runge-Kutta solvers are a new implementation from the equations, and
partly inspired by Press et al. It would be possible in principle, to
save all intermediate steps as an option, however, I don't assume that
we will do it:

1) Memory: For bigger and esp. stiff problems, saving all intermediate
steps requires more than a bit more of of memory. Karline mentioned that
we do not know in advance how many internal steps are required. This
would require dynamic variables. This is possible, but would further
increase complexity of the code.

2) More important: Some RK solvers (e.g. ode45) use "dense output", a
mechanism, that interpolates directly from the intermediate
Runge-Kutta steps. This is very efficient and an integrated part of the
algorithm and its underlying mathematics, see Karline's comment:

On 18.11.2013 09:30, Karline Soetaert wrote:
>
> Secondly, the value at the requested output times is not found by
> simple linear interpolation at the end (as suggested by Justin), but
> higher-order interpolation during the integration, usually with
> variable order, the order depending on the dynamics. Thus, allowing
> to let the user to linearly interpolate afterwards would give much
> less accurate solutions.

As said, the cosine example is nice, but it is not very typical and I
don't think that we will implement saving internal steps in deSolve.

However,  if someone wants, one may start to provide such an algorithm
in an own proof of concept package. R is free and open source software.
Contributions are always welcome :)

Thanks,

Thomas



More information about the R-sig-dynamic-models mailing list