https://github.com/cran/simecol
Raw File
Tip revision: ce9edb46a7228393bae544a53448f34582ccb2fa authored by Thomas Petzoldt on 30 September 2007, 00:00:00 UTC
version 0.5-2
Tip revision: ce9edb4
rk4.R
## Classical Runge-Kutta-fixed-step-integration
## using imported function from package odesolve

setGeneric("rk4")

setMethod("rk4", "odeModel", 
  function(y, times=NULL, func=NULL, parms=NULL) {
    times             <- fromtoby(y@times)
    func              <- y@main
    inputs            <- y@inputs
    equations         <- y@equations
    parms <- y@parms
    environment(func) <- environment()
    attach(equations)
    on.exit(detach(equations))
    rk4(y@init, times, func, parms)
  }
)
back to top