FAILURE MAP
← Case archive

FA-65331 / Epidemic compartment models / Open access

Ross-Macdonald vector-borne R0: generational convention · case 01

The per-generation reproduction number halves R0 instead of taking its square root.

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

ROOT CAUSE

The host-to-host two-step R0 is halved rather than square-rooted.

VERIFIED REPAIR

Restore the generational convention rule: `round(math.sqrt(r0), 6)`.

Unsuccessful approach: Halving before the square root still misstates the per-generation value.

Case contract

R0 = m*a^2*b*c*exp(-mu*n)/(r*mu) with biting rate a, transmission probabilities b and c, mosquito density ratio m, human recovery r, mosquito death rate mu and extrinsic incubation n days; return [R0, sqrt(R0) generational value, survival exp(-mu*n)] rounded 6; None if a, r or mu is not positive or m is negative.

Why this case matters

Compartmental epidemic calculations drive outbreak forecasts, vaccine targets and hospital planning; a single wrong flow, rate conversion or boundary silently changes every downstream number.

1 / The failure

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
import math
N = 1
observations = []
def solve(a, b, c, m, r, mu, n_days):
    if min(a, r, mu) <= 0 or m < 0:
        return None
    survive = math.exp(-mu * n_days)
    r0 = m * a * a * b * c * survive / (r * mu)
    return [round(r0, 6), round(r0 / 2, 6), round(survive, 6)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: malaria-like', (0.3, 0.5, 0.5, 10, 0.01, 0.1, 10), [82.772874, 9.09796, 0.367879]),
  ('regression: dengue-like', (0.7, 0.4, 0.6, 2, 0.14, 0.12, 8), [5.3605, 2.315275, 0.382893]),
  ('control: no mosquitoes', (0.3, 0.5, 0.5, 0, 0.01, 0.1, 10), [0.0, 0.0, 0.367879]),
  ('control: invalid mu', (0.3, 0.5, 0.5, 10, 0.01, 0.0, 10), None),
  ('regression: zero incubation', (0.5, 0.3, 0.3, 5, 0.1, 0.2, 0), [5.625, 2.371708, 1.0]),
  ('regression: long lived mosquitoes',
   (0.25, 0.6, 0.4, 20, 0.02, 0.05, 12),
   [164.643491, 12.831348, 0.548812]),
  ('regression: low bite rate', (0.1, 0.9, 0.9, 50, 0.05, 0.15, 9), [13.998974, 3.74152, 0.25924])],
 [('regression: malaria-like', (0.3, 0.5, 0.5, 10, 0.01, 0.1, 10), [82.772874, 9.09796, 0.367879]),
  ('regression: dengue-like', (0.7, 0.4, 0.6, 2, 0.14, 0.12, 8), [5.3605, 2.315275, 0.382893]),
  ('control: no mosquitoes', (0.3, 0.5, 0.5, 0, 0.01, 0.1, 10), [0.0, 0.0, 0.367879]),
  ('control: invalid mu', (0.3, 0.5, 0.5, 10, 0.01, 0.0, 10), None),
  ('regression: zero incubation', (0.5, 0.3, 0.3, 5, 0.1, 0.2, 0), [5.625, 2.371708, 1.0]),
  ('regression: long lived mosquitoes',
   (0.25, 0.6, 0.4, 20, 0.02, 0.05, 12),
   [164.643491, 12.831348, 0.548812]),
  ('regression: low bite rate', (0.1, 0.9, 0.9, 50, 0.05, 0.15, 9), [13.998974, 3.74152, 0.25924])],
 [('regression: malaria-like', (0.3, 0.5, 0.5, 10, 0.01, 0.1, 10), [82.772874, 9.09796, 0.367879]),
  ('regression: dengue-like', (0.7, 0.4, 0.6, 2, 0.14, 0.12, 8), [5.3605, 2.315275, 0.382893]),
  ('control: no mosquitoes', (0.3, 0.5, 0.5, 0, 0.01, 0.1, 10), [0.0, 0.0, 0.367879]),
  ('control: invalid mu', (0.3, 0.5, 0.5, 10, 0.01, 0.0, 10), None),
  ('regression: zero incubation', (0.5, 0.3, 0.3, 5, 0.1, 0.2, 0), [5.625, 2.371708, 1.0]),
  ('regression: long lived mosquitoes',
   (0.25, 0.6, 0.4, 20, 0.02, 0.05, 12),
   [164.643491, 12.831348, 0.548812]),
  ('regression: low bite rate', (0.1, 0.9, 0.9, 50, 0.05, 0.15, 9), [13.998974, 3.74152, 0.25924])],
 [('regression: malaria-like', (0.3, 0.5, 0.5, 10, 0.01, 0.1, 10), [82.772874, 9.09796, 0.367879]),
  ('regression: dengue-like', (0.7, 0.4, 0.6, 2, 0.14, 0.12, 8), [5.3605, 2.315275, 0.382893]),
  ('control: no mosquitoes', (0.3, 0.5, 0.5, 0, 0.01, 0.1, 10), [0.0, 0.0, 0.367879]),
  ('control: invalid mu', (0.3, 0.5, 0.5, 10, 0.01, 0.0, 10), None),
  ('regression: zero incubation', (0.5, 0.3, 0.3, 5, 0.1, 0.2, 0), [5.625, 2.371708, 1.0]),
  ('regression: long lived mosquitoes',
   (0.25, 0.6, 0.4, 20, 0.02, 0.05, 12),
   [164.643491, 12.831348, 0.548812]),
  ('regression: low bite rate', (0.1, 0.9, 0.9, 50, 0.05, 0.15, 9), [13.998974, 3.74152, 0.25924])],
 [('regression: malaria-like', (0.3, 0.5, 0.5, 10, 0.01, 0.1, 10), [82.772874, 9.09796, 0.367879]),
  ('regression: dengue-like', (0.7, 0.4, 0.6, 2, 0.14, 0.12, 8), [5.3605, 2.315275, 0.382893]),
  ('control: no mosquitoes', (0.3, 0.5, 0.5, 0, 0.01, 0.1, 10), [0.0, 0.0, 0.367879]),
  ('control: invalid mu', (0.3, 0.5, 0.5, 10, 0.01, 0.0, 10), None),
  ('regression: zero incubation', (0.5, 0.3, 0.3, 5, 0.1, 0.2, 0), [5.625, 2.371708, 1.0]),
  ('regression: long lived mosquitoes',
   (0.25, 0.6, 0.4, 20, 0.02, 0.05, 12),
   [164.643491, 12.831348, 0.548812]),
  ('regression: low bite rate', (0.1, 0.9, 0.9, 50, 0.05, 0.15, 9), [13.998974, 3.74152, 0.25924])]]
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: malaria-like[82.772874, 41.386437, 0.367879][82.772874, 9.09796, 0.367879]Failed
regression: dengue-like[5.3605, 2.68025, 0.382893][5.3605, 2.315275, 0.382893]Failed
control: no mosquitoes[0.0, 0.0, 0.367879][0.0, 0.0, 0.367879]Passed
control: invalid muNoneNonePassed
regression: zero incubation[5.625, 2.8125, 1.0][5.625, 2.371708, 1.0]Failed
regression: long lived mosquitoes[164.643491, 82.321745, 0.548812][164.643491, 12.831348, 0.548812]Failed
regression: low bite rate[13.998974, 6.999487, 0.25924][13.998974, 3.74152, 0.25924]Failed

