🌿 Population Dynamics — Logistic Growth & Predator-Prey
Model population growth from exponential to logistic with carrying capacity. Add predators to get Lotka-Volterra oscillations. Watch boom-bust cycles on time series and phase portrait.
About this simulation
This simulation models how populations change over time using two classic ecological equations: logistic growth, where a single species grows toward a carrying capacity, and the Lotka-Volterra predator-prey model, where prey and predator numbers rise and fall together in coupled cycles. Both are solved live with a simple numerical integrator, plotted as a time series and as a phase portrait of prey population N against predator population P.
🔬 What it shows
In Logistic mode, the prey population N follows dN/dt = r·N·(1−N/K): growth starts near-exponential when N is small and flattens as N approaches the carrying capacity K, shown as a dashed line on the time-series chart. Switching to Predator-Prey mode adds a Lotka-Volterra pair, dN/dt = r·N − β·N·P and dP/dt = δ·N·P − γ·P, which produces the oscillating boom-bust cycles visible as closed loops on the phase portrait rather than a flat plateau.
🎮 How to use
Toggle between Logistic and Predator-Prey with the two mode buttons. Adjust growth rate r and carrying capacity K to reshape the logistic curve, or tune predation rate beta, conversion efficiency delta and predator death rate gamma to change the size and speed of the Lotka-Volterra cycles. The four presets (Rabbits only, Lynx-Hare, Near extinction, Stable equilibrium) load ready-made parameter sets so you can compare regimes instantly, and the stats box reports the live equilibrium point N* = gamma/delta, P* = r/beta.
💡 Did you know?
The Lotka-Volterra equations were derived independently by Alfred Lotka (1925) and Vito Volterra (1926), the latter to explain why fish catches in the Adriatic Sea rose during World War I when fishing pressure actually fell. The predator-prey cycle they describe never settles down: on the phase portrait the trajectory loops endlessly around the equilibrium point (the yellow dot) instead of converging to it, a signature of neutrally stable oscillations rather than damped ones.
Frequently asked questions
What is logistic growth and what does the carrying capacity K mean?
Logistic growth models a population that cannot grow forever because resources are limited. The equation dN/dt = r·N·(1−N/K) starts out behaving like exponential growth when N is much smaller than K, then slows as N approaches K and stops entirely once N equals K. K is the carrying capacity: the maximum population size the environment can sustain, shown in the simulation as a dashed green line that the N(t) curve approaches but never crosses.
How does the Predator-Prey mode differ from Logistic mode?
Predator-Prey mode replaces the single logistic equation with the Lotka-Volterra pair: dN/dt = r·N − β·N·P for the prey and dP/dt = δ·N·P − γ·P for the predator. Instead of settling at a carrying capacity, N and P rise and fall in a repeating cycle, prey numbers grow until predators multiply enough to bring them down, then predators decline once prey become scarce, letting prey recover and the cycle repeat, visible as a closed loop on the phase portrait rather than a flat line.
What do beta, delta and gamma control?
Beta is the predation rate: how quickly predators remove prey from the population as the two interact. Delta is the conversion efficiency: how effectively each prey eaten turns into new predators. Gamma is the predator death rate in the absence of food. Together these three parameters set both the size of the oscillation and the location of the equilibrium point, which the simulation computes as N* = gamma/delta and P* = r/beta and marks with a yellow dot on the phase portrait.
Why do the four presets behave so differently?
Rabbits only sets beta, delta and gamma to zero so predators have no effect, leaving pure logistic growth toward K = 300. Lynx-Hare and Stable equilibrium both use the full Lotka-Volterra system but with different rate constants, producing cycles of different amplitude and period. Near extinction uses a high predation rate (beta = 0.05) and low conversion (delta = 0.001), which can drive the prey population down to very low numbers before recovering, illustrating how sensitive coupled populations are to their parameters.
Why does the phase portrait trace a closed loop instead of settling to a point?
The Lotka-Volterra system is a conservative oscillator: it has no built-in damping term, so once started away from the equilibrium point N* = gamma/delta, P* = r/beta, the prey and predator populations orbit around that point indefinitely rather than spiraling into it. Each full loop on the phase portrait corresponds to one complete boom-bust cycle in time; larger loops mean bigger swings between scarcity and abundance for both species.
Adjust birth rates, death rates and carrying capacity to move logistic growth and Lotka-Volterra predator-prey cycles between equilibrium and extinction.
3D · Three.js / WebGL renderer · 60 FPS target · runs fully client-side, no install