ForHosting KIT · Science

Lotka-Volterra equations

Start with 10 prey and 5 predators, set the four rates and get the population at every step: with rates of 1.1, 0.4, 0.1 and 0.4 the coexistence equilibrium sits at 4 prey and 2.75 predators. Free in your browser.

  • Free
  • Runs in your browser
  • No sign-up
  • Your data stays on your device
Use it from WebAPIEmailTelegramApp soon
If you enter
Prey
10
Predators
5
Prey growth
1.1
Predation rate
0.4
Predator growth
0.1
Predator death
0.4
You get
Dt
0.1
Final prey
2.8810967151
Final predators
6.0674292649
Peak prey
10

The Lotka–Volterra equations are the classic pair of ordinary differential equations that describe how a prey population and a predator population change together over time. Prey grow in the absence of predators and decline in proportion to encounters; predators starve without prey and grow from those same encounters. Students, ecologists, fisheries analysts, and modelers need a deterministic population time series from initial counts and the four rate coefficients, not a screenshot of a plot that cannot be replayed. This Lotka–Volterra calculator integrates dx/dt = αx − βxy and dy/dt = δxy − γy with a fixed-step fourth-order Runge–Kutta method and returns the trajectory, peaks, troughs, and the interior equilibrium when it exists.

What the Lotka–Volterra equations say about predator and prey

Alfred Lotka and Vito Volterra independently wrote the same two-species model in the 1920s: a prey stock x that would grow exponentially on its own, and a predator stock y that would decline exponentially without food. Encounters are written as the product x times y. Prey therefore follow dx/dt equals αx minus βxy, where α is the intrinsic prey growth rate and β is the predation rate coefficient.

Predators follow dy/dt equals δxy minus γy, where δ is the conversion of eaten prey into predator growth and γ is the predator death or starvation rate. Those four coefficients plus the two initial populations fully determine the vector field in the first quadrant.

When α, β, γ, and δ are all positive, the system has an interior equilibrium at x-star equals γ over δ and y-star equals α over β; orbits around that point are closed in the exact continuous model, which is why textbook plots show the famous out-of-phase cycles: prey rise, predators follow, prey crash, predators crash, and the loop repeats. The model is not a full ecosystem: it ignores carrying capacity, age structure, refuge, and stochastic extinction. It is the first-order teaching and planning tool for coupled growth and predation.

Units stay yours: if x and y are animals per square kilometre and time is in years, the rates are in reciprocal years and the returned series uses the same units. Zero populations and zero rates are allowed and produce degenerate but well-defined paths, such as exponential prey growth when predators start at zero. Negative counts or rates are not biological in this contract and are rejected rather than silently clamped at the input boundary.

Who uses predator–prey simulations

Secondary-school and university ecology courses repeatedly ask students to sketch Lotka–Volterra cycles from a table of x(t) and y(t). A deterministic RK4 oracle lets a learner check that prey peak before predators, that the discrete orbit stays near the predicted equilibrium, and that a negative rate is illegal instead of a silent NaN in a spreadsheet. Fisheries and wildlife planners sometimes need a first-order coupled forecast: given current counts and assumed growth and predation rates, how do the two stocks move over a planning horizon of T time units?

The bounded step count keeps the isolate cheap while still resolving a few cycles. Sensitivity work is a few extra calls: hold initials fixed and vary α or β to see whether the predator peak grows or collapses.

Keep all eight parameters non-negative and finite, choose steps large enough to resolve the orbit you care about (ten to forty is typical for a homework plot; two hundred is the hard cap), and treat the series as a numerical trajectory of the classic equations—not as a fitted field census, a stochastic extinction model, or a logistic prey-only growth curve.

Ecology homework and cycle plots

From initial prey and predator counts plus the four Lotka–Volterra rates, obtain a time series students can plot to see the classic out-of-phase cycles.

Exam and LMS auto-grading

Mark predator–prey items with a deterministic RK4 oracle that rejects negative or non-finite parameters instead of returning a silent empty path.

First-order wildlife and fisheries sketches

Project coupled stocks over a planning horizon T from current census and assumed growth and predation rates, without standing up a full ODE toolbox.

What happens if a parameter is negative or not finite?

Populations, rates, duration, and steps must all be finite and not negative; non-finite values and missing fields fail the same way and are not billed.

Which integrator does the calculator use?

Fixed-step classical fourth-order Runge–Kutta (method rk4) with dt = duration/steps. After each step, a numerical overshoot below zero is clamped to zero.

What do the four Lotka–Volterra rates mean?

Alpha is how fast prey grow on their own, beta how strongly encounters remove prey, delta how efficiently eaten prey become new predators, and gamma how fast predators die without food.

