Predator-Prey Lotka-Volterra Interactive Simulator
A predator–prey dynamics calculator solves the classic two-species Lotka-Volterra equations and visualizes the closed orbits, the conservation invariant, and the period of oscillation in real time. Students, teachers, and curious individuals can use this tool to work out closed orbit shapes, conservation accuracy, and small-amplitude period estimates without writing code.
Predator-Prey Lotka-Volterra Interactive Simulator
Solve and visualize the classic two-species predator-prey equations. Adjust four rate parameters, two initial conditions, and a numerical step size. See the closed orbits, the conserved quantity, and the period of oscillation in real time.
Parameters
Initial conditions
Numerical controls
1 Equilibrium & period
2 Phase plane: prey x vs predator y
3 Population vs time
4 Conservation & stability
How to Use the Predator-Prey Lotka-Volterra Interactive Simulator

- Pick a preset from the chips above the input panel, or enter your own values for alpha, beta, delta, and gamma.
- Set the initial prey density x0 and the initial predator density y0 in the initial conditions section.
- Set the simulation horizon T and the numerical step size dt in the numerical controls section.
- Click Run simulation to compute the trajectory, the conservation error, and the four result cards.
- Click Reset to defaults to restore the Classical textbook preset at any time.
Background: the Lotka-Volterra model
The Lotka-Volterra equations are a pair of first-order ordinary differential equations that describe the population dynamics of two interacting species, a prey and a predator. The prey grows exponentially in the absence of predation and is consumed at a rate proportional to encounters with predators. The predator grows in proportion to the prey it consumes and dies exponentially in the absence of prey.
- Prey growth (alpha) is the per-capita reproduction rate of prey in the absence of predation. Units are 1/time.
- Predation rate (beta) is the per-capita rate at which a single predator removes prey. Units are 1/(predator density times time).
- Predator efficiency (delta) is the per-capita rate at which a predator converts consumed prey into new predators. Units are 1/(prey density times time).
- Predator mortality (gamma) is the per-capita death rate of predators in the absence of prey. Units are 1/time.
The coexistence equilibrium is at x* = gamma divided by delta and y* = alpha divided by beta. Linearization gives a Jacobian with eigenvalues that are pure imaginary, which is consistent with a center. The linearization alone is suggestive but not conclusive. The rigorous proof uses the first integral V(x, y) = delta*x – gamma*ln(x) + beta*y – alpha*ln(y), which is constant along every interior trajectory. Each level set of V in the interior of the first quadrant is a closed curve, and the orbit on each closed level set is a trajectory.
How the Lotka-Volterra simulator works (technical)
The simulator integrates the two equations with Runge-Kutta 4 (RK4) and step doubling. The error estimate is the difference between a single step of size h and two half-steps of size h/2, divided by 15.
The acceptance check uses a combined absolute-plus-relative tolerance ATOL + RTOL times max of absolute state. A positivity check on the state is a supplementary safeguard, and a non-finite check on the candidate state guards against NaN and Infinity.
The interior case uses RK4 with adaptive step halving on rejection and step growth on success. A trajectory that starts at the coexistence equilibrium (x*, y*) is detected by checking the initial derivatives and returned as a single point with the conservation check skipped.
The boundary trajectories (x_0 = 0 or y_0 = 0) have analytical exponential solutions, but the UI rejects those inputs at the 0.01 minimum; the test suite exercises the boundary branch via skipValidation. The small-amplitude period T* = 2 times pi divided by sqrt(alpha times gamma) is reported alongside the integration output.
Phase plane plot and time series
The phase plane plot shows prey on the horizontal axis and predator on the vertical axis. The closed orbit appears as a loop around the coexistence equilibrium (red dot). The initial condition is a green dot. The direction field arrows show the local flow direction.
The time series plot shows both populations on the same axes against time, with prey in blue and predator in red. In the small-amplitude limit, the two curves are out of phase by approximately a quarter of a period; for larger finite-amplitude orbits, the lag deviates from the quarter-period estimate.
Worked examples
Example 1: Classical textbook (alpha=beta=delta=gamma=1)
Setup: Click the Classical textbook preset. The coexistence equilibrium is at x* = 1, y* = 1. The closed orbit passes through x0 = y0 = 1.5 (50 percent above the equilibrium) and has a period of approximately 6.48 time units. The simulator reports a maximum conservation error below 1e-4 (well within the green threshold) for the default step size dt = 0.01.
Grid: x range approximately 0.50 to 1.75, y range approximately 0.50 to 1.75. Conservation error below 5.5e-12 across 5001 steps.
Results: The phase plane shows a closed orbit symmetric in x and y. The time series shows predator peaks following prey peaks. At this finite oscillation amplitude, the lag is not exactly one quarter of a period.
Example 2: Lynx and snowshoe hare (illustrative)
Setup: Click the Lynx and snowshoe hare preset. The coexistence equilibrium is at x* approximately 16.7, y* approximately 22.2. The orbit extends from approximately x = 10.2 to x = 25.4.
This illustrative parameter set produces a period of about 16 time units, longer than the roughly 10-year snowshoe-hare cycle. Because the parameters were not fitted to the observed data, this comparison should not be interpreted as a model-prediction error. The basic model also omits carrying capacity and other important ecological drivers (Krebs, Boonstra, and Boutin 2018).
Grid: Coexistence equilibrium at (16.7, 22.2). Orbit extends from approximately x = 10.2 to x = 25.4. Detected period approximately 16.0. Conservation error below 2e-14 across 20001 steps.
Results: The orbit has a larger amplitude than the classical case. The detected period of about 16 time units is longer than the observed 10-year snowshoe-hare cycle, but the parameters are illustrative and not fitted to data, so this is not a model-prediction error. The standard Lotka-Volterra model also omits carrying capacity and other important ecological drivers (Krebs, Boonstra, and Boutin 2018).
Example 3: Vertical orbit (low prey growth)
Setup: Click the Vertical orbit preset. The prey growth rate alpha is 0.2, and the predator mortality rate gamma is 0.5. The orbit is taller than it is wide, with the predator variance larger than the prey variance. The coexistence equilibrium is at x* = 5, y* = 2.
Grid: Prey in the range approximately 4.1 to 6.0, predator in the range approximately 1.5 to 2.7. Period approximately 19.9.
Results: The closed orbit has a tall, narrow shape, with predator oscillation amplitude larger than prey amplitude.
Example 4: Horizontal orbit (low predator efficiency)
Setup: Click the Horizontal orbit preset. The predator efficiency delta is 0.05, which is much lower than the default. The orbit is wider than it is tall, with prey variance larger than predator variance. The coexistence equilibrium is at x* = 10, y* = 2.
Grid: Prey in the range approximately 8.2 to 12.0, predator in the range approximately 1.7 to 2.3. Period approximately 8.9.
Results: The closed orbit has a wide, short shape, with prey oscillation amplitude larger than predator amplitude. The predators fluctuate less because the low efficiency means they take longer to convert prey into offspring.
Example 5: Conservation demonstration (small amplitude)
Setup: Click the Conservation demonstration preset. The initial conditions are 5 percent above the coexistence equilibrium (x0 = y0 = 1.05). The orbit is small and nearly elliptical, and the period is within 1 percent of the small-amplitude formula 2 times pi divided by sqrt(alpha times gamma).
Grid: Small orbit around (1, 1). Period approximately 6.30, within 0.5 percent of 2 times pi. Conservation error below 1e-14 across 5001 steps.
Results: The conservation error is much smaller than for the larger-amplitude presets. The orbit is small and numerically less demanding, so the absolute conservation error stays well below 1e-13. The detected period is very close to the small-amplitude estimate.
Limits and caveats
- The standard Lotka-Volterra equations do not include a carrying capacity for prey. The lynx-hare preset is illustrative, not a fit to data. A logistic prey term is a candidate v2 feature.
- The simulator enforces the strict positivity of all four rate parameters and the initial conditions. The UI minimum is 0.01 for each value. Inputs at zero or negative are rejected.
- The conservation invariant check measures the absolute error of the first integral C. Values below 1e-4 indicate a well-resolved trajectory and are color-coded green. Values above 1e-2 indicate a need for a smaller step size and are color-coded red.
- The closed-orbit property is exact for the continuous system but approximate for the discrete integrator. The integration error scales as the fourth power of the step size at fixed final time.
Lotka-Volterra simulator vs related ecology tools
The Lotka-Volterra simulator focuses on the simplest two-species predator-prey model.
- Tools for more complex population dynamics (logistic prey growth, Holling Type II functional response, three-species food chains) are future v2 features.
- For Hardy-Weinberg population genetics, see the dedicated Hardy-Weinberg calculator on the biology tools directory.
- For other biology calculators covering cell culture, dose-response curves, and inheritance, see the biology tools page.
Related Resources
References
- Volterra, V. (1926). Fluctuations in the Abundance of a Species considered Mathematically. Nature, 118, 558-560. The original derivation of the predator-prey equations used in this calculator.
- Lotka, A. J. (1925). Elements of Physical Biology. Williams and Wilkins. The independent derivation of the same equations, one year before Volterra.
- National Institute of Standards and Technology. OOMMF Evolvers (Oxs_RungeKuttaEvolve) user guide, RK4 method with 1/15 step-doubling estimator. Reference for the standard 1/15 step-doubling error estimator used in this calculator.
- Krebs, C. J., Boonstra, R., and Boutin, S. (2018). Using experimentation to understand the 10-year snowshoe hare cycle in the boreal forest of North America. Journal of Animal Ecology, 87(1), 87-100. The snowshoe-hare cycle has multiple ecological drivers beyond predator-prey interactions.
- May, R. M. (1972). Will a Large Complex System be Stable? Nature, 238, 413-414. The foundational analysis of the relationship between complexity and stability in model ecosystems, including predator-prey systems.
Frequently Asked Questions
The Lotka-Volterra model is a pair of first-order ordinary differential equations that describe the population dynamics of two interacting species, a prey and a predator. The prey grows exponentially in the absence of predation and is consumed at a rate proportional to encounters with predators. The predator grows in proportion to the prey it consumes and dies exponentially in the absence of prey. The coexistence equilibrium is at x* = gamma divided by delta and y* = alpha divided by beta, and the trajectories are closed orbits around it. The model was introduced by Alfred J. Lotka in 1925 and by Vito Volterra in 1926, independently.
The coexistence equilibrium of the standard predator-prey model is a center, not a focus or a node. The first integral V(x, y) = delta*x – gamma*ln(x) + beta*y – alpha*ln(y) is constant along every interior trajectory. Each level set of V in the interior of the first quadrant is a closed curve, and the orbit on each closed level set is a trajectory. The original (x, y) form of the equations is not in canonical Hamiltonian form; the canonical form emerges after the logarithmic substitution u = ln(x), v = ln(y), with the Hamiltonian H(u, v) = delta*e^u – gamma*u + beta*e^v – alpha*v under the standard symplectic matrix.
The expression T* = 2*pi / sqrt(alpha*gamma) is the period of the small oscillations around the coexistence equilibrium. It is the limit of the integrated period as the perturbation amplitude shrinks to zero. For larger perturbations, the actual period is longer than T* by an amount that scales as the square of the perturbation amplitude. When the simulation contains at least three prey peaks, the simulator also reports the mean peak-to-peak interval as a detected period estimate for comparison.
The conservation invariant C is the Volterra first integral expressed in a shifted form. The unshifted form is V(x, y) = delta*x – gamma*ln(x) + beta*y – alpha*ln(y). The shifted form C(x, y) = delta*[x – x* – x*ln(x/x*)] + beta*[y – y* – y*ln(y/y*)] is zero at the coexistence equilibrium and constant along any interior trajectory. C is the standard way to test the integration accuracy. The on-screen readout is green below 1e-4 and red at or above 1e-2.
No. The lynx-hare preset uses an illustrative parameter set that was not fitted to the observed data, so the longer period produced by the simulator should not be interpreted as a model-prediction error. The standard Lotka-Volterra equations also omit carrying capacity, food supply, social stress, and other ecological drivers that shape the real snowshoe-hare cycle (Krebs, Boonstra, and Boutin 2018). A logistic prey term is a candidate v2 feature, not a present capability.
The simulator uses Runge-Kutta 4 (RK4) with step doubling (see the NIST OOMMF Evolvers user guide for the standard 1/15 step-doubling estimator). The error estimate is the difference between a single step of size h and two half-steps of size h/2, divided by 15. The acceptance check uses a combined absolute-plus-relative tolerance. A positivity check on the state is a supplementary safeguard, and a non-finite check on the candidate state guards against NaN and Infinity. Step rejection halves the step size until the error is below tolerance, with a maximum of 10 consecutive rejections before the integration aborts.
The continuous system cannot reach negative populations, by the exponential integral representation. For any t greater than 0, x(t) = x_0 * exp(integral of (alpha minus beta*y(s)) ds) is always positive, and similarly for y. The exponential function is always positive. The integrator’s positivity check is a numerical safeguard for the discrete approximation, not a property of the continuous mathematics.
The Predator-Prey Lotka-Volterra Interactive Simulator is a free tool for population ecology students, teachers, and curious individuals. The simulator solves the classic two-species predator-prey equations with RK4 step doubling and visualizes the closed orbits, the conservation invariant, and the period of oscillation in real time. Five locked presets cover the classical, lynx-hare illustrative, vertical orbit, horizontal orbit, and small-amplitude conservation cases. The tool runs entirely in the browser, requires no signup, and ships under the BioExplorer educational resource license.
The mathematical core is the standard two-dimensional Lotka-Volterra system with four strictly positive rate parameters, no carrying capacity, and no functional response. The integration uses RK4 with step doubling for primary error control and a positivity check as a supplementary safeguard. The coexistence equilibrium is a center, proved by the existence of the first integral V. v2 candidates include a logistic prey term, a Holling Type II functional response, and a three-species food chain.
Cite this page
BioExplorer. (2026, July 19). Predator-Prey Lotka-Volterra Interactive Simulator. https://www.bioexplorer.net/lotka-volterra-simulator/
