Understanding the Lotka–Volterra calculator — concept and principle
This calculator simulates the classic Lotka–Volterra predator–prey model. From starting populations and four rate constants it gives the populations at the end, the range each population swings through, the equilibrium point, the small-oscillation period and the cycle length found in the simulation. It is used in ecology and differential-equations courses.
How it is calculated
dx/dt = α x − β x y (prey grow and are eaten)
dy/dt = δ x y − γ y (predators grow by eating and die off)
Equilibrium: x* = γ ÷ δ, y* = α ÷ β
Small-oscillation period = 2π ÷ √(α γ)
- The equations are integrated with a 4th-order Runge–Kutta method using a step of 0.01 time units.
- The simulated cycle length is the average time between prey peaks.
The principle
Without predators, prey would grow exponentially; without prey, predators would die out exponentially. The interaction terms link them: encounters, proportional to x·y, remove prey and feed predators. When prey are plentiful, predators increase; more predators then cut the prey down; with less food, predators decline; and prey recover. The populations therefore circle around the equilibrium, with predator peaks lagging prey peaks. Small swings have the period 2π/√(αγ); larger swings take longer.
Worked example
Default inputs: x₀ = 40, y₀ = 9, α = 0.5, β = 0.02, δ = 0.005, γ = 0.4, 60 time units.
- Equilibrium prey = 0.4 ÷ 0.005 = 80; equilibrium predators = 0.5 ÷ 0.02 = 25.
- Small-oscillation period = 2π ÷ √(0.5 × 0.4) = 14.
- The simulation starts far from equilibrium, so the swings are large: prey range 19.1 to 211.3, predators 7.2 to 60.5.
- The simulated cycle length is 15.5, longer than 14 because the swings are large.
- After 60 time units: prey 23.4, predators 14.7.
| Predator gain δ (per prey per time unit) | Prey at the end |
|---|---|
| 0.00125 | 642.9 |
| 0.0025 | 57 |
| 0.00375 | 20.7 |
| 0.005 | 23.4 |
| 0.00625 | 28.6 |
| 0.0075 | 33 |
| 0.01 | 36.5 |
How to read the result
The equilibrium values are the average levels around which the populations cycle. In this model the cycle never dies down or grows: its size depends only on the starting point. Raising the prey birth rate α raises the predator equilibrium, not the prey one, which is a well-known and counter-intuitive result of the model.
Common mistakes
- Expecting the populations to settle at equilibrium; in this model they keep cycling.
- Mixing up β (loss of prey per encounter) and δ (gain of predators per encounter).
- Using too long a simulation with a coarse step, which can make numerical cycles drift.
Frequently asked questions
Why do predator peaks come after prey peaks?
Predators need time to grow in number after food becomes plentiful.
Can either species die out in this model?
Not if both start above zero; the populations cycle forever.
What does α/β represent?
The predator population at which prey neither grow nor shrink.
Why is the simulated period longer than 2π/√(αγ)?
That formula holds for small swings; larger cycles take longer.
Sources: S. D. Ryan, Math 251 ODE and PDE, Lecture 29 "9.5 Predator-Prey Equations" (2012)