euler {simecol} | R Documentation |
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.
euler(y, times, func, parms, ...)
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, parms) . t is the current time point
in the integration, y is the current estimate of the variables
in the ode system, and parms is a vector of parameters (which
may have a names attribute, desirable in a large system).
The return value of func should be a list, whose first element is a vector containing the derivatives of y with respect to
time , and whose second element is a vector (possibly with a
names attribute) of global values that are required at
each point in times . |
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 |
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.
A data frame of the model outputs (e.g. states) for all timesteps.
sim
, parms
rk4
, lsoda
, iteration
.
# ordinary usage data(lv) solver(lv) <- "euler" plot(sim(lv)) # alternative usage euler(lv)