Lotka-Volterra Predator-Prey

The classic 1925/1926 predator-prey equations, integrated with RK4 by OnlyCSharp.Biology.Ecology.LotkaVolterra. Prey grow, predators eat prey and grow, predators starve without prey - producing the famous lagged oscillation. Every number is computed live at build time (5001 integration points, step 0.01).

Parameters

Physics sanity check (conserved quantity)

V(N,P) = delta*N - gamma*ln(N) + beta*P - alpha*ln(P) is a first integral of the flow: exactly constant along a true trajectory. RK4 drift over 5001 steps should be tiny.

QuantityValue
V(initial) N=10.0000, P=5.0000-3.8133155519
V(final) N=15.0213, P=3.3588-3.8133155509
difference (should be ~0)1.016752E-009

Population over time

Sampled every 100th point (~1.0 time unit). The bar columns are proportional cell widths: prey (#) and predator (*) populations rendered as table-cell bars.

tpreypredatorprey levelpredator level
0.0010.0005.000
1.0018.6353.109
2.0035.3145.061
3.0031.84619.704
4.0010.07917.701
5.008.2937.419
6.0013.5123.602
7.0026.5783.414
8.0040.56210.532
9.0016.75022.885
10.008.00711.416
11.0010.2084.852
12.0019.1643.098
13.0036.0115.308
14.0030.57420.388
15.009.78017.167
16.008.3857.160
17.0013.8693.534
18.0027.2933.487
19.0040.41911.210
20.0015.90522.631
21.007.96711.006
22.0010.4264.711
23.0019.7083.093
24.0036.6835.579
25.0029.27521.013
26.009.51016.634
27.008.4876.913
28.0014.2403.470
29.0028.0193.569
30.0040.16411.924
31.0015.11922.323
32.007.94110.610
33.0010.6554.577
34.0020.2683.093
35.0037.3255.875
36.0027.96321.572
37.009.26716.105
38.008.5986.676
39.0014.6243.412
40.0028.7553.661
41.0039.79212.672
42.0014.39221.970
43.007.92810.228
44.0010.8954.450
45.0020.8443.098
46.0037.9316.199
47.0026.65422.057
48.009.05015.583
49.008.7186.449
50.0015.0213.359

Reading it

Prey rise, then predators rise chasing them, then prey crash from over-predation, then predators starve and crash too - and the cycle repeats. The predator peak always lags the prey peak: that lag is the signature of the predator-prey cycle.