SHA-256 / 0645ba01f1e62931f73bf4aced8758180c31ffe4fc60d50c2ce0ad320c2bdc84

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
import math
N = 1
observations = []
def solve(a, b, c, m, r, mu, n_days):
    if min(a, r, mu) <= 0 or m < 0:
        return None
    survive = math.exp(-mu * n_days)
    r0 = m * a * a * b * c * survive / (r * mu)
    return [round(r0, 6), round(math.sqrt(r0 / 2), 6), round(survive, 6)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: malaria-like', (0.3, 0.5, 0.5, 10, 0.01, 0.1, 10), [82.772874, 9.09796, 0.367879]),
  ('regression: dengue-like', (0.7, 0.4, 0.6, 2, 0.14, 0.12, 8), [5.3605, 2.315275, 0.382893]),
  ('control: no mosquitoes', (0.3, 0.5, 0.5, 0, 0.01, 0.1, 10), [0.0, 0.0, 0.367879]),
  ('control: invalid mu', (0.3, 0.5, 0.5, 10, 0.01, 0.0, 10), None),
  ('regression: zero incubation', (0.5, 0.3, 0.3, 5, 0.1, 0.2, 0), [5.625, 2.371708, 1.0]),
  ('regression: long lived mosquitoes',
   (0.25, 0.6, 0.4, 20, 0.02, 0.05, 12),
   [164.643491, 12.831348, 0.548812]),
  ('regression: low bite rate', (0.1, 0.9, 0.9, 50, 0.05, 0.15, 9), [13.998974, 3.74152, 0.25924])],
 [('regression: malaria-like', (0.3, 0.5, 0.5, 10, 0.01, 0.1, 10), [82.772874, 9.09796, 0.367879]),
  ('regression: dengue-like', (0.7, 0.4, 0.6, 2, 0.14, 0.12, 8), [5.3605, 2.315275, 0.382893]),
  ('control: no mosquitoes', (0.3, 0.5, 0.5, 0, 0.01, 0.1, 10), [0.0, 0.0, 0.367879]),
  ('control: invalid mu', (0.3, 0.5, 0.5, 10, 0.01, 0.0, 10), None),
  ('regression: zero incubation', (0.5, 0.3, 0.3, 5, 0.1, 0.2, 0), [5.625, 2.371708, 1.0]),
  ('regression: long lived mosquitoes',
   (0.25, 0.6, 0.4, 20, 0.02, 0.05, 12),
   [164.643491, 12.831348, 0.548812]),
  ('regression: low bite rate', (0.1, 0.9, 0.9, 50, 0.05, 0.15, 9), [13.998974, 3.74152, 0.25924])],
 [('regression: malaria-like', (0.3, 0.5, 0.5, 10, 0.01, 0.1, 10), [82.772874, 9.09796, 0.367879]),
  ('regression: dengue-like', (0.7, 0.4, 0.6, 2, 0.14, 0.12, 8), [5.3605, 2.315275, 0.382893]),
  ('control: no mosquitoes', (0.3, 0.5, 0.5, 0, 0.01, 0.1, 10), [0.0, 0.0, 0.367879]),
  ('control: invalid mu', (0.3, 0.5, 0.5, 10, 0.01, 0.0, 10), None),
  ('regression: zero incubation', (0.5, 0.3, 0.3, 5, 0.1, 0.2, 0), [5.625, 2.371708, 1.0]),
  ('regression: long lived mosquitoes',
   (0.25, 0.6, 0.4, 20, 0.02, 0.05, 12),
   [164.643491, 12.831348, 0.548812]),
  ('regression: low bite rate', (0.1, 0.9, 0.9, 50, 0.05, 0.15, 9), [13.998974, 3.74152, 0.25924])],
 [('regression: malaria-like', (0.3, 0.5, 0.5, 10, 0.01, 0.1, 10), [82.772874, 9.09796, 0.367879]),
  ('regression: dengue-like', (0.7, 0.4, 0.6, 2, 0.14, 0.12, 8), [5.3605, 2.315275, 0.382893]),
  ('control: no mosquitoes', (0.3, 0.5, 0.5, 0, 0.01, 0.1, 10), [0.0, 0.0, 0.367879]),
  ('control: invalid mu', (0.3, 0.5, 0.5, 10, 0.01, 0.0, 10), None),
  ('regression: zero incubation', (0.5, 0.3, 0.3, 5, 0.1, 0.2, 0), [5.625, 2.371708, 1.0]),
  ('regression: long lived mosquitoes',
   (0.25, 0.6, 0.4, 20, 0.02, 0.05, 12),
   [164.643491, 12.831348, 0.548812]),
  ('regression: low bite rate', (0.1, 0.9, 0.9, 50, 0.05, 0.15, 9), [13.998974, 3.74152, 0.25924])],
 [('regression: malaria-like', (0.3, 0.5, 0.5, 10, 0.01, 0.1, 10), [82.772874, 9.09796, 0.367879]),
  ('regression: dengue-like', (0.7, 0.4, 0.6, 2, 0.14, 0.12, 8), [5.3605, 2.315275, 0.382893]),
  ('control: no mosquitoes', (0.3, 0.5, 0.5, 0, 0.01, 0.1, 10), [0.0, 0.0, 0.367879]),
  ('control: invalid mu', (0.3, 0.5, 0.5, 10, 0.01, 0.0, 10), None),
  ('regression: zero incubation', (0.5, 0.3, 0.3, 5, 0.1, 0.2, 0), [5.625, 2.371708, 1.0]),
  ('regression: long lived mosquitoes',
   (0.25, 0.6, 0.4, 20, 0.02, 0.05, 12),
   [164.643491, 12.831348, 0.548812]),
  ('regression: low bite rate', (0.1, 0.9, 0.9, 50, 0.05, 0.15, 9), [13.998974, 3.74152, 0.25924])]]
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: malaria-like[82.772874, 6.433229, 0.367879][82.772874, 9.09796, 0.367879]Failed
regression: dengue-like[5.3605, 1.637147, 0.382893][5.3605, 2.315275, 0.382893]Failed
control: no mosquitoes[0.0, 0.0, 0.367879][0.0, 0.0, 0.367879]Passed
control: invalid muNoneNonePassed
regression: zero incubation[5.625, 1.677051, 1.0][5.625, 2.371708, 1.0]Failed
regression: long lived mosquitoes[164.643491, 9.073133, 0.548812][164.643491, 12.831348, 0.548812]Failed
regression: low bite rate[13.998974, 2.645654, 0.25924][13.998974, 3.74152, 0.25924]Failed

