Calculator overview
Inputs and outputs
This summary comes from the calculator's published input and output contract.
Inputs
- Predator death rate (required)
-
Unit per year Default 1.5 Range 0.1 to 3
About this input
gamma, in 1 per year, from 0.1 to 3: how fast the predators die out when there is no prey.
- Predation rate (required)
-
Unit per thousand predators per year Default 0.1 Range 0.001 to 1
About this input
beta, per thousand predators per year, from 0.001 to 1: the share of the prey eaten each year for every thousand predators.
- Which peaks first? (challenge 1) (required)
-
Default Not yet predicted Allowed Not yet predicted, Prey first, Predators first
About this input
Your prediction in challenge 1: Prey first or Predators first. The population curves appear once you predict. It changes nothing outside challenge 1.
- Predator gain rate (required)
-
Unit per thousand prey per year Default 0.075 Range 0.001 to 1
About this input
delta, per thousand prey per year, from 0.001 to 1: how fast the predators multiply for every thousand prey.
- Prey harvest rate (required)
-
Unit per year Default 0 Range 0 to 2
About this input
The share of the prey removed each year, from 0 to 2 per year. Used only with Harvesting; the value must still be in range.
- Prey growth rate (required)
-
Unit per year Default 1 Range 0.1 to 3
About this input
alpha, in 1 per year, from 0.1 to 3: how fast the prey multiply when there are no predators.
- Predator harvest rate (required)
-
Unit per year Default 0 Range 0 to 2
About this input
The share of the predators removed each year, from 0 to 2 per year. Used only with Harvesting; the value must still be in range.
- Model (required)
-
Default Classic Allowed Classic, Logistic prey, Harvesting
About this input
The model solved. Classic: prey grow, predators eat them and die without food, so the populations cycle for ever. Logistic prey: the land supports at most the carrying capacity of prey, so the cycles shrink. Harvesting: a share of each species is removed every year.
- Simulated time (required)
-
Unit years Default 30 Range 5 to 200
About this input
The simulated time in years, from 5 to 200. Every run takes 200 steps, so the time step is this divided by 200.
- Challenge number (required)
-
Default 0 Range 0 to 5
About this input
0 for none; 1 to 5 load a challenge's model and score your answer.
- Carrying capacity (required)
-
Unit thousand Default 100 Range 1 to 1000
About this input
K, in thousands of prey, from 1 to 1000: the most prey the land supports. Used only with Logistic prey; the value must still be in range.
- Run A starting predators (required)
-
Unit thousand Default 5 Range 0.1 to 100
About this input
Where run A starts: its predators, in thousands, from 0.1 to 100.
- Run B starting prey (required)
-
Unit thousand Default 30 Range 0.1 to 100
About this input
Where run B starts: its prey, in thousands, from 0.1 to 100. Run B shares every rate with run A, for comparison.
- Run A starting prey (required)
-
Unit thousand Default 10 Range 0.1 to 100
About this input
Where run A starts: its prey, in thousands, from 0.1 to 100.
- Run B starting predators (required)
-
Unit thousand Default 5 Range 0.1 to 100
About this input
Where run B starts: its predators, in thousands, from 0.1 to 100.
Outputs
- Predation rate solved
-
No unit declared
About this output
The predation rate solved.
- Population frames: 201 rows (t = 0 to the duration) of runs A and B, run A's icons and the Euler comparison
-
No unit declared
About this output
One row per step, t = 0 to the duration in 200 steps: the prey and predators of runs A and B (thousands), run A's rabbit and fox icon counts, V - V* along run A, and the Euler run's prey, predators and V - V*. A blank cell is a row a run did not reach.
- Plot bound, prey (thousand)
-
No unit declared
About this output
The prey bound of the phase plane, in thousands: 1.1 times the largest prey count of runs A and B or the equilibrium.
- Predator harvest rate solved (per year)
-
No unit declared
About this output
The predator harvest rate solved, per year; 0 unless the model is Harvesting.
- Predator gain rate solved
-
No unit declared
About this output
The predator gain rate solved.
- Predator death rate solved (per year)
-
No unit declared
About this output
The predator death rate solved, per year.
- Period from the linearised model (years)
-
No unit declared
About this output
The period of small cycles from the linearised model, in years: 2 pi / sqrt(alpha gamma) in the classic model. Blank without a coexistence point or for a stable node.
- Nullclines: where each population stops changing (line segments)
-
No unit declared
About this output
Two line segments: where the prey stop changing (the prey nullcline) and where the predators stop changing (the predator nullcline). They cross at the equilibrium.
- Formula module versions
-
No unit declared
About this output
The formula modules this workbook embeds and their versions.
- Plot bound, predators (thousand)
-
No unit declared
About this output
The predator bound of the phase plane, in thousands.
- Predator peak after the prey peak (years)
-
No unit declared
About this output
How long after the prey's first peak the predators peak, in years: the first predator peak after it.
- Measured period (years)
-
No unit declared
About this output
The mean time, in years, between run A's upward crossings of the equilibrium prey level, linearly interpolated between rows. Blank with fewer than two crossings.
- Largest predator count, run A (thousand)
-
No unit declared
About this output
The largest predator count of run A, in thousands.
- Prey per icon (thousand)
-
No unit declared
About this output
How many thousand prey one rabbit icon stands for (1, 2 or 5 times a power of ten), so run A's peak shows at most 40 icons.
- Time of the first prey peak (years)
-
No unit declared
About this output
When run A's first prey peak happens, in years.
- First prey peak (thousand)
-
No unit declared
About this output
Run A's first prey peak, in thousands, from a parabola through the three rows around it. Blank when the prey never peak.
- Time step (years)
-
No unit declared
About this output
The time step of every run, in years: the duration divided by 200.
- Step ratio (step x largest rate)
-
No unit declared
About this output
The time step times the largest rate any computed row of run A or B reaches (a bound from the Jacobian). Above 1.5 the status warns of a coarse step.
- Estimated RK4 error at the end (thousand)
-
No unit declared
About this output
An estimate of RK4's error at the end of run A, in thousands: the difference from a run at twice the step, divided by 15.
- Predators per icon (thousand)
-
No unit declared
About this output
How many thousand predators one fox icon stands for.
- Time of the first predator peak (years)
-
No unit declared
About this output
When run A's first predator peak happens, in years.
- First predator peak (thousand)
-
No unit declared
About this output
Run A's first predator peak, in thousands, from a parabola through three rows.
- Largest prey count, run A (thousand)
-
No unit declared
About this output
The largest prey count of run A, in thousands.
- Prey harvest rate solved (per year)
-
No unit declared
About this output
The prey harvest rate solved, per year; 0 unless the model is Harvesting.
- Prey growth rate solved (per year)
-
No unit declared
About this output
The prey growth rate solved, per year.
- Simulated time solved (years)
-
No unit declared
About this output
The simulated time solved, in years.
- Full cycles measured
-
No unit declared
About this output
The number of full cycles of run A the measured period averages (crossings minus one; 0 with fewer than two).
- Drift of the conserved quantity, RK4 (%)
-
No unit declared
About this output
In the classic and harvesting models the quantity V is constant along exact solutions; this is how much RK4 changed V - V* (the cycle's size) over the run, in percent. Blank for logistic prey or an extinction.
- Equilibrium type
-
No unit declared
About this output
What happens near the equilibrium: cycles keep their size (classic and harvesting), shrink in a spiral or settle without cycling (logistic prey), or there is no coexistence point.
- Equilibrium prey (thousand)
-
No unit declared
About this output
The prey count, in thousands, at which both populations would stay constant: (gamma + predator harvest) / delta. Blank when there is no coexistence point.
- Equilibrium predators (thousand)
-
No unit declared
About this output
The predator count, in thousands, at the coexistence equilibrium. Blank when there is no coexistence point.
- Challenge goal
-
No unit declared
About this output
What the selected challenge asks.
- Challenge feedback
-
No unit declared
About this output
A hint while the challenge is not met, or why it is met; in challenge 1, a prompt until you predict.
- Carrying capacity solved (thousand)
-
No unit declared
About this output
The carrying capacity solved, in thousands; blank unless the model is Logistic prey.
- Challenge result
-
No unit declared
About this output
No challenge selected, MET or NOT MET.
- Challenge score
-
No unit declared
About this output
100 when the selected challenge is met, else 0.
- Challenge: the value scored
-
No unit declared
About this output
The value the selected challenge scores: the peak-time difference, a swing in percent, or the drift in percent.
- Drift of the conserved quantity, Euler (%)
-
No unit declared
About this output
The same drift for an explicit Euler run at the same step: the Euler loop opens outward, so this is far larger.
- Largest swing from the equilibrium (%)
-
No unit declared
About this output
How far run A swings from the equilibrium over the whole run: the largest of the two relative distances, in percent.
- Run B starting prey solved (thousand)
-
No unit declared
About this output
Run B's starting prey solved, in thousands.
- Run A starting prey solved (thousand)
-
No unit declared
About this output
Run A's starting prey solved, in thousands.
- Model version
-
No unit declared
About this output
The workbook model version.
- Model solved
-
No unit declared
About this output
The model actually solved: the challenge's while a challenge is selected.
- Model Status
-
No unit declared
About this output
OK, CHECK (computed but worth a look: a run stopped early, no coexistence point, an extinction, a coarse step, or run A starting at the equilibrium) or NOT VALID (an input out of range; the results are empty).
- Extinct at the end of run A
-
No unit declared
About this output
Which species of run A are extinct at the end: None, Prey, Predators or Prey and predators.
- Time of the first extinction, run A (years)
-
No unit declared
About this output
When a species of run A first fell below 0.000001 thousand and went extinct, in years. Blank when none did.
- Time of the first extinction, Euler run (years)
-
No unit declared
About this output
When the Euler run's loop opened so far that a species went extinct, in years. Blank when it did not.
- Run B starting predators solved (thousand)
-
No unit declared
About this output
Run B's starting predators solved, in thousands.
- Run A starting predators solved (thousand)
-
No unit declared
About this output
Run A's starting predators solved, in thousands.
- Swing from the equilibrium over the last fifth (%)
-
No unit declared
About this output
The same swing over the last fifth of the run (rows 160 to 200): small when the cycles have died away.
LogicCommons is in beta. If a result, label, or reference looks wrong, tell us here; we read every message.
Methodology
Purpose and model boundary
This lab follows a prey population (rabbits) and a predator population (foxes) through the Lotka-Volterra model, in three versions: the classic model, prey limited by a carrying capacity (logistic prey), and harvesting, which removes a fixed share of each species every year. Two runs, A and B, share every rate and start from different points, so you can compare their loops in the phase plane. Each run takes 200 steps of the classical fourth-order Runge-Kutta method (RK4). For the model you set, the model returns the coexistence equilibrium with its type and linearised period, run A's first peaks, the phase lag, the measured period, how far run A swings from the equilibrium and whether a species dies out. Beside run A it runs an explicit Euler comparison at the same step and an RK4 run at twice the step, which together show how honest each method is. Five scored challenges turn the lab into exercises.
It is a lab for learning population dynamics and numerical integration, not a forecast for any real ecosystem. The populations are continuous quantities in thousands of animals: there are no individual animals, no randomness, no age structure, no seasons, no migration, no disease, no other species and no space. A smooth cycle on the screen is the behaviour of an idealised model, not a prediction.
The model is the calculation authority. The page sends the values you set to the model and draws only what the model returns: every population curve, phase-plane loop, nullcline and icon count comes from the model's results; the page computes no population value itself.
Inputs and units
| Input | Meaning and unit |
|---|---|
| Model | Classic, Logistic prey or Harvesting. Classic: prey grow, predators eat them and die without food, so the populations cycle for ever. Logistic prey: the land supports at most the carrying capacity of prey, so the cycles shrink. Harvesting: a share of each species is removed every year. |
| Prey growth rate | α, from 0.1 to 3 per year: how fast the prey multiply when there are no predators. |
| Predation rate | β, from 0.001 to 1 per thousand predators per year: the share of the prey eaten each year for every thousand predators. |
| Predator death rate | γ, from 0.1 to 3 per year: how fast the predators die out when there is no prey. |
| Predator gain rate | δ, from 0.001 to 1 per thousand prey per year: how fast the predators multiply for every thousand prey. |
| Carrying capacity | K, from 1 to 1,000 thousand prey: the most prey the land supports. Used only with Logistic prey, but the value must still be in range. |
| Prey harvest rate | h_x, from 0 to 2 per year: the share of the prey removed each year. Used only with Harvesting, but the value must still be in range. |
| Predator harvest rate | h_y, from 0 to 2 per year: the share of the predators removed each year. Used only with Harvesting, but the value must still be in range. |
| Run A start: prey, predators | Where run A starts, each from 0.1 to 100 thousand. |
| Run B start: prey, predators | Where run B starts, each from 0.1 to 100 thousand. Run B shares every rate with run A. |
| Duration | The simulated time, from 5 to 200 years. Every run takes 200 steps, so the time step is the duration divided by 200, and a longer run is also a coarser one. |
| Challenge number | 0 for free play; 1 to 5 loads one of the five challenges. |
| Peak prediction | Not yet predicted, Prey first or Predators first: your answer in challenge 1. It changes nothing outside challenge 1. |
Sign conventions: populations are never negative. In the phase plane the prey count is along the horizontal axis and the predator count up the vertical axis. Time starts at 0 at each run's starting point.
Every input is set in the input panel. The page always sends all 15 inputs, including those the chosen model does not use, at their current values.
Governing relationships
The model. At prey P and predators Q (both in thousands), one formula covers all three models:
- dP/dt = α·P·(1 − L·P/K) − β·P·Q − h_x·P
- dQ/dt = δ·P·Q − γ·Q − h_y·Q
L is 1 with Logistic prey and 0 otherwise, so with Classic or Harvesting the logistic factor is exactly 1. The harvest rates in effect are h_x and h_y with Harvesting and exactly 0 otherwise. With all of these at their neutral values the formula is the classic dP/dt = αP − βPQ and dQ/dt = δPQ − γQ. A species at 0 stays at 0, because its rate of change is then 0. Two net rates appear below: a = α − h_x (net prey growth) and c = γ + h_y (net predator loss).
One RK4 step. The step is h = duration / 200, and row n is at time tₙ = n·h (a product, never a running sum). From row n (x, y) the model evaluates the rates four times: (K1) at the start; (K2) half a step ahead along K1; (K3) half a step ahead along K2; and (K4) a full step ahead along K3. The new values are
- x′ = x + h/6 · (K1x + 2·K2x + 2·K3x + K4x), and the same for y.
The extinction floor. A new value below 0.000001 thousand, negative values included, is set to exactly 0: that species is extinct and stays at 0. A negative value can only come from a coarse step overshooting zero.
The stop rule. If a new value is larger than 1,000,000 thousand in size, the run stops: that row and every later row of that run are left blank. Run A starts from its starting point, and run B from its own.
The equilibrium. The coexistence point, where both populations stay constant, is
- x* = c / δ
- y* = (α·(1 − L·x*/K) − h_x) / β
The two species can coexist only when y* > 0 (strictly). The classic model always can. Logistic prey needs x* < K, and Harvesting needs h_x < α. At exact equality y* = 0 and there is no coexistence point.
Close to the equilibrium the model behaves like a linear one. Its trace is tr = −α·x*/K with Logistic prey and 0 otherwise, its determinant is det = β·δ·x*·y*, and w² = det − tr²/4. The equilibrium type is:
- No coexistence point when y* is not above 0;
- Centre: cycles keep their size for Classic and Harvesting;
- Stable spiral: cycles shrink toward the equilibrium for Logistic prey with w² > 0;
- Stable node: populations settle without cycling for Logistic prey otherwise.
The linearised period, the period of very small cycles, is 2π/√w² when there is coexistence and w² > 0. In the classic model this is 2π/√(αγ); with harvesting it is 2π/√((α − h_x)(γ + h_y)).
The step ratio. At each computed row of runs A and B the model bounds how fast the populations can change, with the Gershgorin bound on the Jacobian of the model at that row:
- J11 = α·(1 − 2·L·x/K) − β·y − h_x
- rₙ = h · max(|J11| + |β·x|, |δ·y| + |δ·x − c|)
The step ratio is the largest rₙ over both runs. It is a bound, not an exact stability limit; the status warns above 1.5.
The Euler comparison (run A only). From run A's start, each step is x′ = x + h·dP/dt and y′ = y + h·dQ/dt, at the same step h, with the same floor and stop rule, for 200 steps.
The error estimate (run A only). A second RK4 run from run A's start takes 100 steps of 2h, so it also ends at the duration. RK4's error falls with the fourth power of the step, so the error of run A at its end is estimated as the larger difference between the two runs' final prey and predators, divided by 15 (a Richardson estimate). It is blank when either run stopped early.
The conserved quantity (Classic and Harvesting only). Along exact solutions the quantity
- V(x, y) = δ·x − c·ln x + β·y − a·ln y
does not change. At the equilibrium it takes its smallest value V*. E = V − V* is therefore 0 at the equilibrium and positive on every cycle around it, and it measures the cycle's size. The model computes E at every row of run A and of the Euler run where both populations are above 0; a difference of about 1×10⁻¹² of the terms or less reads exactly 0. E is not defined with Logistic prey, without a coexistence point, or once a species is extinct.
- The RK4 drift is 100 × (E at the end − E at the start) / E at the start, in percent.
- The Euler drift is the same for the Euler run.
- A drift is blank when E is not defined at the start or the end, when the start's E is below 1×10⁻⁶ (run A starts too close to the equilibrium), or when the run stopped early.
An exact solution has a drift of 0, so what the drift shows is the error of the step-by-step method.
First peaks. A species' peaks are looked for only when its range over run A is at least 1×10⁻⁶ of its largest value, so rounding noise in a constant run is not read as a peak. The first peak is at the first row n (from 1 to 199) whose value is above the row before and at least the row after. The parabola through the three rows n − 1, n and n + 1 then gives the peak time and the peak value:
- d1 = vₙ₋₁ − vₙ₊₁ and d2 = vₙ₋₁ − 2·vₙ + vₙ₊₁
- peak time = tₙ + h · d1 / (2·d2), within half a step of row n
- peak value = vₙ − d1² / (8·d2), at least vₙ
These are the first peaks, not the largest. The phase lag is the time of the first predator peak at a row after the prey's peak row, minus the prey's peak time.
The measured period. With a coexistence point, a row is an upward crossing when the prey count of run A rises from below x* to x* or above, and the rise across it is at least 1×10⁻⁷ of x*. Its time is found by a straight line between the two rows:
- t_c = tₙ₋₁ + h · (x* − xₙ₋₁) / (xₙ − xₙ₋₁)
With at least two crossings, the measured period is (last t_c − first t_c) / (number of crossings − 1): the mean period over every full cycle observed. The number of cycles measured is the number of crossings minus one, and 0 with fewer than two.
Deviations and extinction. For run A:
- the largest deviation is 100 × the largest of |x − x*|/x* and |y − y*|/y* over every computed row;
- the final deviation is the same over rows 160 to 200 only (the last fifth of the run);
- the extinction time is the time of the first row after the start where a population is 0;
- the extinct species are read from the last computed row: None, Prey, Predators or Prey and predators.
The Euler extinction time follows the same rule on the Euler run.
Plot bounds, icons and nullclines. The phase-plane bounds are 1.1 times the largest prey and predator counts of runs A and B, or the equilibrium if that is larger. The Euler run is not in the bounds; the page clips it to the plot area. One icon stands for the smallest of 0.01, 0.02, 0.05, 0.1 … 50,000 thousand (1, 2 or 5 times a power of ten) that keeps run A's largest count at 40 icons or fewer. The icon count at each row is the population divided by that amount, rounded to a whole number with halves rounded up.
The nullclines are where one population stops changing. The prey nullcline is the line y = (α·(1 − L·x/K) − h_x)/β, drawn from x = 0 to the plot bound (or to K, if smaller, with Logistic prey); it is blank when h_x is at or above α, because it then lies below the axis. The predator nullcline is the vertical line x = x*. They cross at the equilibrium.
Calculation sequence
The model works through the relationships above in this order:
- It checks the entered inputs, items 1 to 8 of the status list under Errors and warnings.
- It fixes the values solved: your inputs, or in a challenge the challenge's own values.
- It finds the equilibrium, whether the species can coexist, the equilibrium type and the linearised period.
- It takes the 200 RK4 steps of run A and of run B, with the floor and the stop rule at each step.
- It takes the 200 Euler steps and the 100 double-length RK4 steps from run A's start, and computes the error estimate.
- It computes the step ratio, the conserved quantity and its drifts, the first peaks, the phase lag, the measured period, the deviations and the extinction results.
- It computes the plot bounds, the icon amounts and counts, and the nullclines.
- It sets the status and, in a challenge, scores the challenge.
Outputs and interpretation
- Status: OK, CHECK or NOT VALID, with the reason (see Validation and status logic and Errors and warnings).
- Equilibrium: the prey and predator counts at the coexistence point (thousand, blank when there is none), its type, and the linearised period (years; blank without coexistence or for a stable node).
- Cycle: the measured period (years) and the number of cycles it averages.
- Peaks: run A's first prey and predator peaks (thousand) and their times (years), and the phase lag (years).
- Run A: the largest prey and predator counts (thousand), the largest and the final deviation from the equilibrium (%), the extinction time (years) and the extinct species.
- Numerical honesty: the RK4 drift and the Euler drift of the conserved quantity (%), the Euler extinction time (years), the RK4 error estimate (thousand, in scientific notation because it is small), the step ratio and the time step (years).
- Display scales: the phase-plane bounds (thousand) and how many thousand prey and predators one icon stands for.
- Values solved: the model, the four rates, the carrying capacity (only with Logistic prey), the two harvest rates (0 unless Harvesting), the four starting values and the duration actually solved. In a challenge these are the challenge's values.
- Grids:
- Population frames: 201 rows, from time 0 through the 200 steps. Each row gives the time (years), the prey and predators of runs A and B (thousand), run A's rabbit and fox icon counts, E along run A, and the Euler run's prey, predators and E. A blank cell is a row its run did not reach, or a row where E is not defined. The double-length run is not shown; only its error estimate is.
- Nullclines: the two line segments, each from a start point to an end point.
Reading the results:
- At the default the equilibrium is 20 thousand prey and 10 thousand predators, and the linearised period is 5.130 years. Run A's larger cycle has a measured period of 5.480 years: large cycles of this model are slower than small ones.
- The RK4 drift is close to 0 at small steps. It grows quickly with the step: at a duration of 100 years (a step of 0.5 year) the default's drift is about −8.7%.
- The Euler drift can be thousands of percent, because each Euler step pushes the loop outward. At the default step the Euler loop opens until a species dies out at about 22 years; that is the lesson of the comparison, not a fault. Its drift is then blank, and the Euler extinction time says when.
- The peak values come from a parabola through three rows. On large cycles they are good to about 0.2%; the peak times are more accurate.
- With harvesting of both species the prey equilibrium rises and the predator equilibrium falls (Volterra's principle). Harvesting the prey alone leaves the prey equilibrium unchanged and lowers only the predators'.
Challenges
Choose a challenge number from 1 to 5. Every challenge uses α = 1, β = 0.1, γ = 1.5 and δ = 0.075, and fixes the model, the starting points and the duration, apart from the inputs it leaves to you. The status checks still apply inside a challenge. The challenge result reads MET or NOT MET, the score is 100 when met and 0 otherwise, and a goal and a feedback line say what is asked and what to try next.
- Which peaks first? Predict whether the prey or the predators reach their first peak first. Until you predict, the population curves after the start, the cycle, peak, deviation, extinction and drift results are withheld; the equilibrium and the start dots still show. The challenge measures the predator peak time minus the prey peak time.
- A small cycle. Choose run A's start so both populations stay within 20% of the equilibrium for the whole 30-year run.
- Harvest to calm the cycle. With harvesting, choose the two harvest rates so both populations stay within 10% of their starting values, 30 thousand prey and 6 thousand predators.
- Damp the cycles. With logistic prey, choose the carrying capacity so that over the last fifth of the run both populations stay within 5% of the equilibrium.
- Long run, small drift. Choose a duration of at least 40 years for which the RK4 drift of the conserved quantity is 0.1% or less. The challenge's start, 100 years, also reads the coarse-step CHECK.
Challenges 2 to 4 also require a coexistence point, and that run A reaches the end of the run with no extinction.
Validation and status logic
The status reads the first message in the list under Errors and warnings that applies. Items 1 to 8 check
the values you entered, including those the chosen model does not use. Items 9 to 15 check the values solved,
which are a challenge's own when one is selected. OK means both runs reached the end, the species can
coexist, no species of either run died out, the step is not coarse and run A does not start at the
equilibrium. A CHECK still returns every result; it marks one that deserves a second look.
Assumptions and limitations
- Continuous populations in thousands of animals, in a well-mixed habitat, with constant rates. No individuals, randomness, age structure, seasons, migration, other species, disease or space.
- One model at a time: classic, logistic prey with a constant carrying capacity, or harvesting at constant shares per year.
- Every run takes exactly 200 RK4 steps, so the step is always the duration divided by 200. RK4 slowly changes a cycle's size; the drift shows how much. The step ratio is a bound, not an exact stability limit.
- A population below 0.000001 thousand is extinct and stays 0. A run whose population passes 1,000,000 thousand stops, and its later rows are blank.
- The peaks are the first ones, from a parabola through three rows. The measured period needs two upward crossings of the prey equilibrium and uses a straight line between rows.
- The error estimate assumes RK4's fourth-order behaviour; at coarse steps it is only indicative.
- A value within about 1×10⁻⁹ (relative) of a threshold may fall either side of it. This applies to the extinction floor, the population limit, the coarse-step limit, the crossing and peak gates, the snap of E to 0, the equilibrium-start test, an icon count at an exact half, the icon amount and a challenge band.
Restrictions and non-computing states
Every input is required; a blank, non-numeric or out-of-range value reads NOT VALID.
Under NOT VALID every result and every grid cell is blank. The version texts still show, the challenge result reads No challenge selected (or NOT MET when a challenge is selected, with its goal and hint), and the score reads 0.
Errors and warnings
The status messages, in the order they are checked:
NOT VALID: choose a model from the listNOT VALID: the prey growth rate and the predator death rate must be from 0.1 to 3 per yearNOT VALID: the predation rate and the predator gain rate must be from 0.001 to 1 per thousand per yearNOT VALID: the carrying capacity must be from 1 to 1000 thousandNOT VALID: each harvest rate must be from 0 to 2 per yearNOT VALID: each starting population must be from 0.1 to 100 thousandNOT VALID: the duration must be from 5 to 200 yearsNOT VALID: the challenge number must be a whole number from 0 to 5, and the peak prediction one of the listed choicesCHECK: a population grew past 1,000,000 thousand, so run A or run B stops early; shorten the duration or change the rates: run A or run B stopped before the end of the run.CHECK: the carrying capacity is too small for the predators: there is no coexistence point, and the predators die out: Logistic prey with K at or below x*.CHECK: the prey harvest rate is at or above the prey growth rate: there is no coexistence point, and both species decline: Harvesting with h_x at or above α.CHECK: in run A the <species> went extinct (fell below the extinction floor of 0.000001 thousand):<species>is prey, predators or prey and predators, read from run A's last computed row.CHECK: in run B the <species> went extinct (fell below the extinction floor of 0.000001 thousand): the same for run B.CHECK: the time step is coarse for these populations (step ratio above 1.5), so the runs lose accuracy; shorten the durationCHECK: run A starts at the coexistence equilibrium, so its populations stay constant; move its starting point to see a cycle: both of run A's starting values are within 1×10⁻⁹ (relative) of the equilibrium.OK
References
This laboratory is an educational model of a prey population and a predator population, based on the Lotka-Volterra equations, with optional logistic prey growth limited by a carrying capacity and optional harvesting at constant shares per year. The classical fourth-order Runge-Kutta method (RK4) advances both populations over 200 fixed time steps. The coexistence equilibrium and its type come from the linearised model, and the conserved quantity of the classic model measures how much the method changes a cycle's size. An explicit Euler run at the same step and an RK4 run at twice the step, combined in a Richardson estimate, show the error of each method.
Sources and further reading
- The predator-prey equations, as first published: A. J. Lotka, Elements of Physical Biology, Williams and Wilkins, Baltimore, 1925.
- The same equations, derived independently for fish populations: V. Volterra, "Fluctuations in the abundance of a species considered mathematically", Nature 118, 1926, pages 558-560. doi:10.1038/118558a0
- Predator-prey models, the conserved quantity of the classic model, logistic prey and the equilibrium analysis: J. D. Murray, Mathematical Biology I: An Introduction, 3rd edition, Interdisciplinary Applied Mathematics 17, Springer, 2002, chapter 3, Models for Interacting Populations.
- Phase planes, nullclines, the classification of equilibria (centres, spirals and nodes) and conserved quantities: S. H. Strogatz, Nonlinear Dynamics and Chaos, 2nd edition, Westview Press, 2015, chapter 5, Linear Systems, and chapter 6, Phase Plane.
- The classical fourth-order Runge-Kutta method: W. H. Press, S. A. Teukolsky, W. T. Vetterling and B. P. Flannery, Numerical Recipes: The Art of Scientific Computing, 3rd edition, Cambridge University Press, 2007, chapter 17, Integration of Ordinary Differential Equations, section 17.1, Runge-Kutta Method.
- Euler's method and Runge-Kutta methods, and their errors: R. L. Burden, J. D. Faires and A. M. Burden, Numerical Analysis, 10th edition, Cengage Learning, 2016, chapter 5, Initial-Value Problems for Ordinary Differential Equations.
- Runge-Kutta methods and error estimation by Richardson extrapolation: E. Hairer, S. P. Nørsett and G. Wanner, Solving Ordinary Differential Equations I: Nonstiff Problems, 2nd revised edition, Springer Series in Computational Mathematics 8, Springer, 1993, chapter II, Runge-Kutta and Extrapolation Methods. doi:10.1007/978-3-540-78862-1
- The Gershgorin bound on the eigenvalues of a matrix, used for the step ratio: G. H. Golub and C. F. Van Loan, Matrix Computations, 4th edition, Johns Hopkins University Press, 2013, section 7.2, Perturbation Theory.
No table or text from any of these publications is reproduced, and none of their authors or publishers has reviewed or endorses this laboratory.
This laboratory is for learning. Its results hold only within its stated ranges; it is not a tool for managing wildlife, fisheries or pests, or for forecasting any real population.
Found a problem, or have an idea?
Tell us if a result looks wrong, a label is unclear, or something is missing. We read every message.