Ecology: Lotka–Volterra
The classic predator–prey oscillator. Prey grow on their own, predators decline without food, and chance encounters couple the two populations into the canonical boom-bust cycle.
What it simulates
- Prey reproduce when predators are scarce.
- Predator–prey encounters reduce prey and feed predator reproduction.
- Predators decline without prey.
- The system circles a non-zero equilibrium at
N* = gamma/delta,P* = alpha/beta. - An invariant-drift audit checks that the numerical integrator is faithful to the conserved quantity.

Run it on the Hub
- Open the Lotka–Volterra System Lab on the public Hub.
- Click Run. The default scenario runs for 250 days.
Inputs you can tune
| Input | Meaning |
|---|---|
prey_initial_population | Starting prey count. |
predator_initial_population | Starting predator count. |
prey_growth_rate | Prey growth in the absence of predators. |
predation_rate | How strongly predator–prey encounters reduce prey. |
predator_mortality_rate | Predator decline without prey. |
predator_reproduction_rate | How prey encounters add to predators. |
What results to expect
- Population trajectory: lagged predator–prey oscillations.
- Phase portrait: a closed loop around the non-zero equilibrium, with start/end markers and the
dN/dt = 0anddP/dt = 0nullclines. - Summary table: parameters, equilibrium, final populations, min/max ranges, and an estimated cycle period.
- Invariant-drift audit: a numerical-quality check; large drift means the integration step is too coarse.

Source on GitHub: models-ecology — lotka-volterra-system. For carrying capacity, seasons, disease, or migration, use the Rosenzweig–MacArthur lab instead.