Where is the coexistence equilibrium?

When all four rates are positive, prey sit at gamma divided by delta and predators at alpha divided by beta. In the sample, rates of 1.1, 0.4, 0.1 and 0.4 give 4 prey and 2.75 predators.

Why do predator and prey populations cycle?

Prey increase, predators follow with more food, prey then crash under heavier predation and predators crash in turn. In the exact model these orbits close around the equilibrium, giving the familiar out-of-phase cycles.

Everything on this page is available programmatically. This section is for teams who want to wire it into their own systems; everyone else can just use the tool above.

POSThttps://api.kit.forhosting.com/eco/lotka-volterra-equations

Prefer to automate it? One authenticated POST creates the task; the result comes back by webhook or a signed link. The same capability also runs here on the web, by email and from Telegram — and soon from our app too.

curl -X POST https://api.kit.forhosting.com/eco/lotka-volterra-equations \
  -H "Authorization: Bearer $KIT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"prey":10,"predators":5,"prey_growth":1.1,"predation_rate":0.4,"predator_growth":0.1,"predator_death":0.4,"duration":1,"steps":10}'
{
  "prey": 10,
  "predators": 5,
  "prey_growth": 1.1,
  "predation_rate": 0.4,
  "predator_growth": 0.1,
  "predator_death": 0.4,
  "duration": 1,
  "steps": 10
}
{
  "task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
  "type": "eco.lotka_volterra_equations",
  "status": "queued",
  "_links": {
    "result": "/tasks/tsk_…/result"
  }
}

The API is asynchronous: the call returns a task_id immediately and the result arrives by webhook. Polling is capped at 1 req/s per task.

Per request$0.002

Published price — no tokens, no invented credits. A failed task is never charged.

max_steps200
max_abs1000000000
HTTPCodeMeaning
401unauthorizedMissing or invalid API key.
402insufficient_balanceYour balance doesn't cover the task price.
404unknown_typeThat task type doesn't exist.
429rate_limitedToo many requests. Use the webhook instead of polling.

Any negative or non-finite parameter fails with invalid_input instead of inventing a census. The free browser path uses the same pure module as the API, so homework checks and automation never disagree on a step of the orbit.

Input contract, RK4 time series, and error behaviour

The integrator starts at t equals zero with the given census, then takes steps of size dt equals T divided by steps. Each step is classical RK4 on the two-dimensional vector field. After every step, a tiny numerical overshoot below zero is clamped to zero so a census cannot go negative. Failed validation is not billed. POST a JSON body with eight required fields, each a finite non-negative number: prey (initial x0), predators (initial y0), prey_growth (α), predation_rate (β), predator_growth (δ), predator_death (γ), duration (total time T), and steps (the integer number of fixed RK4 steps, at most two hundred). Short aliases work the same way: x0, y0, alpha, beta, delta, gamma, t_end, n_steps, and the other names listed in the parameter schema. Each field may arrive as a JSON number or as a numeric string; empty strings, missing keys, NaN, infinities, and any negative value fail with invalid_input naming the field. steps must be a whole number; a fractional step count is rejected because the series length is part of the contract. If a step overflows IEEE-754, the task fails instead of returning infinities. On success the body echoes the eight inputs, dt, method rk4, and the formula string dx/dt = αx − βxy ; dy/dt = δxy − γy. series is an array of steps-plus-one samples {t, prey, predators} including the initial point. final_prey and final_predators are the last sample; peak and trough fields are the extrema along the discrete path. When δ is positive the body also includes equilibrium_prey = γ/δ; when β is positive it includes equilibrium_predators = α/β. Those equilibrium keys are omitted, never null, if the matching rate is zero. Successful calls use prepaid KIT balance at the published $0.002 base price per item. Goldens pin the twelve-decimal rounding so Worker and browser JSON stay byte-stable.

Where a predator–prey time series API earns its keep

Pair the JSON with your own charting code if you need a phase portrait; this endpoint returns numbers, not images.

How do I simulate Lotka–Volterra predator–prey populations?

Send finite non-negative prey, predators, prey_growth (α), predation_rate (β), predator_growth (δ), predator_death (γ), duration T, and integer steps. The API returns an RK4 series of steps+1 samples {t, prey, predators}.

What is the coexistence equilibrium of the Lotka–Volterra equations?

When the rates are positive, prey equilibrate at γ/δ (predator_death / predator_growth) and predators at α/β (prey_growth / predation_rate). Those keys are omitted if the matching divisor is zero.

What does the Lotka–Volterra equations calculator cost?

The browser tool is free. API requests use prepaid KIT balance at $0.002 per successful call; invalid input is not billed.

Read the full KIT documentation →