SHA-256 / c20851836d7ea605e825d101786d2e8f3cc0465f00759d196f904a8af63460ce

3 / The verified repair

Exit 0
"""Failure Map reference implementation. Python standard library only."""
import json
import math
N = 1
observations = []
def solve(a, b, c, m, r, mu, n_days):
    if min(a, r, mu) <= 0 or m < 0:
        return None
    survive = math.exp(-mu * n_days)
    r0 = m * a * a * b * c * survive / (r * mu)
    return [round(r0, 6), round(math.sqrt(r0), 6), round(survive, 6)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: malaria-like', (0.3, 0.5, 0.5, 10, 0.01, 0.1, 10), [82.772874, 9.09796, 0.367879]),
  ('regression: dengue-like', (0.7, 0.4, 0.6, 2, 0.14, 0.12, 8), [5.3605, 2.315275, 0.382893]),
  ('control: no mosquitoes', (0.3, 0.5, 0.5, 0, 0.01, 0.1, 10), [0.0, 0.0, 0.367879]),
  ('control: invalid mu', (0.3, 0.5, 0.5, 10, 0.01, 0.0, 10), None),
  ('regression: zero incubation', (0.5, 0.3, 0.3, 5, 0.1, 0.2, 0), [5.625, 2.371708, 1.0]),
  ('regression: long lived mosquitoes',
   (0.25, 0.6, 0.4, 20, 0.02, 0.05, 12),
   [164.643491, 12.831348, 0.548812]),
  ('regression: low bite rate', (0.1, 0.9, 0.9, 50, 0.05, 0.15, 9), [13.998974, 3.74152, 0.25924])],
 [('regression: malaria-like', (0.3, 0.5, 0.5, 10, 0.01, 0.1, 10), [82.772874, 9.09796, 0.367879]),
  ('regression: dengue-like', (0.7, 0.4, 0.6, 2, 0.14, 0.12, 8), [5.3605, 2.315275, 0.382893]),
  ('control: no mosquitoes', (0.3, 0.5, 0.5, 0, 0.01, 0.1, 10), [0.0, 0.0, 0.367879]),
  ('control: invalid mu', (0.3, 0.5, 0.5, 10, 0.01, 0.0, 10), None),
  ('regression: zero incubation', (0.5, 0.3, 0.3, 5, 0.1, 0.2, 0), [5.625, 2.371708, 1.0]),
  ('regression: long lived mosquitoes',
   (0.25, 0.6, 0.4, 20, 0.02, 0.05, 12),
   [164.643491, 12.831348, 0.548812]),
  ('regression: low bite rate', (0.1, 0.9, 0.9, 50, 0.05, 0.15, 9), [13.998974, 3.74152, 0.25924])],
 [('regression: malaria-like', (0.3, 0.5, 0.5, 10, 0.01, 0.1, 10), [82.772874, 9.09796, 0.367879]),
  ('regression: dengue-like', (0.7, 0.4, 0.6, 2, 0.14, 0.12, 8), [5.3605, 2.315275, 0.382893]),
  ('control: no mosquitoes', (0.3, 0.5, 0.5, 0, 0.01, 0.1, 10), [0.0, 0.0, 0.367879]),
  ('control: invalid mu', (0.3, 0.5, 0.5, 10, 0.01, 0.0, 10), None),
  ('regression: zero incubation', (0.5, 0.3, 0.3, 5, 0.1, 0.2, 0), [5.625, 2.371708, 1.0]),
  ('regression: long lived mosquitoes',
   (0.25, 0.6, 0.4, 20, 0.02, 0.05, 12),
   [164.643491, 12.831348, 0.548812]),
  ('regression: low bite rate', (0.1, 0.9, 0.9, 50, 0.05, 0.15, 9), [13.998974, 3.74152, 0.25924])],
 [('regression: malaria-like', (0.3, 0.5, 0.5, 10, 0.01, 0.1, 10), [82.772874, 9.09796, 0.367879]),
  ('regression: dengue-like', (0.7, 0.4, 0.6, 2, 0.14, 0.12, 8), [5.3605, 2.315275, 0.382893]),
  ('control: no mosquitoes', (0.3, 0.5, 0.5, 0, 0.01, 0.1, 10), [0.0, 0.0, 0.367879]),
  ('control: invalid mu', (0.3, 0.5, 0.5, 10, 0.01, 0.0, 10), None),
  ('regression: zero incubation', (0.5, 0.3, 0.3, 5, 0.1, 0.2, 0), [5.625, 2.371708, 1.0]),
  ('regression: long lived mosquitoes',
   (0.25, 0.6, 0.4, 20, 0.02, 0.05, 12),
   [164.643491, 12.831348, 0.548812]),
  ('regression: low bite rate', (0.1, 0.9, 0.9, 50, 0.05, 0.15, 9), [13.998974, 3.74152, 0.25924])],
 [('regression: malaria-like', (0.3, 0.5, 0.5, 10, 0.01, 0.1, 10), [82.772874, 9.09796, 0.367879]),
  ('regression: dengue-like', (0.7, 0.4, 0.6, 2, 0.14, 0.12, 8), [5.3605, 2.315275, 0.382893]),
  ('control: no mosquitoes', (0.3, 0.5, 0.5, 0, 0.01, 0.1, 10), [0.0, 0.0, 0.367879]),
  ('control: invalid mu', (0.3, 0.5, 0.5, 10, 0.01, 0.0, 10), None),
  ('regression: zero incubation', (0.5, 0.3, 0.3, 5, 0.1, 0.2, 0), [5.625, 2.371708, 1.0]),
  ('regression: long lived mosquitoes',
   (0.25, 0.6, 0.4, 20, 0.02, 0.05, 12),
   [164.643491, 12.831348, 0.548812]),
  ('regression: low bite rate', (0.1, 0.9, 0.9, 50, 0.05, 0.15, 9), [13.998974, 3.74152, 0.25924])]]
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: malaria-like[82.772874, 9.09796, 0.367879][82.772874, 9.09796, 0.367879]Passed
regression: dengue-like[5.3605, 2.315275, 0.382893][5.3605, 2.315275, 0.382893]Passed
control: no mosquitoes[0.0, 0.0, 0.367879][0.0, 0.0, 0.367879]Passed
control: invalid muNoneNonePassed
regression: zero incubation[5.625, 2.371708, 1.0][5.625, 2.371708, 1.0]Passed
regression: long lived mosquitoes[164.643491, 12.831348, 0.548812][164.643491, 12.831348, 0.548812]Passed
regression: low bite rate[13.998974, 3.74152, 0.25924][13.998974, 3.74152, 0.25924]Passed

SHA-256 / 1dad2825de955aa92caaf1b7c5dd2722806f5c1a911e67b01950e377fe3d9a4a

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:32.781288+00:00.

Case digest / 25b7a718abd4375428812a1f380f90fc5e4d7cf719f6cf2a4e5553c3e5c85833