steady | R Documentation |
Estimates the steady-state condition for a system of ordinary differential equations.
This is a wrapper around steady-state solvers stode
, stodes
and runsteady
.
steady(y, time = NULL, func, parms = NULL, method = "stode", times = time, ...)
y |
the initial guess of (state) values for the ODE system, a vector.
If |
time, times |
time for which steady-state is wanted;
the default is |
func |
either an R-function that computes the values of the
derivatives in the ode system (the model defininition) at time The return value of The derivatives
should be specified in the same order as the state variables |
parms |
parameters passed to |
method |
the solution method to use, one of |
... |
additional arguments passed to function |
This is simply a wrapper around the various steady-state solvers.
See package vignette for information about specifying the model in compiled code.
See the selected solver for the additional options.
A list containing
y |
a vector with the state variable values from the last iteration
during estimation of steady-state condition of the system of equations.
If |
... |
the number of "global" values returned. |
The output will have the attribute steady
, which returns TRUE
,
if steady-state has been reached and the attribute
precis
with the precision attained during each iteration.
Karline Soetaert <karline.soetaert@nioz.nl>
steady.band
, to find the steady-state of ODE models with a
banded Jacobian
steady.1D
, steady.2D
,
steady.3D
, steady-state solvers for 1-D, 2-D and 3-D
partial differential equations.
stode
, iterative steady-state solver for ODEs with full
or banded Jacobian.
stodes
, iterative steady-state solver for ODEs with arbitrary
sparse Jacobian.
runsteady
, steady-state solver by dynamically running to
steady-state
## =======================================================================
## Bacteria (Bac) growing on a substrate (Sub)
## =======================================================================
model <- function(t, state, pars) {
with (as.list(c(state,pars)), {
# substrate uptake death respiration
dBact = gmax*eff*Sub/(Sub+ks)*Bact - dB*Bact - rB*Bact
dSub =-gmax *Sub/(Sub+ks)*Bact + dB*Bact +input
return(list(c(dBact, dSub)))
})
}
pars <- list(gmax = 0.5,eff = 0.5,
ks = 0.5, rB = 0.01, dB = 0.01, input = 0.1)
# Newton-Raphson. pos = TRUE ensures only positive values are generated.
steady(y = c(Bact = 0.1, Sub = 0), time = 0,
func = model, parms = pars, pos = TRUE)
# Dynamic run to steady-state
as.data.frame(steady(y = c(Bact = 0.1, Sub = 0), time = c(0, 1e5),
func = model, parms = pars, method = "runsteady"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.