Why Mathematical Biology Works
Living systems look impossibly complex from the outside. A temperate forest contains thousands of interacting species across dozens of trophic levels, all embedded in fluctuating abiotic conditions. Yet remarkably simple mathematical models — systems of coupled ordinary differential equations — capture the core qualitative behaviour: the oscillating predator–prey cycles, the cascade that follows a keystone extinction, the convergence to a steady state when growth and mortality balance.
The reason is that ecology, like physics, is governed by conservation laws and rate processes. Energy enters as primary production, flows up trophic levels at roughly 10% efficiency per step, and eventually dissipates as heat. The mathematics describing these flows is the same mathematics used for chemical kinetics and fluid dynamics. This structural similarity is what makes ecological modelling powerful — and why simulations built on the same equations can reveal genuine ecological insight.
Predator–Prey Cycles: The Lotka-Volterra Equations
The foundational model of population ecology was published independently by Alfred Lotka in 1925 and Vito Volterra in 1926. Volterra was motivated by a puzzle in the Adriatic fishery data: during World War I, when fishing ceased, sharks increased and prey fish decreased — the opposite of what most people expected. His equations explained why.
Lotka-Volterra Predator–Prey Model
dN/dt = αN − βNP (prey: birth − predation)
dP/dt = δNP − γP (predator: conversion − death)
N = prey population, P = predator population
α = prey birth rate, β = predation rate
δ = predator conversion efficiency, γ = predator death rate
Fixed point: N* = γ/δ, P* = α/β (neutrally stable centre)
Period of oscillation ≈ 2π / √(αγ)
The Lotka-Volterra model predicts neutrally stable oscillations: the populations cycle around a fixed point without converging or diverging. Real systems show damped oscillations because of carrying capacity and density-dependent effects, but the basic cycle — prey abundance drives predator growth, predator abundance drives prey decline, prey decline drives predator decline, which allows prey recovery — is robustly observed in nature. Classic data comes from the Hudson's Bay Company fur trading records of lynx and snowshoe hare populations from 1845 to 1935.
Prey–Predator (Lotka-Volterra)
Agent-based Lotka-Volterra on a 2D grid: rabbits graze and reproduce, foxes hunt and die. Population graphs update in real time alongside the spatial grid. Observe the classic phase-space cycle between prey and predator abundance.
Food Web
Six-species ecosystem (Grass / Shrubs / Rabbit / Deer / Fox / Wolf) on extended Lotka-Volterra + RK4. Network graph where node size = population, time-series panel, click-toggle species on/off. Presets: stable / predator collapse / plant boom / trophic cascade / competitive exclusion.
The lynx–hare cycle runs on a ~10-year period. Hare populations peak roughly every decade; lynx populations follow 1–2 years later. At peak, hares may reach 2 000 per km² — at trough, fewer than 10. The mechanism is partly trophic (lynx predation) and partly bottom-up (food plant overgrazing during the hare peak causes a nutritional crash that kills hares even before lynx populations decline). The simulation captures both effects when you enable plant carrying capacity.
Trophic Cascades: When Wolves Change Rivers
A trophic cascade is an indirect effect that propagates through the food web from top predators downward (top-down) or from primary productivity upward (bottom-up). The most famous documented example is the reintroduction of grey wolves to Yellowstone National Park in 1995. The wolves reduced elk numbers and, more importantly, changed elk behaviour — elk stopped overgrazing stream banks for fear of ambush. Riparian vegetation recovered, riverbanks stabilised through root systems, and river channels narrowed and deepened. Beavers returned. Songbirds returned. The wolves, by changing a single top-predator–herbivore interaction, changed the physical geography of the park.
The mathematics of trophic cascades involves three-level Lotka-Volterra systems: plant–herbivore–carnivore. The equilibrium of the plant level can be controlled by the top predator through indirect suppression of the herbivore, a phenomenon ecologists call "mesopredator release" when a top predator is removed.
Trophic Cascade
Three-level Lotka-Volterra: Plants → Herbivores → Carnivores. Toggle predator removal to watch herbivores explode and vegetation collapse. The "mesopredator release" scenario recreates documented Yellowstone-type dynamics with live time-series curves.
Boids Flocking
Emergent swarm behaviour from three local rules: separation, alignment, cohesion. Reynolds (1986) algorithm, 150 agents, tunable weights and neighbourhood radii. Watch coordinated group motion emerge from purely local interactions — a microcosm of how collective behaviour arises in animal groups.
Three-Level Lotka-Volterra (Trophic Cascade)
dV/dt = r·V(1 − V/K) − a₁·V·H (plants)
dH/dt = e₁·a₁·V·H − d₁·H − a₂·H·C (herbivores)
dC/dt = e₂·a₂·H·C − d₂·C (carnivores)
V = vegetation, H = herbivores, C = carnivores
r = plant growth rate, K = carrying capacity
a₁, a₂ = attack rates; e₁, e₂ = conversion efficiencies
d₁, d₂ = natural death rates
Circadian Rhythms: Biological Clocks
Almost all living organisms — from cyanobacteria to humans — maintain an internal clock that tracks the ~24-hour day-night cycle. These circadian rhythms regulate gene expression, hormone secretion, body temperature, feeding behaviour, and sleep–wake cycles. Disruption of circadian rhythms (shift work, jet lag, artificial light at night) correlates with elevated risk of metabolic syndrome, cancer, and cardiovascular disease.
The molecular mechanism was elucidated by Hall, Rosbash, and Young (Nobel Prize in Physiology or Medicine, 2017). The core is a transcription–translation feedback loop: the CLOCK/BMAL1 protein complex activates transcription of the PER and CRY genes; PER and CRY proteins accumulate, inhibit CLOCK/BMAL1, reduce their own transcription, degrade, and the cycle repeats. The mathematical description is a Goodwin oscillator — a negative feedback loop with a time delay that sustains oscillations.
Circadian Rhythm Oscillator
Goodwin oscillator modelling melatonin, cortisol, and core body temperature over a 24-hour cycle. Four presets: Normal / Shift Work / Jet Lag East / Jet Lag West. Watch how light entrainment phase-shifts the clock and how misalignment drives phase drift.
Brownian Motion
Particle diffusion driven by thermal noise: D = k_B T / (6πηr). Animated particles, live mean-squared displacement vs theoretical prediction, temperature and viscosity sliders. The Einstein relation connecting diffusion to dissipation — fundamental to molecular biology.
Goodwin Oscillator (Circadian Core Loop)
dX/dt = v₁ / (K₁ + Zⁿ) − v₂·X / (K₂ + X)
dY/dt = v₃·X − v₄·Y / (K₄ + Y)
dZ/dt = v₅·Y − v₆·Z / (K₆ + Z)
X = mRNA, Y = cytoplasmic protein, Z = nuclear protein
n = Hill coefficient (≥ 9 for sustained oscillation)
Period ≈ 24 h set by degradation rates v₂, v₄, v₆
Entrainment: external light adjusts v₁ phase-dependently
The Goodwin oscillator is a prototypical negative-feedback oscillator: a gene product represses its own production through a chain of intermediates. Sustained oscillations require a Hill coefficient n ≥ 9 — a highly cooperative nonlinear repression. The simulation lets you explore how changing degradation rates shifts the period, and how light-pulse phase-response curves (PRCs) describe entrainment.
Brownian Motion and Diffusion in Living Systems
In 1827, botanist Robert Brown observed pollen grains moving erratically in water. In 1905, Einstein derived the diffusion coefficient D = k_B T / (6πηr) from first principles using the kinetic theory of heat — and showed that the mean-squared displacement grows linearly with time: ⟨r²⟩ = 6Dt for 3D diffusion, 4Dt for 2D, 2Dt for 1D. This provided the first quantitative evidence for molecular reality.
In living cells, Brownian motion is not just a curiosity — it is the primary transport mechanism at the nanoscale. Molecules smaller than ~5 nm diffuse rapidly enough to explore the entire cell volume in seconds. Larger complexes and organelles require active transport by molecular motors (kinesin, dynein) along cytoskeletal tracks. The crossover length between passive diffusion and active transport is set by the balance of thermal energy k_B T and the energy available per ATP molecule (~80 pN·nm).
Cell signalling relies on diffusion cascades. When a hormone binds a receptor at the cell surface, the signal propagates into the cell via a phosphorylation cascade — each kinase activating the next. The speed of this cascade is ultimately limited by diffusion of the activated kinase to its substrate. This is why signalling molecules tend to be small (fast diffusion) and why the cell is compact (short diffusion distances). The 3-minute delay between an adrenaline spike and peak glycogen mobilisation in muscle cells is dominated by diffusive transport.
Ecological Networks: From Simple to Complex
Real ecosystems are not simple predator–prey pairs. The food web of a temperate lake may contain hundreds of species connected by thousands of trophic links. Ecologists characterise these networks by their connectance C (fraction of possible links that exist), average chain length, and proportion of top, intermediate, and basal species.
Robert May's 1972 paradox showed mathematically that random networks become less stable (in the linear-stability sense) as they become larger and more connected — contradicting the then-prevailing intuition that diversity promotes stability. The resolution is that real food webs are not random: they have structure (weak links dominate, strong interactions are rare) that allows large, complex networks to be dynamically stable.
SIR Epidemic Model
Susceptible–Infected–Recovered compartmental model: dS/dt = −βSI/N, dI/dt = βSI/N − γI. Live curves and agent grid. Herd immunity threshold R₀ = β/γ clearly visible — vaccination required fraction p ≥ 1 − 1/R₀.
Ant Colony Foraging
Ant Colony Optimisation (ACO) on a 2D foraging arena: ants lay pheromone trails, evaporation prevents lock-in, positive feedback concentrates traffic on the shortest path. Emergent collective intelligence from simple local rules.
Energy Flow and Trophic Efficiency
The "10% rule" of ecology states that roughly 10% of the energy at one trophic level is available at the next. A primary producer captures solar radiation; a herbivore eating that plant captures about 10% as biomass; a carnivore eating the herbivore captures about 10% of that, meaning only ~1% of the original solar energy. This is why food chains are rarely longer than 5–6 links: beyond that, there is simply too little energy to support a viable predator population.
The reason for the inefficiency is thermodynamic: most of the energy in food is dissipated as heat during respiration, lost in faeces, or used for non-growth metabolic processes (maintenance costs). Ecological efficiency = assimilation efficiency × net production efficiency × consumption efficiency. For warm-blooded vertebrates, maintenance costs are very high (endothermy is expensive), reducing ecological efficiency to 1–5%. For ectotherms (insects, fish), efficiencies can reach 15–20%.
Trophic Efficiency & Energy Flow
Ecological efficiency: ε = P_n / P_{n-1} ≈ 0.10
Production at level n: P_n = ε^n · P_0
P_0 = net primary production (NPP, g C m⁻² yr⁻¹)
Temperate forest NPP ≈ 600 g C m⁻² yr⁻¹
Ocean NPP ≈ 130 g C m⁻² yr⁻¹
Available to top predator (5 levels): ~0.001% of NPP
Assimilation efficiency (herbivore): ~60–80%
Net production efficiency (endotherm): ~1–3%