FAILURE MAP
← Case archive

FA-65406 / Ecological population dynamics / Open access

Lotka-Volterra predator-prey Euler integration: simultaneous derivative state · case 01

Predator growth responds to prey that were already updated in the same step.

Verified by executionVariant 1 · 7 checks per implementationDownload source bundle ↓JSON ↗

ROOT CAUSE

The prey update is applied before the predator derivative is evaluated.

VERIFIED REPAIR

Restore the simultaneous derivative state rule: `dy = delta * x * y - gamma * y / x = max(x + dx * dt, 0.0)`.

Unsuccessful approach: A half-step prey estimate is still not the start-of-step state required by Euler.

Case contract

dx = alpha*x - beta*x*y, dy = delta*x*y - gamma*y evaluated from the same start-of-step state; Euler update with each population floored at 0; return [path of [x,y] rounded 4 including start, coexistence equilibrium [gamma/delta, alpha/beta] rounded 4 or None when beta or delta is not positive].

Why this case matters

Population projections set harvest quotas, conservation status and pest-control timing; a wrong update order, boundary or rate conversion silently changes management advice.

1 / The failure

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
import math
N = 1
observations = []
def solve(prey0, pred0, alpha, beta, delta, gamma, dt, steps):
    x, y = float(prey0), float(pred0)
    path = [[round(x, 4), round(y, 4)]]
    for _ in range(steps):
        dx = alpha * x - beta * x * y
        x = max(x + dx * dt, 0.0)
        dy = delta * x * y - gamma * y
        y = max(y + dy * dt, 0.0)
        path.append([round(x, 4), round(y, 4)])
    eq = [round(gamma / delta, 4), round(alpha / beta, 4)] if beta > 0 and delta > 0 else None
    return [path, eq]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: hare and lynx',
   (40, 9, 0.1, 0.02, 0.01, 0.1, 0.5, 6),
   [[[40.0, 9.0],
     [38.4, 10.35],
     [36.3456, 11.8197],
     [33.8669, 13.3767],
     [31.03, 14.973],
     [27.9354, 16.5474],
     [24.7096, 18.0313]],
    [10.0, 5.0]]),
  ('regression: large step overshoot',
   (10, 50, 0.5, 0.1, 0.02, 0.4, 1.0, 4),
   [[[10.0, 50.0], [0.0, 40.0], [0.0, 24.0], [0.0, 14.4], [0.0, 8.64]], [20.0, 5.0]]),
  ('control: predators absent',
   (20, 0, 0.3, 0.05, 0.02, 0.2, 0.5, 4),
   [[[20.0, 0.0], [23.0, 0.0], [26.45, 0.0], [30.4175, 0.0], [34.9801, 0.0]], [10.0, 6.0]]),
  ('control: prey absent',
   (0, 10, 0.3, 0.05, 0.02, 0.2, 0.5, 4),
   [[[0.0, 10.0], [0.0, 9.0], [0.0, 8.1], [0.0, 7.29], [0.0, 6.561]], [10.0, 6.0]]),
  ('control: no interaction',
   (30, 5, 0.2, 0.0, 0.0, 0.1, 1.0, 3),
   [[[30.0, 5.0], [36.0, 4.5], [43.2, 4.05], [51.84, 3.645]], None]),
  ('control: at equilibrium',
   (10, 5, 0.5, 0.1, 0.02, 0.2, 0.25, 4),
   [[[10.0, 5.0], [10.0, 5.0], [10.0, 5.0], [10.0, 5.0], [10.0, 5.0]], [10.0, 5.0]]),
  ('regression: fine steps',
   (15, 4, 0.8, 0.1, 0.05, 0.6, 0.1, 8),
   [[[15.0, 4.0],
     [15.6, 4.06],
     [16.2146, 4.1331],
     [16.8416, 4.2202],
     [17.4782, 4.3223],
     [18.121, 4.4407],
     [18.766, 4.5766],
     [19.4084, 4.7315],
     [20.0428, 4.9067]],
    [12.0, 8.0]])],
 [('regression: hare and lynx',
   (40, 9, 0.1, 0.02, 0.01, 0.1, 0.5, 6),
   [[[40.0, 9.0],
     [38.4, 10.35],
     [36.3456, 11.8197],
     [33.8669, 13.3767],
     [31.03, 14.973],
     [27.9354, 16.5474],
     [24.7096, 18.0313]],
    [10.0, 5.0]]),
  ('regression: large step overshoot',
   (10, 50, 0.5, 0.1, 0.02, 0.4, 1.0, 4),
   [[[10.0, 50.0], [0.0, 40.0], [0.0, 24.0], [0.0, 14.4], [0.0, 8.64]], [20.0, 5.0]]),
  ('control: prey absent',
   (0, 10, 0.3, 0.05, 0.02, 0.2, 0.5, 4),
   [[[0.0, 10.0], [0.0, 9.0], [0.0, 8.1], [0.0, 7.29], [0.0, 6.561]], [10.0, 6.0]]),
  ('control: no interaction',
   (30, 5, 0.2, 0.0, 0.0, 0.1, 1.0, 3),
   [[[30.0, 5.0], [36.0, 4.5], [43.2, 4.05], [51.84, 3.645]], None]),
  ('control: at equilibrium',
   (10, 5, 0.5, 0.1, 0.02, 0.2, 0.25, 4),
   [[[10.0, 5.0], [10.0, 5.0], [10.0, 5.0], [10.0, 5.0], [10.0, 5.0]], [10.0, 5.0]]),
  ('regression: fine steps',
   (15, 4, 0.8, 0.1, 0.05, 0.6, 0.1, 8),
   [[[15.0, 4.0],
     [15.6, 4.06],
     [16.2146, 4.1331],
     [16.8416, 4.2202],
     [17.4782, 4.3223],
     [18.121, 4.4407],
     [18.766, 4.5766],
     [19.4084, 4.7315],
     [20.0428, 4.9067]],
    [12.0, 8.0]]),
  ('regression: predator crash',
   (5, 30, 0.4, 0.2, 0.01, 0.9, 1.0, 3),
   [[[5.0, 30.0], [0.0, 4.5], [0.0, 0.45], [0.0, 0.045]], [90.0, 2.0]])],
 [('regression: hare and lynx',
   (40, 9, 0.1, 0.02, 0.01, 0.1, 0.5, 6),
   [[[40.0, 9.0],
     [38.4, 10.35],
     [36.3456, 11.8197],
     [33.8669, 13.3767],
     [31.03, 14.973],
     [27.9354, 16.5474],
     [24.7096, 18.0313]],
    [10.0, 5.0]]),
  ('regression: large step overshoot',
   (10, 50, 0.5, 0.1, 0.02, 0.4, 1.0, 4),
   [[[10.0, 50.0], [0.0, 40.0], [0.0, 24.0], [0.0, 14.4], [0.0, 8.64]], [20.0, 5.0]]),
  ('control: predators absent',
   (20, 0, 0.3, 0.05, 0.02, 0.2, 0.5, 4),
   [[[20.0, 0.0], [23.0, 0.0], [26.45, 0.0], [30.4175, 0.0], [34.9801, 0.0]], [10.0, 6.0]]),
  ('control: prey absent',
   (0, 10, 0.3, 0.05, 0.02, 0.2, 0.5, 4),
   [[[0.0, 10.0], [0.0, 9.0], [0.0, 8.1], [0.0, 7.29], [0.0, 6.561]], [10.0, 6.0]]),
  ('control: no interaction',
   (30, 5, 0.2, 0.0, 0.0, 0.1, 1.0, 3),
   [[[30.0, 5.0], [36.0, 4.5], [43.2, 4.05], [51.84, 3.645]], None]),
  ('regression: fine steps',
   (15, 4, 0.8, 0.1, 0.05, 0.6, 0.1, 8),
   [[[15.0, 4.0],
     [15.6, 4.06],
     [16.2146, 4.1331],
     [16.8416, 4.2202],
     [17.4782, 4.3223],
     [18.121, 4.4407],
     [18.766, 4.5766],
     [19.4084, 4.7315],
     [20.0428, 4.9067]],
    [12.0, 8.0]]),
  ('regression: predator crash',
   (5, 30, 0.4, 0.2, 0.01, 0.9, 1.0, 3),
   [[[5.0, 30.0], [0.0, 4.5], [0.0, 0.45], [0.0, 0.045]], [90.0, 2.0]])],
 [('regression: large step overshoot',
   (10, 50, 0.5, 0.1, 0.02, 0.4, 1.0, 4),
   [[[10.0, 50.0], [0.0, 40.0], [0.0, 24.0], [0.0, 14.4], [0.0, 8.64]], [20.0, 5.0]]),
  ('control: predators absent',
   (20, 0, 0.3, 0.05, 0.02, 0.2, 0.5, 4),
   [[[20.0, 0.0], [23.0, 0.0], [26.45, 0.0], [30.4175, 0.0], [34.9801, 0.0]], [10.0, 6.0]]),
  ('control: prey absent',
   (0, 10, 0.3, 0.05, 0.02, 0.2, 0.5, 4),
   [[[0.0, 10.0], [0.0, 9.0], [0.0, 8.1], [0.0, 7.29], [0.0, 6.561]], [10.0, 6.0]]),
  ('control: no interaction',
   (30, 5, 0.2, 0.0, 0.0, 0.1, 1.0, 3),
   [[[30.0, 5.0], [36.0, 4.5], [43.2, 4.05], [51.84, 3.645]], None]),
  ('control: at equilibrium',
   (10, 5, 0.5, 0.1, 0.02, 0.2, 0.25, 4),
   [[[10.0, 5.0], [10.0, 5.0], [10.0, 5.0], [10.0, 5.0], [10.0, 5.0]], [10.0, 5.0]]),
  ('regression: fine steps',
   (15, 4, 0.8, 0.1, 0.05, 0.6, 0.1, 8),
   [[[15.0, 4.0],
     [15.6, 4.06],
     [16.2146, 4.1331],
     [16.8416, 4.2202],
     [17.4782, 4.3223],
     [18.121, 4.4407],
     [18.766, 4.5766],
     [19.4084, 4.7315],
     [20.0428, 4.9067]],
    [12.0, 8.0]]),
  ('regression: predator crash',
   (5, 30, 0.4, 0.2, 0.01, 0.9, 1.0, 3),
   [[[5.0, 30.0], [0.0, 4.5], [0.0, 0.45], [0.0, 0.045]], [90.0, 2.0]])],
 [('regression: hare and lynx',
   (40, 9, 0.1, 0.02, 0.01, 0.1, 0.5, 6),
   [[[40.0, 9.0],
     [38.4, 10.35],
     [36.3456, 11.8197],
     [33.8669, 13.3767],
     [31.03, 14.973],
     [27.9354, 16.5474],
     [24.7096, 18.0313]],
    [10.0, 5.0]]),
  ('regression: large step overshoot',
   (10, 50, 0.5, 0.1, 0.02, 0.4, 1.0, 4),
   [[[10.0, 50.0], [0.0, 40.0], [0.0, 24.0], [0.0, 14.4], [0.0, 8.64]], [20.0, 5.0]]),
  ('control: predators absent',
   (20, 0, 0.3, 0.05, 0.02, 0.2, 0.5, 4),
   [[[20.0, 0.0], [23.0, 0.0], [26.45, 0.0], [30.4175, 0.0], [34.9801, 0.0]], [10.0, 6.0]]),
  ('control: no interaction',
   (30, 5, 0.2, 0.0, 0.0, 0.1, 1.0, 3),
   [[[30.0, 5.0], [36.0, 4.5], [43.2, 4.05], [51.84, 3.645]], None]),
  ('control: at equilibrium',
   (10, 5, 0.5, 0.1, 0.02, 0.2, 0.25, 4),
   [[[10.0, 5.0], [10.0, 5.0], [10.0, 5.0], [10.0, 5.0], [10.0, 5.0]], [10.0, 5.0]]),
  ('regression: fine steps',
   (15, 4, 0.8, 0.1, 0.05, 0.6, 0.1, 8),
   [[[15.0, 4.0],
     [15.6, 4.06],
     [16.2146, 4.1331],
     [16.8416, 4.2202],
     [17.4782, 4.3223],
     [18.121, 4.4407],
     [18.766, 4.5766],
     [19.4084, 4.7315],
     [20.0428, 4.9067]],
    [12.0, 8.0]]),
  ('regression: predator crash',
   (5, 30, 0.4, 0.2, 0.01, 0.9, 1.0, 3),
   [[[5.0, 30.0], [0.0, 4.5], [0.0, 0.45], [0.0, 0.045]], [90.0, 2.0]])]]
