Presets
Playback
Rabbits and grass
Rabbits breed at rate a, but grass limits how many can live: the carrying capacity K. Slide K to the right end for no limit.
Foxes
A fox catches a rabbit within reach r at rate k. Each meal can become a cub with chance c. Foxes die at rate d.
Movement and senses
Fast, well-mixed animals match the equations best. Short sight and slow animals form local booms and busts.
Time and drawing
Time speed changes how fast the model runs. Animals are drawn larger than life; this does not change the model.
Layers
Model checks
The science
Two models side by side
Solid lines are an agent-based model: every rabbit and fox is a separate animal that walks around a fenced meadow. Dashed lines are the Lotka-Volterra equations with a carrying capacity, which only track the two totals. Both start with the same numbers and use the same rates.
The equations
With rabbits x and foxes y:
dx/dt = a x (1 - x/K) - b x ydy/dt = c b x y - d y
ais the rabbit birth rate,Kthe carrying capacity set by the grass,dthe fox death rate.b = k pi r^2 / Ais the attack rate. A fox catches a rabbit inside its reachrat ratek;Ais the meadow area, sopi r^2 / Ais the chance that a given pair is close enough.cis the number of fox cubs per rabbit eaten (a conversion efficiency).
Where the populations settle
The fox nullcline is the vertical line x* = d / (c b): at that many rabbits the foxes exactly replace themselves. The rabbit nullcline is the line y = (a/b)(1 - x/K). They cross at (x*, y*) with y* = (a/b)(1 - x*/K). If x* is larger than K the grass cannot feed enough rabbits and the foxes die out.
Cycles, damping and the carrying capacity
Linearising at the equilibrium gives lambda^2 + (a x*/K) lambda + d a (1 - x*/K) = 0, so the cycle frequency is omega = sqrt(d a (1 - x*/K) - (a x*/2K)^2) and the oscillation decays like exp(-a x* t / 2K). With K unlimited (slider at its right end) the decay vanishes, the orbits are closed and the quantity H = c b x - d ln x + b y - a ln y stays constant. A smaller K pulls the cycles into the equilibrium: grass limits the rabbits before the foxes can overshoot.
Why the agents wander away from the curves
- Chance. Births, deaths and catches are random events, so small populations wobble and can go extinct. The classic model without
Khas no restoring force, so noise makes the cycles grow and a crash eventually happens. - Space. The equations assume every fox meets every rabbit equally often (a well-mixed meadow). Real animals move at finite speed, hunt where they see prey and flee from predators, so local booms and busts appear. The speed, sight, chase and flee sliders control how far the meadow is from well mixed.
- Catch rate. The graph of catches per fox usually sits below the mean-field line b x: foxes hunt where rabbits already are thinned out, rabbits flee, and a fox can only take one rabbit per moment. Make the animals fast and set chase and flee to zero and the two lines come close.
- Boundary. The fence is a reflecting wall; near it fewer pairs can meet, so the true attack rate is a few percent below the formula.
Honest simplifications
Time is measured in abstract units t. Animals are drawn larger than life and grass is decoration (its effect is the single number K). Foxes have no hunger state or age, rabbits breed all the time, and nothing else eats or is eaten. The model teaches the logic of predator-prey cycles; it does not forecast real fox or rabbit numbers. Immigration (if you turn it on) is not part of the dashed model.
The three checks in the panel
(1) The RK4 integrator conserves H for the classic model and reproduces the period predicted by linear theory. (2) The agent model with rabbits only follows the logistic curve N(t) = K / (1 + (K/N0 - 1) e^(-a t)). (3) With foxes and rabbits shuffled every step, the number of catches matches b = k pi r^2 / A including the exact boundary correction for a square.
What to try
Things to try
- Press Classic cycles and watch the phase plane: the blue agent path circles the white equilibrium dot while the dashed model path spirals in.
- Move the carrying capacity K to its right end ("no limit"): the dashed orbit becomes a closed loop and the agents drift into booms and busts.
- Raise the catch rate and the reach radius: the attack rate
bgrows and the rabbit equilibriumd/(c b)falls. - Turn flee strength up to 1: rabbits escape so well that the foxes starve. Turn chase up and see the orange lines.
- Slow both animals down (Sleepy, poorly mixed) and compare the agent curves with the dashed model.
- Use Refuge: immigrants rescue to see how a trickle of newcomers keeps a small meadow alive.
- Drag fox death rate d up until the fox equilibrium drops to zero: the foxes cannot survive on this meadow.