FAILURE MAP
← Case archive

FA-65036 / Epidemic compartment models / Open access

Final epidemic size by bisection: root side test · case 01

Bisection converges to the trivial root and reports no epidemic.

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

ROOT CAUSE

The sign test that keeps the positive root in the bracket is reversed.

THE FAILURE

The sign test that keeps the positive root in the bracket is reversed.

Unsuccessful approach: Dropping R0 from the exponent solves the R0=1 equation.

Case contract

Attack fraction z is the positive root of z = 1-exp(-R0*z) found by bisection on (1e-9, 1] until the bracket is narrower than tol; for R0<=1 return [0.0, 0, 0.0]; return [z rounded 6, round(z*pop), overshoot z-(1-1/R0) rounded 6].

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(r0, pop, tol):
    if r0 <= 1:
        return [0.0, 0, 0.0]
    lo, hi = 1e-9, 1.0
    for _ in range(200):
        mid = (lo + hi) / 2
        if mid - (1 - math.exp(-r0 * mid)) > 0:
            lo = mid
        else:
            hi = mid
        if hi - lo < tol:
            break
    z = (lo + hi) / 2
    return [round(z, 6), round(z * pop), round(z - (1 - 1 / r0), 6)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: flu-like R0 1.5', (1.5, 10000, 1e-12), [0.582812, 5828, 0.249478]),
  ('regression: measles-like R0 12', (12.0, 1000, 1e-12), [0.999994, 1000, 0.083327]),
  ('regression: R0 2', (2.0, 5000, 1e-12), [0.796812, 3984, 0.296812]),
  ('regression: near threshold 1.05', (1.05, 100000, 1e-12), [0.093702, 9370, 0.046083]),
  ('control: boundary R0 exactly 1', (1.0, 1000, 1e-12), [0.0, 0, 0.0]),
  ('control: subcritical 0.8', (0.8, 1000, 1e-12), [0.0, 0, 0.0]),
  ('control: subcritical 0.5', (0.5, 100, 1e-12), [0.0, 0, 0.0])],
 [('regression: near threshold 1.05', (1.05, 100000, 1e-12), [0.093702, 9370, 0.046083]),
  ('control: boundary R0 exactly 1', (1.0, 1000, 1e-12), [0.0, 0, 0.0]),
  ('control: subcritical 0.8', (0.8, 1000, 1e-12), [0.0, 0, 0.0]),
  ('regression: coarse tolerance', (2.5, 1000, 0.0001), [0.89267, 893, 0.29267]),
  ('regression: R0 3 small town', (3.0, 777, 1e-12), [0.94048, 731, 0.273813]),
  ('regression: R0 1.2 mid city', (1.2, 250000, 1e-10), [0.313698, 78425, 0.147032]),
  ('control: subcritical 0.5', (0.5, 100, 1e-12), [0.0, 0, 0.0])],
 [('regression: flu-like R0 1.5', (1.5, 10000, 1e-12), [0.582812, 5828, 0.249478]),
  ('control: boundary R0 exactly 1', (1.0, 1000, 1e-12), [0.0, 0, 0.0]),
  ('control: subcritical 0.8', (0.8, 1000, 1e-12), [0.0, 0, 0.0]),
  ('regression: coarse tolerance', (2.5, 1000, 0.0001), [0.89267, 893, 0.29267]),
  ('regression: R0 3 small town', (3.0, 777, 1e-12), [0.94048, 731, 0.273813]),
  ('regression: R0 1.2 mid city', (1.2, 250000, 1e-10), [0.313698, 78425, 0.147032]),
  ('control: subcritical 0.5', (0.5, 100, 1e-12), [0.0, 0, 0.0])],
 [('regression: flu-like R0 1.5', (1.5, 10000, 1e-12), [0.582812, 5828, 0.249478]),
  ('regression: measles-like R0 12', (12.0, 1000, 1e-12), [0.999994, 1000, 0.083327]),
  ('regression: R0 2', (2.0, 5000, 1e-12), [0.796812, 3984, 0.296812]),
  ('regression: near threshold 1.05', (1.05, 100000, 1e-12), [0.093702, 9370, 0.046083]),
  ('control: boundary R0 exactly 1', (1.0, 1000, 1e-12), [0.0, 0, 0.0]),
  ('control: subcritical 0.8', (0.8, 1000, 1e-12), [0.0, 0, 0.0]),
  ('control: subcritical 0.5', (0.5, 100, 1e-12), [0.0, 0, 0.0])],
 [('regression: R0 2', (2.0, 5000, 1e-12), [0.796812, 3984, 0.296812]),
  ('regression: near threshold 1.05', (1.05, 100000, 1e-12), [0.093702, 9370, 0.046083]),
  ('control: boundary R0 exactly 1', (1.0, 1000, 1e-12), [0.0, 0, 0.0]),
  ('control: subcritical 0.8', (0.8, 1000, 1e-12), [0.0, 0, 0.0]),
  ('regression: coarse tolerance', (2.5, 1000, 0.0001), [0.89267, 893, 0.29267]),
  ('regression: R0 3 small town', (3.0, 777, 1e-12), [0.94048, 731, 0.273813]),
  ('control: subcritical 0.5', (0.5, 100, 1e-12), [0.0, 0, 0.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: flu-like R0 1.5[0.0, 0, -0.333333][0.582812, 5828, 0.249478]Failed
regression: measles-like R0 12[0.0, 0, -0.916667][0.999994, 1000, 0.083327]Failed
regression: R0 2[0.0, 0, -0.5][0.796812, 3984, 0.296812]Failed
regression: near threshold 1.05[1.0, 100000, 0.952381][0.093702, 9370, 0.046083]Failed
control: boundary R0 exactly 1[0.0, 0, 0.0][0.0, 0, 0.0]Passed
control: subcritical 0.8[0.0, 0, 0.0][0.0, 0, 0.0]Passed
control: subcritical 0.5[0.0, 0, 0.0][0.0, 0, 0.0]Passed

SHA-256 / 1b9b7591beef23efcc034157bc3996381ed3f68b431a2bfdff92df9b30b9cc25

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
import math
N = 1
observations = []
def solve(r0, pop, tol):
    if r0 <= 1:
        return [0.0, 0, 0.0]
    lo, hi = 1e-9, 1.0
    for _ in range(200):
        mid = (lo + hi) / 2
        if mid - (1 - math.exp(-mid)) < 0:
            lo = mid
        else:
            hi = mid
        if hi - lo < tol:
            break
    z = (lo + hi) / 2
    return [round(z, 6), round(z * pop), round(z - (1 - 1 / r0), 6)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: flu-like R0 1.5', (1.5, 10000, 1e-12), [0.582812, 5828, 0.249478]),
  ('regression: measles-like R0 12', (12.0, 1000, 1e-12), [0.999994, 1000, 0.083327]),
  ('regression: R0 2', (2.0, 5000, 1e-12), [0.796812, 3984, 0.296812]),
  ('regression: near threshold 1.05', (1.05, 100000, 1e-12), [0.093702, 9370, 0.046083]),
  ('control: boundary R0 exactly 1', (1.0, 1000, 1e-12), [0.0, 0, 0.0]),
  ('control: subcritical 0.8', (0.8, 1000, 1e-12), [0.0, 0, 0.0]),
  ('control: subcritical 0.5', (0.5, 100, 1e-12), [0.0, 0, 0.0])],
 [('regression: near threshold 1.05', (1.05, 100000, 1e-12), [0.093702, 9370, 0.046083]),
  ('control: boundary R0 exactly 1', (1.0, 1000, 1e-12), [0.0, 0, 0.0]),
  ('control: subcritical 0.8', (0.8, 1000, 1e-12), [0.0, 0, 0.0]),
  ('regression: coarse tolerance', (2.5, 1000, 0.0001), [0.89267, 893, 0.29267]),
  ('regression: R0 3 small town', (3.0, 777, 1e-12), [0.94048, 731, 0.273813]),
  ('regression: R0 1.2 mid city', (1.2, 250000, 1e-10), [0.313698, 78425, 0.147032]),
  ('control: subcritical 0.5', (0.5, 100, 1e-12), [0.0, 0, 0.0])],
 [('regression: flu-like R0 1.5', (1.5, 10000, 1e-12), [0.582812, 5828, 0.249478]),
  ('control: boundary R0 exactly 1', (1.0, 1000, 1e-12), [0.0, 0, 0.0]),
  ('control: subcritical 0.8', (0.8, 1000, 1e-12), [0.0, 0, 0.0]),
  ('regression: coarse tolerance', (2.5, 1000, 0.0001), [0.89267, 893, 0.29267]),
  ('regression: R0 3 small town', (3.0, 777, 1e-12), [0.94048, 731, 0.273813]),
  ('regression: R0 1.2 mid city', (1.2, 250000, 1e-10), [0.313698, 78425, 0.147032]),
  ('control: subcritical 0.5', (0.5, 100, 1e-12), [0.0, 0, 0.0])],
 [('regression: flu-like R0 1.5', (1.5, 10000, 1e-12), [0.582812, 5828, 0.249478]),
  ('regression: measles-like R0 12', (12.0, 1000, 1e-12), [0.999994, 1000, 0.083327]),
  ('regression: R0 2', (2.0, 5000, 1e-12), [0.796812, 3984, 0.296812]),
  ('regression: near threshold 1.05', (1.05, 100000, 1e-12), [0.093702, 9370, 0.046083]),
  ('control: boundary R0 exactly 1', (1.0, 1000, 1e-12), [0.0, 0, 0.0]),
  ('control: subcritical 0.8', (0.8, 1000, 1e-12), [0.0, 0, 0.0]),
  ('control: subcritical 0.5', (0.5, 100, 1e-12), [0.0, 0, 0.0])],
 [('regression: R0 2', (2.0, 5000, 1e-12), [0.796812, 3984, 0.296812]),
  ('regression: near threshold 1.05', (1.05, 100000, 1e-12), [0.093702, 9370, 0.046083]),
  ('control: boundary R0 exactly 1', (1.0, 1000, 1e-12), [0.0, 0, 0.0]),
  ('control: subcritical 0.8', (0.8, 1000, 1e-12), [0.0, 0, 0.0]),
  ('regression: coarse tolerance', (2.5, 1000, 0.0001), [0.89267, 893, 0.29267]),
  ('regression: R0 3 small town', (3.0, 777, 1e-12), [0.94048, 731, 0.273813]),
  ('control: subcritical 0.5', (0.5, 100, 1e-12), [0.0, 0, 0.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: flu-like R0 1.5[0.0, 0, -0.333333][0.582812, 5828, 0.249478]Failed
regression: measles-like R0 12[0.0, 0, -0.916667][0.999994, 1000, 0.083327]Failed
regression: R0 2[0.0, 0, -0.5][0.796812, 3984, 0.296812]Failed
regression: near threshold 1.05[0.0, 0, -0.047619][0.093702, 9370, 0.046083]Failed
control: boundary R0 exactly 1[0.0, 0, 0.0][0.0, 0, 0.0]Passed
control: subcritical 0.8[0.0, 0, 0.0][0.0, 0, 0.0]Passed
control: subcritical 0.5[0.0, 0, 0.0][0.0, 0, 0.0]Passed

SHA-256 / a7bba1980049a1e5c7f9769bdaee15ec3ebb455316258d286f3e58b8b3edc1b1

HELD IN THE MEMBER ARCHIVE

The verified repair and its recorded checks are member-only.

This mechanism has 7 recorded checks per implementation. The open-access tier publishes the failure and the unsuccessful fix; the repaired source that passes every check, and the observations that prove it, are available to members.

Every case sharing this mechanism uses the same contract and the same repair, so this one record is held back for all of them.

Member access is invitation-based. Sign in with your invited account to inspect the repair.

Sign in to the archive ↗

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

Case digest / ea38d4dda13368a89003cba40183785c599a5685ec4ebe552c7da05e17ca23e7