for label, args, expected in fixtures[N - 1]:
    check(label, solve(*args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
Boundary fixtureActualExpectedOutcome
regression: hare and lynx[[[40.0, 9.0], [38.4, 10.278], [36.3732, 11.6333], [33.9605, 13.027], [31.2345, 14.4101], [28.2953, 15.7283], [25.2597, 16.9284]], [10.0, 5.0]][[[40.0, 9.0], [38.4, 10.35], [36.3456, 11.8197], [33.8669, 13.3767], [31.03, 14.973], [27.9354, 16.5474], [24.7096, 18.0313]], [10.0, 5.0]]Failed
regression: large step overshoot[[[10.0, 50.0], [0.0, 30.0], [0.0, 18.0], [0.0, 10.8], [0.0, 6.48]], [20.0, 5.0]][[[10.0, 50.0], [0.0, 40.0], [0.0, 24.0], [0.0, 14.4], [0.0, 8.64]], [20.0, 5.0]]Failed
control: predators absent[[[20.0, 0.0], [23.0, 0.0], [26.45, 0.0], [30.4175, 0.0], [34.9801, 0.0]], [10.0, 6.0]][[[20.0, 0.0], [23.0, 0.0], [26.45, 0.0], [30.4175, 0.0], [34.9801, 0.0]], [10.0, 6.0]]Passed
control: prey absent[[[0.0, 10.0], [0.0, 9.0], [0.0, 8.1], [0.0, 7.29], [0.0, 6.561]], [10.0, 6.0]][[[0.0, 10.0], [0.0, 9.0], [0.0, 8.1], [0.0, 7.29], [0.0, 6.561]], [10.0, 6.0]]Passed
control: no interaction[[[30.0, 5.0], [36.0, 4.5], [43.2, 4.05], [51.84, 3.645]], None][[[30.0, 5.0], [36.0, 4.5], [43.2, 4.05], [51.84, 3.645]], None]Passed
control: at equilibrium[[[10.0, 5.0], [10.0, 5.0], [10.0, 5.0], [10.0, 5.0], [10.0, 5.0]], [10.0, 5.0]][[[10.0, 5.0], [10.0, 5.0], [10.0, 5.0], [10.0, 5.0], [10.0, 5.0]], [10.0, 5.0]]Passed
regression: fine steps[[[15.0, 4.0], [15.6, 4.072], [16.2128, 4.1578], [16.8357, 4.2583], [17.4656, 4.3747], [18.0988, 4.5081], [18.7308, 4.6598], [19.3565, 4.8312], [19.9698, 5.0237]], [12.0, 8.0]][[[15.0, 4.0], [15.6, 4.06], [16.2146, 4.1331], [16.8416, 4.2202], [17.4782, 4.3223], [18.121, 4.4407], [18.766, 4.5766], [19.4084, 4.7315], [20.0428, 4.9067]], [12.0, 8.0]]Failed

SHA-256 / bdee7bd673cb18b01b827c377dca99f630eab9f5af4b407771575ddd522862a1

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
import math
N = 1
observations = []
def solve(prey0, pred0, alpha, beta, delta, gamma, dt, steps):
    x, y = float(prey0), float(pred0)
    path = [[round(x, 4), round(y, 4)]]
    for _ in range(steps):
        dx = alpha * x - beta * x * y
        dy = delta * (x + dx * dt / 2) * y - gamma * y
        x = max(x + dx * dt, 0.0)
        y = max(y + dy * dt, 0.0)
        path.append([round(x, 4), round(y, 4)])
    eq = [round(gamma / delta, 4), round(alpha / beta, 4)] if beta > 0 and delta > 0 else None
    return [path, eq]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: hare and lynx',
   (40, 9, 0.1, 0.02, 0.01, 0.1, 0.5, 6),
   [[[40.0, 9.0],
     [38.4, 10.35],
     [36.3456, 11.8197],
     [33.8669, 13.3767],
     [31.03, 14.973],
     [27.9354, 16.5474],
     [24.7096, 18.0313]],
    [10.0, 5.0]]),
  ('regression: large step overshoot',
   (10, 50, 0.5, 0.1, 0.02, 0.4, 1.0, 4),
   [[[10.0, 50.0], [0.0, 40.0], [0.0, 24.0], [0.0, 14.4], [0.0, 8.64]], [20.0, 5.0]]),
  ('control: predators absent',
   (20, 0, 0.3, 0.05, 0.02, 0.2, 0.5, 4),
   [[[20.0, 0.0], [23.0, 0.0], [26.45, 0.0], [30.4175, 0.0], [34.9801, 0.0]], [10.0, 6.0]]),
  ('control: prey absent',
   (0, 10, 0.3, 0.05, 0.02, 0.2, 0.5, 4),
   [[[0.0, 10.0], [0.0, 9.0], [0.0, 8.1], [0.0, 7.29], [0.0, 6.561]], [10.0, 6.0]]),
  ('control: no interaction',
   (30, 5, 0.2, 0.0, 0.0, 0.1, 1.0, 3),
   [[[30.0, 5.0], [36.0, 4.5], [43.2, 4.05], [51.84, 3.645]], None]),
  ('control: at equilibrium',
   (10, 5, 0.5, 0.1, 0.02, 0.2, 0.25, 4),
   [[[10.0, 5.0], [10.0, 5.0], [10.0, 5.0], [10.0, 5.0], [10.0, 5.0]], [10.0, 5.0]]),
  ('regression: fine steps',
   (15, 4, 0.8, 0.1, 0.05, 0.6, 0.1, 8),
   [[[15.0, 4.0],
     [15.6, 4.06],
     [16.2146, 4.1331],
     [16.8416, 4.2202],
     [17.4782, 4.3223],
     [18.121, 4.4407],
     [18.766, 4.5766],
     [19.4084, 4.7315],
     [20.0428, 4.9067]],
    [12.0, 8.0]])],
 [('regression: hare and lynx',
   (40, 9, 0.1, 0.02, 0.01, 0.1, 0.5, 6),
   [[[40.0, 9.0],
     [38.4, 10.35],
     [36.3456, 11.8197],
     [33.8669, 13.3767],
     [31.03, 14.973],
     [27.9354, 16.5474],
     [24.7096, 18.0313]],
    [10.0, 5.0]]),
  ('regression: large step overshoot',
   (10, 50, 0.5, 0.1, 0.02, 0.4, 1.0, 4),
   [[[10.0, 50.0], [0.0, 40.0], [0.0, 24.0], [0.0, 14.4], [0.0, 8.64]], [20.0, 5.0]]),
  ('control: prey absent',
   (0, 10, 0.3, 0.05, 0.02, 0.2, 0.5, 4),
   [[[0.0, 10.0], [0.0, 9.0], [0.0, 8.1], [0.0, 7.29], [0.0, 6.561]], [10.0, 6.0]]),
  ('control: no interaction',
   (30, 5, 0.2, 0.0, 0.0, 0.1, 1.0, 3),
   [[[30.0, 5.0], [36.0, 4.5], [43.2, 4.05], [51.84, 3.645]], None]),
  ('control: at equilibrium',
   (10, 5, 0.5, 0.1, 0.02, 0.2, 0.25, 4),
   [[[10.0, 5.0], [10.0, 5.0], [10.0, 5.0], [10.0, 5.0], [10.0, 5.0]], [10.0, 5.0]]),
  ('regression: fine steps',
   (15, 4, 0.8, 0.1, 0.05, 0.6, 0.1, 8),
   [[[15.0, 4.0],
     [15.6, 4.06],
     [16.2146, 4.1331],
     [16.8416, 4.2202],
     [17.4782, 4.3223],
     [18.121, 4.4407],
     [18.766, 4.5766],
     [19.4084, 4.7315],
     [20.0428, 4.9067]],
    [12.0, 8.0]]),
  ('regression: predator crash',
   (5, 30, 0.4, 0.2, 0.01, 0.9, 1.0, 3),
   [[[5.0, 30.0], [0.0, 4.5], [0.0, 0.45], [0.0, 0.045]], [90.0, 2.0]])],
 [('regression: hare and lynx',
   (40, 9, 0.1, 0.02, 0.01, 0.1, 0.5, 6),
   [[[40.0, 9.0],
     [38.4, 10.35],
     [36.3456, 11.8197],
     [33.8669, 13.3767],
     [31.03, 14.973],
     [27.9354, 16.5474],
     [24.7096, 18.0313]],
    [10.0, 5.0]]),
  ('regression: large step overshoot',
   (10, 50, 0.5, 0.1, 0.02, 0.4, 1.0, 4),
   [[[10.0, 50.0], [0.0, 40.0], [0.0, 24.0], [0.0, 14.4], [0.0, 8.64]], [20.0, 5.0]]),
  ('control: predators absent',
   (20, 0, 0.3, 0.05, 0.02, 0.2, 0.5, 4),
   [[[20.0, 0.0], [23.0, 0.0], [26.45, 0.0], [30.4175, 0.0], [34.9801, 0.0]], [10.0, 6.0]]),
  ('control: prey absent',
   (0, 10, 0.3, 0.05, 0.02, 0.2, 0.5, 4),
   [[[0.0, 10.0], [0.0, 9.0], [0.0, 8.1], [0.0, 7.29], [0.0, 6.561]], [10.0, 6.0]]),
  ('control: no interaction',
   (30, 5, 0.2, 0.0, 0.0, 0.1, 1.0, 3),
   [[[30.0, 5.0], [36.0, 4.5], [43.2, 4.05], [51.84, 3.645]], None]),
  ('regression: fine steps',
   (15, 4, 0.8, 0.1, 0.05, 0.6, 0.1, 8),
   [[[15.0, 4.0],
     [15.6, 4.06],
     [16.2146, 4.1331],
     [16.8416, 4.2202],
     [17.4782, 4.3223],
     [18.121, 4.4407],
     [18.766, 4.5766],
     [19.4084, 4.7315],
     [20.0428, 4.9067]],
    [12.0, 8.0]]),
  ('regression: predator crash',
   (5, 30, 0.4, 0.2, 0.01, 0.9, 1.0, 3),
   [[[5.0, 30.0], [0.0, 4.5], [0.0, 0.45], [0.0, 0.045]], [90.0, 2.0]])],
 [('regression: large step overshoot',
   (10, 50, 0.5, 0.1, 0.02, 0.4, 1.0, 4),
   [[[10.0, 50.0], [0.0, 40.0], [0.0, 24.0], [0.0, 14.4], [0.0, 8.64]], [20.0, 5.0]]),
  ('control: predators absent',
   (20, 0, 0.3, 0.05, 0.02, 0.2, 0.5, 4),
   [[[20.0, 0.0], [23.0, 0.0], [26.45, 0.0], [30.4175, 0.0], [34.9801, 0.0]], [10.0, 6.0]]),
  ('control: prey absent',
   (0, 10, 0.3, 0.05, 0.02, 0.2, 0.5, 4),
   [[[0.0, 10.0], [0.0, 9.0], [0.0, 8.1], [0.0, 7.29], [0.0, 6.561]], [10.0, 6.0]]),
  ('control: no interaction',
   (30, 5, 0.2, 0.0, 0.0, 0.1, 1.0, 3),
   [[[30.0, 5.0], [36.0, 4.5], [43.2, 4.05], [51.84, 3.645]], None]),
  ('control: at equilibrium',
   (10, 5, 0.5, 0.1, 0.02, 0.2, 0.25, 4),
   [[[10.0, 5.0], [10.0, 5.0], [10.0, 5.0], [10.0, 5.0], [10.0, 5.0]], [10.0, 5.0]]),
  ('regression: fine steps',
   (15, 4, 0.8, 0.1, 0.05, 0.6, 0.1, 8),
   [[[15.0, 4.0],
     [15.6, 4.06],
     [16.2146, 4.1331],
     [16.8416, 4.2202],
     [17.4782, 4.3223],
     [18.121, 4.4407],
     [18.766, 4.5766],
     [19.4084, 4.7315],
     [20.0428, 4.9067]],
    [12.0, 8.0]]),
  ('regression: predator crash',
   (5, 30, 0.4, 0.2, 0.01, 0.9, 1.0, 3),
   [[[5.0, 30.0], [0.0, 4.5], [0.0, 0.45], [0.0, 0.045]], [90.0, 2.0]])],
 [('regression: hare and lynx',
   (40, 9, 0.1, 0.02, 0.01, 0.1, 0.5, 6),
   [[[40.0, 9.0],
     [38.4, 10.35],
     [36.3456, 11.8197],
     [33.8669, 13.3767],
     [31.03, 14.973],
     [27.9354, 16.5474],
     [24.7096, 18.0313]],
    [10.0, 5.0]]),
  ('regression: large step overshoot',
   (10, 50, 0.5, 0.1, 0.02, 0.4, 1.0, 4),
   [[[10.0, 50.0], [0.0, 40.0], [0.0, 24.0], [0.0, 14.4], [0.0, 8.64]], [20.0, 5.0]]),
  ('control: predators absent',
   (20, 0, 0.3, 0.05, 0.02, 0.2, 0.5, 4),
   [[[20.0, 0.0], [23.0, 0.0], [26.45, 0.0], [30.4175, 0.0], [34.9801, 0.0]], [10.0, 6.0]]),
  ('control: no interaction',
   (30, 5, 0.2, 0.0, 0.0, 0.1, 1.0, 3),
   [[[30.0, 5.0], [36.0, 4.5], [43.2, 4.05], [51.84, 3.645]], None]),
  ('control: at equilibrium',
   (10, 5, 0.5, 0.1, 0.02, 0.2, 0.25, 4),
   [[[10.0, 5.0], [10.0, 5.0], [10.0, 5.0], [10.0, 5.0], [10.0, 5.0]], [10.0, 5.0]]),
  ('regression: fine steps',
   (15, 4, 0.8, 0.1, 0.05, 0.6, 0.1, 8),
   [[[15.0, 4.0],
     [15.6, 4.06],
     [16.2146, 4.1331],
     [16.8416, 4.2202],
     [17.4782, 4.3223],
     [18.121, 4.4407],
     [18.766, 4.5766],
     [19.4084, 4.7315],
     [20.0428, 4.9067]],
    [12.0, 8.0]]),
  ('regression: predator crash',
   (5, 30, 0.4, 0.2, 0.01, 0.9, 1.0, 3),
   [[[5.0, 30.0], [0.0, 4.5], [0.0, 0.45], [0.0, 0.045]], [90.0, 2.0]])]]
