Learn R Programming

simecol (version 0.5-5)

euler: Euler Integration

Description

Solving initial value problems for systems of first-order ordinary differential equations (ODEs) using the simple Euler forward integration method. A special version is available to work with odeModel objects.

Usage

euler(y, times, func, parms, ...)

Arguments

y
the initial values for the ode system. If y has a name attribute, the names will be used to label the output matrix.
times
times at which explicit estimates for y are desired. The first value in times must be the initial time.
func
a user-supplied function that computes the values of the derivatives in the ode system (the model defininition) at time t. The user-supplied function func must be called as: yprime = func(t, y, parm
parms
vector or list holding the parameters used in func that should be modifiable without rewriting the function.
...
additional arguments, allowing this to be a generic function

Value

  • A data frame of the model outputs (e.g. states) for all timesteps.

Details

The solver method euler 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. The Euler method is the most primitive integration method and can be regarded simply as a fixed step solution of the corresponding difference equation.

See Also

sim, parms rk4, lsoda, iteration.

Examples

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

    # alternative usage
    euler(lv)

Run the code above in your browser using DataLab