jsf_lotka_volterra

< Back to Reference | View source

jsf_lotka_volterra()

Simulate a Lotka-Volterra predator-prey model using JSF

Usage

jsf_lotka_volterra(
  prey0 = 50,
  predator0 = 10,
  prey_birth = 2,
  predation = 0.05,
  predator_death = 1.5,
  t_max = 10,
  dt = 0.01,
  switching_threshold = 30
)

Arguments

Argument Description
prey0 Initial prey population.
predator0 Initial predator population.
prey_birth Prey birth rate.
predation Predation rate.
predator_death Predator death rate.
t_max Final simulation time.
dt Time step for the continuous/ODE part of JSF.
switching_threshold Switching threshold for both species.

Value

A data frame with columns time, prey, and predator.

Description

This function runs a simple Lotka-Volterra predator-prey model using the Python jsf package through reticulate.

Examples

if (interactive() && jsf_available()) {
    result <- jsf_lotka_volterra(
    prey0 = 50,
    predator0 = 10,
    t_max = 1
  )

  head(result)
}