for label, args, expected in fixtures[N - 1]:
    check(label, solve(*args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
Boundary fixtureActualExpectedOutcome
regression: hare and lynx[[[40.0, 9.0], [38.4, 10.314], [36.3594, 11.726], [33.9139, 13.1997], [31.1331, 14.6862], [28.1174, 16.1274], [24.9887, 17.4621]], [10.0, 5.0]][[[40.0, 9.0], [38.4, 10.35], [36.3456, 11.8197], [33.8669, 13.3767], [31.03, 14.973], [27.9354, 16.5474], [24.7096, 18.0313]], [10.0, 5.0]]Failed
regression: large step overshoot[[[10.0, 50.0], [0.0, 17.5], [0.0, 10.5], [0.0, 6.3], [0.0, 3.78]], [20.0, 5.0]][[[10.0, 50.0], [0.0, 40.0], [0.0, 24.0], [0.0, 14.4], [0.0, 8.64]], [20.0, 5.0]]Failed
control: predators absent[[[20.0, 0.0], [23.0, 0.0], [26.45, 0.0], [30.4175, 0.0], [34.9801, 0.0]], [10.0, 6.0]][[[20.0, 0.0], [23.0, 0.0], [26.45, 0.0], [30.4175, 0.0], [34.9801, 0.0]], [10.0, 6.0]]Passed
control: prey absent[[[0.0, 10.0], [0.0, 9.0], [0.0, 8.1], [0.0, 7.29], [0.0, 6.561]], [10.0, 6.0]][[[0.0, 10.0], [0.0, 9.0], [0.0, 8.1], [0.0, 7.29], [0.0, 6.561]], [10.0, 6.0]]Passed
control: no interaction[[[30.0, 5.0], [36.0, 4.5], [43.2, 4.05], [51.84, 3.645]], None][[[30.0, 5.0], [36.0, 4.5], [43.2, 4.05], [51.84, 3.645]], None]Passed
control: at equilibrium[[[10.0, 5.0], [10.0, 5.0], [10.0, 5.0], [10.0, 5.0], [10.0, 5.0]], [10.0, 5.0]][[[10.0, 5.0], [10.0, 5.0], [10.0, 5.0], [10.0, 5.0], [10.0, 5.0]], [10.0, 5.0]]Passed
regression: fine steps[[[15.0, 4.0], [15.6, 4.066], [16.2137, 4.1454], [16.8387, 4.2392], [17.4719, 4.3485], [18.1099, 4.4744], [18.7484, 4.6183], [19.3824, 4.7814], [20.0063, 4.9654]], [12.0, 8.0]][[[15.0, 4.0], [15.6, 4.06], [16.2146, 4.1331], [16.8416, 4.2202], [17.4782, 4.3223], [18.121, 4.4407], [18.766, 4.5766], [19.4084, 4.7315], [20.0428, 4.9067]], [12.0, 8.0]]Failed

SHA-256 / bb5e65f2310e839b0208039545485ae77500a1b66ae5fde39d15e94ec80921a0

3 / The verified repair

Exit 0
"""Failure Map reference implementation. Python standard library only."""
import json
import math
N = 1
observations = []
def solve(prey0, pred0, alpha, beta, delta, gamma, dt, steps):
    x, y = float(prey0), float(pred0)
    path = [[round(x, 4), round(y, 4)]]
    for _ in range(steps):
        dx = alpha * x - beta * x * y
        dy = delta * x * y - gamma * y
        x = max(x + dx * dt, 0.0)
        y = max(y + dy * dt, 0.0)
        path.append([round(x, 4), round(y, 4)])
    eq = [round(gamma / delta, 4), round(alpha / beta, 4)] if beta > 0 and delta > 0 else None
    return [path, eq]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: hare and lynx',
   (40, 9, 0.1, 0.02, 0.01, 0.1, 0.5, 6),
   [[[40.0, 9.0],
     [38.4, 10.35],
     [36.3456, 11.8197],
     [33.8669, 13.3767],
     [31.03, 14.973],
     [27.9354, 16.5474],
     [24.7096, 18.0313]],
    [10.0, 5.0]]),
  ('regression: large step overshoot',
   (10, 50, 0.5, 0.1, 0.02, 0.4, 1.0, 4),
   [[[10.0, 50.0], [0.0, 40.0], [0.0, 24.0], [0.0, 14.4], [0.0, 8.64]], [20.0, 5.0]]),
  ('control: predators absent',
   (20, 0, 0.3, 0.05, 0.02, 0.2, 0.5, 4),
   [[[20.0, 0.0], [23.0, 0.0], [26.45, 0.0], [30.4175, 0.0], [34.9801, 0.0]], [10.0, 6.0]]),
  ('control: prey absent',
   (0, 10, 0.3, 0.05, 0.02, 0.2, 0.5, 4),
   [[[0.0, 10.0], [0.0, 9.0], [0.0, 8.1], [0.0, 7.29], [0.0, 6.561]], [10.0, 6.0]]),
  ('control: no interaction',
   (30, 5, 0.2, 0.0, 0.0, 0.1, 1.0, 3),
   [[[30.0, 5.0], [36.0, 4.5], [43.2, 4.05], [51.84, 3.645]], None]),
  ('control: at equilibrium',
   (10, 5, 0.5, 0.1, 0.02, 0.2, 0.25, 4),
   [[[10.0, 5.0], [10.0, 5.0], [10.0, 5.0], [10.0, 5.0], [10.0, 5.0]], [10.0, 5.0]]),
  ('regression: fine steps',
   (15, 4, 0.8, 0.1, 0.05, 0.6, 0.1, 8),
   [[[15.0, 4.0],
     [15.6, 4.06],
     [16.2146, 4.1331],
     [16.8416, 4.2202],
     [17.4782, 4.3223],
     [18.121, 4.4407],
     [18.766, 4.5766],
     [19.4084, 4.7315],
     [20.0428, 4.9067]],
    [12.0, 8.0]])],
 [('regression: hare and lynx',
   (40, 9, 0.1, 0.02, 0.01, 0.1, 0.5, 6),
   [[[40.0, 9.0],
     [38.4, 10.35],
     [36.3456, 11.8197],
     [33.8669, 13.3767],
     [31.03, 14.973],
     [27.9354, 16.5474],
     [24.7096, 18.0313]],
    [10.0, 5.0]]),
  ('regression: large step overshoot',
   (10, 50, 0.5, 0.1, 0.02, 0.4, 1.0, 4),
   [[[10.0, 50.0], [0.0, 40.0], [0.0, 24.0], [0.0, 14.4], [0.0, 8.64]], [20.0, 5.0]]),
  ('control: prey absent',
   (0, 10, 0.3, 0.05, 0.02, 0.2, 0.5, 4),
   [[[0.0, 10.0], [0.0, 9.0], [0.0, 8.1], [0.0, 7.29], [0.0, 6.561]], [10.0, 6.0]]),
  ('control: no interaction',
   (30, 5, 0.2, 0.0, 0.0, 0.1, 1.0, 3),
   [[[30.0, 5.0], [36.0, 4.5], [43.2, 4.05], [51.84, 3.645]], None]),
  ('control: at equilibrium',
   (10, 5, 0.5, 0.1, 0.02, 0.2, 0.25, 4),
   [[[10.0, 5.0], [10.0, 5.0], [10.0, 5.0], [10.0, 5.0], [10.0, 5.0]], [10.0, 5.0]]),
  ('regression: fine steps',
   (15, 4, 0.8, 0.1, 0.05, 0.6, 0.1, 8),
   [[[15.0, 4.0],
     [15.6, 4.06],
     [16.2146, 4.1331],
     [16.8416, 4.2202],
     [17.4782, 4.3223],
     [18.121, 4.4407],
     [18.766, 4.5766],
     [19.4084, 4.7315],
     [20.0428, 4.9067]],
    [12.0, 8.0]]),
  ('regression: predator crash',
   (5, 30, 0.4, 0.2, 0.01, 0.9, 1.0, 3),
   [[[5.0, 30.0], [0.0, 4.5], [0.0, 0.45], [0.0, 0.045]], [90.0, 2.0]])],
 [('regression: hare and lynx',
   (40, 9, 0.1, 0.02, 0.01, 0.1, 0.5, 6),
   [[[40.0, 9.0],
     [38.4, 10.35],
     [36.3456, 11.8197],
     [33.8669, 13.3767],
     [31.03, 14.973],
     [27.9354, 16.5474],
     [24.7096, 18.0313]],
    [10.0, 5.0]]),
  ('regression: large step overshoot',
   (10, 50, 0.5, 0.1, 0.02, 0.4, 1.0, 4),
   [[[10.0, 50.0], [0.0, 40.0], [0.0, 24.0], [0.0, 14.4], [0.0, 8.64]], [20.0, 5.0]]),
  ('control: predators absent',
   (20, 0, 0.3, 0.05, 0.02, 0.2, 0.5, 4),
   [[[20.0, 0.0], [23.0, 0.0], [26.45, 0.0], [30.4175, 0.0], [34.9801, 0.0]], [10.0, 6.0]]),
  ('control: prey absent',
   (0, 10, 0.3, 0.05, 0.02, 0.2, 0.5, 4),
   [[[0.0, 10.0], [0.0, 9.0], [0.0, 8.1], [0.0, 7.29], [0.0, 6.561]], [10.0, 6.0]]),
  ('control: no interaction',
   (30, 5, 0.2, 0.0, 0.0, 0.1, 1.0, 3),
   [[[30.0, 5.0], [36.0, 4.5], [43.2, 4.05], [51.84, 3.645]], None]),
  ('regression: fine steps',
   (15, 4, 0.8, 0.1, 0.05, 0.6, 0.1, 8),
   [[[15.0, 4.0],
     [15.6, 4.06],
     [16.2146, 4.1331],
     [16.8416, 4.2202],
     [17.4782, 4.3223],
     [18.121, 4.4407],
     [18.766, 4.5766],
     [19.4084, 4.7315],
     [20.0428, 4.9067]],
    [12.0, 8.0]]),
  ('regression: predator crash',
   (5, 30, 0.4, 0.2, 0.01, 0.9, 1.0, 3),
   [[[5.0, 30.0], [0.0, 4.5], [0.0, 0.45], [0.0, 0.045]], [90.0, 2.0]])],
 [('regression: large step overshoot',
   (10, 50, 0.5, 0.1, 0.02, 0.4, 1.0, 4),
   [[[10.0, 50.0], [0.0, 40.0], [0.0, 24.0], [0.0, 14.4], [0.0, 8.64]], [20.0, 5.0]]),
  ('control: predators absent',
   (20, 0, 0.3, 0.05, 0.02, 0.2, 0.5, 4),
   [[[20.0, 0.0], [23.0, 0.0], [26.45, 0.0], [30.4175, 0.0], [34.9801, 0.0]], [10.0, 6.0]]),
  ('control: prey absent',
   (0, 10, 0.3, 0.05, 0.02, 0.2, 0.5, 4),
   [[[0.0, 10.0], [0.0, 9.0], [0.0, 8.1], [0.0, 7.29], [0.0, 6.561]], [10.0, 6.0]]),
  ('control: no interaction',
   (30, 5, 0.2, 0.0, 0.0, 0.1, 1.0, 3),
   [[[30.0, 5.0], [36.0, 4.5], [43.2, 4.05], [51.84, 3.645]], None]),
  ('control: at equilibrium',
   (10, 5, 0.5, 0.1, 0.02, 0.2, 0.25, 4),
   [[[10.0, 5.0], [10.0, 5.0], [10.0, 5.0], [10.0, 5.0], [10.0, 5.0]], [10.0, 5.0]]),
  ('regression: fine steps',
   (15, 4, 0.8, 0.1, 0.05, 0.6, 0.1, 8),
   [[[15.0, 4.0],
     [15.6, 4.06],
     [16.2146, 4.1331],
     [16.8416, 4.2202],
     [17.4782, 4.3223],
     [18.121, 4.4407],
     [18.766, 4.5766],
     [19.4084, 4.7315],
     [20.0428, 4.9067]],
    [12.0, 8.0]]),
  ('regression: predator crash',
   (5, 30, 0.4, 0.2, 0.01, 0.9, 1.0, 3),
   [[[5.0, 30.0], [0.0, 4.5], [0.0, 0.45], [0.0, 0.045]], [90.0, 2.0]])],
 [('regression: hare and lynx',
   (40, 9, 0.1, 0.02, 0.01, 0.1, 0.5, 6),
   [[[40.0, 9.0],
     [38.4, 10.35],
     [36.3456, 11.8197],
     [33.8669, 13.3767],
     [31.03, 14.973],
     [27.9354, 16.5474],
     [24.7096, 18.0313]],
    [10.0, 5.0]]),
  ('regression: large step overshoot',
   (10, 50, 0.5, 0.1, 0.02, 0.4, 1.0, 4),
   [[[10.0, 50.0], [0.0, 40.0], [0.0, 24.0], [0.0, 14.4], [0.0, 8.64]], [20.0, 5.0]]),
  ('control: predators absent',
   (20, 0, 0.3, 0.05, 0.02, 0.2, 0.5, 4),
   [[[20.0, 0.0], [23.0, 0.0], [26.45, 0.0], [30.4175, 0.0], [34.9801, 0.0]], [10.0, 6.0]]),
  ('control: no interaction',
   (30, 5, 0.2, 0.0, 0.0, 0.1, 1.0, 3),
   [[[30.0, 5.0], [36.0, 4.5], [43.2, 4.05], [51.84, 3.645]], None]),
  ('control: at equilibrium',
   (10, 5, 0.5, 0.1, 0.02, 0.2, 0.25, 4),
   [[[10.0, 5.0], [10.0, 5.0], [10.0, 5.0], [10.0, 5.0], [10.0, 5.0]], [10.0, 5.0]]),
  ('regression: fine steps',
   (15, 4, 0.8, 0.1, 0.05, 0.6, 0.1, 8),
   [[[15.0, 4.0],
     [15.6, 4.06],
     [16.2146, 4.1331],
     [16.8416, 4.2202],
     [17.4782, 4.3223],
     [18.121, 4.4407],
     [18.766, 4.5766],
     [19.4084, 4.7315],
     [20.0428, 4.9067]],
    [12.0, 8.0]]),
  ('regression: predator crash',
   (5, 30, 0.4, 0.2, 0.01, 0.9, 1.0, 3),
   [[[5.0, 30.0], [0.0, 4.5], [0.0, 0.45], [0.0, 0.045]], [90.0, 2.0]])]]
