Learn R Programming

simecol (version 0.5-5)

rk4: Runge-Kutta 4th order integration

Description

Solving initial value problems for systems of first-order ordinary differential equations (ODEs) using the classical Runge-Kutta 4th order integration. This is a special version designed to work with odeModel objects.

Usage

rk4(y, times, func, parms, ...) 
  # rk4(y)

Arguments

y
The odeModel object to be solved.
times
Placeholder for compatibility with the odesolve package
func
Placeholder for compatibility with the odesolve package
parms
Placeholder for compatibility with the odesolve package
...
Additional parameters, reserved for extensions

Value

  • A list of the model outputs (states ...) for all timesteps.

Details

The solver method rk4 is used to simulate ODE models. It creates a local environment in a way that parameters, inputs and equations are visible within the main function of the odeModel. Normally, this function is called indirectly from sim.

See Also

sim, parms lsoda, euler, iteration, original rk4 from the odesolve package.

Examples

Run this code
# ordinary usage
    data(lv)
    solver(lv) <- "rk4"
    plot(sim(lv))

    # alternative usage
    rk4(lv)

Run the code above in your browser using DataLab