## Not run: ------------------------------------
# # Lotka-Volterra predator-prey equations
# LV.sys = function(x, t)
# {
# c(x[1] - 0.1 * x[1] * x[2],
# 0.05 * x[1] * x[2] - 0.5 * x[2])
# }
# null_rec = function(x, t) NULL
# system.time(integrate_sys(LV.sys, rep(1, 2), 1e3, observer = null_rec))
# named_rec = function(x, t) c(Prey = x[1], Predator = x[2])
# x = integrate_sys(LV.sys, rep(1, 2), 100, 0.01, observer = named_rec)
# plot(x[, 2:3], type = "l", lwd = 3, col = "steelblue")
# Sys.sleep(0.5)
#
# # Lorenz model from odeint examples
# Lorenz.sys = function(x, t)
# {
# c(10 * (x[2] - x[1]),
# 28 * x[1] - x[2] - x[1] * x[3],
# -8/3 * x[3] + x[1] * x[2])
# }
# system.time(integrate_sys(Lorenz.sys, rep(1, 3), 1e2, obs = null_rec))
# x = integrate_sys(Lorenz.sys, rep(1, 3), 100, 0.01)
# plot(x[, c(2, 4)], type = 'l', col = "steelblue")
## ---------------------------------------------
Run the code above in your browser using DataLab