for label, args, expected in fixtures[N - 1]:
    check(label, solve(*args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
Boundary fixtureActualExpectedOutcome
regression: hare and lynx[[[40.0, 9.0], [38.4, 10.35], [36.3456, 11.8197], [33.8669, 13.3767], [31.03, 14.973], [27.9354, 16.5474], [24.7096, 18.0313]], [10.0, 5.0]][[[40.0, 9.0], [38.4, 10.35], [36.3456, 11.8197], [33.8669, 13.3767], [31.03, 14.973], [27.9354, 16.5474], [24.7096, 18.0313]], [10.0, 5.0]]Passed
regression: large step overshoot[[[10.0, 50.0], [0.0, 40.0], [0.0, 24.0], [0.0, 14.4], [0.0, 8.64]], [20.0, 5.0]][[[10.0, 50.0], [0.0, 40.0], [0.0, 24.0], [0.0, 14.4], [0.0, 8.64]], [20.0, 5.0]]Passed
control: predators absent[[[20.0, 0.0], [23.0, 0.0], [26.45, 0.0], [30.4175, 0.0], [34.9801, 0.0]], [10.0, 6.0]][[[20.0, 0.0], [23.0, 0.0], [26.45, 0.0], [30.4175, 0.0], [34.9801, 0.0]], [10.0, 6.0]]Passed
control: prey absent[[[0.0, 10.0], [0.0, 9.0], [0.0, 8.1], [0.0, 7.29], [0.0, 6.561]], [10.0, 6.0]][[[0.0, 10.0], [0.0, 9.0], [0.0, 8.1], [0.0, 7.29], [0.0, 6.561]], [10.0, 6.0]]Passed
control: no interaction[[[30.0, 5.0], [36.0, 4.5], [43.2, 4.05], [51.84, 3.645]], None][[[30.0, 5.0], [36.0, 4.5], [43.2, 4.05], [51.84, 3.645]], None]Passed
control: at equilibrium[[[10.0, 5.0], [10.0, 5.0], [10.0, 5.0], [10.0, 5.0], [10.0, 5.0]], [10.0, 5.0]][[[10.0, 5.0], [10.0, 5.0], [10.0, 5.0], [10.0, 5.0], [10.0, 5.0]], [10.0, 5.0]]Passed
regression: fine steps[[[15.0, 4.0], [15.6, 4.06], [16.2146, 4.1331], [16.8416, 4.2202], [17.4782, 4.3223], [18.121, 4.4407], [18.766, 4.5766], [19.4084, 4.7315], [20.0428, 4.9067]], [12.0, 8.0]][[[15.0, 4.0], [15.6, 4.06], [16.2146, 4.1331], [16.8416, 4.2202], [17.4782, 4.3223], [18.121, 4.4407], [18.766, 4.5766], [19.4084, 4.7315], [20.0428, 4.9067]], [12.0, 8.0]]Passed

SHA-256 / b76fd44eeb3cd41b3c342c82200a65cce2d9efccf0a78777ebd0528d4e0da968

Verification & scope

Deterministic bounded teaching model with a stipulated contract; not a validated scientific or public-health modelling library. This reproducer isolates one failure mechanism. Results cover the supplied fixtures. Variants within a family share a test contract and should remain grouped when constructing evaluation splits. Related mechanisms with a shared evaluation_group must also remain together; these controlled models are not independent production incidents.

Observations recorded using Python 3.12.14 at 2026-09-29T14:47:33.732788+00:00.

Case digest / 9948c671f2885f92a355c2215b6c173a40ba7d6cb68735440f70a85ac423324b