R Language Solving ODEs in R


  • ode(y, times, func, parms, method, ...)


y(named) numeric vector: the initial (state) values for the ODE system
timestime sequence for which output is wanted; the first value of times must be the initial time
funcname of the function that computes the values of the derivatives in the ODE system
parms(named) numeric vector: parameters passed to func
methodthe integrator to use, by default: lsoda


Note that it is necessary to return the rate of change in the same ordering as the specification of the state variables. In example "The Lorenz model" this means, that in the function "Lorenz" command

return(list(c(dX, dY, dZ)))

has the same order as the definition of the state variables

yini <- c(X = 1, Y = 1, Z = 1)