knitr::opts_chunk$set( collapse = TRUE, comment = "#>" )
library(mmbr, warn.conflicts = FALSE)
Define model parameters and state variables.
params <- new('LotkaVolterraParams', prey_percapita_growth = 1, predation_rate = 0.3, predation_efficiency = 0.6, predator_percapita_degradation = 0.5 ) init_state <- new('LotkaVolterraState', prey_population = 2, predator_population = 1 )
Numerical integration using Euler's method.
solution <- mmbr::solve(params, init_state, time_range = 30, step_size = 0.1) head(solution, n = 5)
Plot time series data.
mmbr::tsplot(params, solution)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.