The paradox of perpetual oscillation
Picture a meadow with 50 rabbits and 10 foxes. The rabbits have plenty of grass to eat, so they reproduce freely. The foxes have plenty of rabbits to hunt. It sounds like a recipe for stability — two species, locked in mutual dependence, finding their natural equilibrium.
It never works that way. The foxes overshoot. They eat too many rabbits. The rabbit population crashes. Now there is not enough food for all the foxes, and many starve. With fewer predators, the surviving rabbits multiply again — and the whole cycle lurches forward once more. Real systems like the famous Canadian lynx–snowshoe hare data show these oscillations repeating across decades.
The reason is not chaos or dysfunction. It is a fundamental mathematical property of coupled predator–prey systems. And to understand it properly, you need to simulate it — because the stochastic version, where every birth and death is a random event rather than a smooth equation, behaves quite differently from the textbook Lotka–Volterra curve.
The discrete stochastic model: how the simulation works
The simulation implements a discrete-time stochastic predator–prey model. Unlike the continuous Lotka–Volterra equations, every event — a birth, a kill, a death — is treated as an individual probabilistic outcome drawn from a binomial distribution. This more closely mirrors what actually happens in a population of countable individuals.
Each time step, four random processes fire in sequence:
new_prey ~ Binomial(prey, birth_rate)
prey_killed ~ Binomial(prey, 1 − exp(−predation_rate × pred))
new_pred ~ Binomial(prey_killed, pred_birth_rate)
pred_died ~ Binomial(pred, pred_death_rate)
The kill probability uses a Poisson encounter model: 1 − exp(−λ × pred) gives the probability that at least one predator finds a given prey individual, where λ is the per-predator kill rate. This prevents the kill probability from exceeding 1 as predator numbers grow.
The key insight is that predator reproduction is coupled to predation success — a predator can only reproduce if it successfully kills prey that generation. This tight coupling is what drives the oscillations.
Interact with the simulation
Adjust the parameters below and run the simulation. The experiments in §5 will guide you through exactly what to look for and why it matters.
Prey Predators
Struggling with ecology and population topics?
Our expert tutors break down predator–prey dynamics, food webs, and population biology for O & A Level students — with clear explanations and exam technique built in.
What each parameter actually does
The model has six biological parameters, each controlling a distinct aspect of the ecosystem. Changing any one of them shifts the balance between predator and prey in a predictable — but sometimes surprising — way.
| Parameter | Name | Effect on dynamics |
|---|---|---|
| prey_birth_rate | Prey reproduction |
Prey + Higher rates allow prey to recover faster after predation events. Very high rates can cause prey booms that temporarily overwhelm predator control, leading to larger oscillation peaks. Think: rabbits vs. elephants as prey. |
| predation_rate (λ) | Hunt efficiency |
Pred +Prey − The single most destabilising parameter. High λ means each predator finds more prey per generation. Above a threshold, this drives prey to near-extinction before predators starve — triggering population collapse in both species. |
| pred_birth_rate | Conversion efficiency |
Pred + How many new predators does each kill produce? High conversion amplifies predator booms, which then crash harder. Low conversion keeps predator numbers stable but makes them vulnerable to starvation during prey crashes. |
| pred_death_rate | Predator mortality |
Pred − Higher death rates prevent predator numbers from spiralling too high during prey booms. Paradoxically, a moderate death rate can stabilise the system by dampening oscillation amplitude. |
| prey_init / pred_init | Starting populations |
Phase These set the starting phase of the oscillation cycle. A prey-heavy start (e.g. 200 prey, 10 predators) will first show a predator boom; a predator-heavy start (e.g. 50 prey, 40 predators) will immediately crash prey. Same underlying system, very different trajectories. |
Guided experiments: what to look for
Run these four experiments in sequence. Together they reveal why the predator–prey cycle is one of the most important concepts in A-Level ecology.
Use all default settings and run the simulation. Notice that the predator peak always follows the prey peak by several generations. This is the predator–prey lag: predators can only grow after there is food to eat, and by the time they are numerous, they have already begun to deplete their food supply. This lag is the engine of the oscillation.
Set predation_rate to 0.08 (apex predators), keep everything else default. In many runs you will see prey crash to zero within 20–30 generations, followed immediately by predator extinction. This is the overexploitation outcome: predators are so efficient that they eat themselves out of house and home. It models the real-world consequence of removing natural limits on predator hunting efficiency.
Set prey birth rate to 0.80, initial prey to 200, and run 200 generations. The prey population rockets upward first, creating a massive food surplus — then predator numbers explode in response. The resulting crash is deeper and more violent. High productivity ecosystems produce larger oscillations, not stable ones. This challenges the common intuition that "more resources = more stability."
Keep default settings. Run the simulation three times with seed = Random. Compare the trajectories: the same parameters produce noticeably different outcomes each time — different peak heights, different extinction risks, different cycle lengths. Now run three times with seed = 123 (fixed). The trajectories are identical. This distinction between stochastic and deterministic models is crucial: real ecosystems behave like the random version, not the textbook curve.
Oscillation is not failure — it is the system working
A common misconception at A-Level is that the predator–prey cycle represents ecological instability — that a "healthy" ecosystem would reach equilibrium. The simulation shows this is backwards. The oscillation is the equilibrium, just a dynamic one.
The reason is negative feedback with a time delay. Predators respond to prey abundance, but their response takes time — reproduction takes generations. By the time the predator population reflects the previous peak in prey numbers, the prey population has already begun to fall. This built-in lag makes equilibrium mathematically unstable; the system cannot simply stay at the fixed point. It orbits around it instead.
The stochastic version makes one additional, important point: in small or fragmented populations, the randomness is large enough to drive either species to zero. This is not a model failure — it reflects the real risk of extinction in small wildlife populations, and is one reason why conservation ecologists work hard to maintain large, connected habitat patches that support large population sizes.
Understanding these dynamics is not just an exam topic. It underlies fisheries management (setting sustainable catch quotas), invasive species control (predicting what happens when you introduce a new predator), and the design of nature reserves.
How the simulation runs
The simulation runs entirely in your browser in JavaScript. Each generation, binomial random variates are sampled using a loop of independent Bernoulli trials — mathematically equivalent to R's rbinom(1, size, prob). The kill probability formula 1 − exp(−λ × pred) is the Poisson encounter model: it gives the probability that at least one predator encounters a given prey individual, assuming predators search independently. This prevents biologically impossible kill rates above 100%.
A fixed random seed produces identical runs — just as R's set.seed(123) does — allowing reproducible experiments. Selecting "Random" uses a different seed each time, demonstrating the variance inherent in stochastic models.
The model assumes: (1) discrete non-overlapping generations, (2) homogeneous populations with no spatial structure, (3) no carrying capacity on prey, (4) no age structure. Real ecosystems violate all of these, which is why more complex models (e.g. Rosenzweig–MacArthur, stage-structured models) exist. For a rigorous treatment, see May's Stability and Complexity in Model Ecosystems.