FAILURE MAP
← Case archive

FA-86946 / Physics integrator stability / Open access

Critical step divides by k*w without the square root · case 01

Stiffness changes the substep quadratically wrong, overshooting or wasting substeps.

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

ROOT CAUSE

omega is taken as k*w instead of sqrt(k*w).

VERIFIED REPAIR

Natural frequency is the square root of stiffness times inverse mass.

Unsuccessful approach: sqrt(k/w) inverts the mass dependency.

Case contract

solve(springs, safety, dt_frame, max_sub): springs are [k, inv_mass_a, inv_mass_b] (inverse mass 0 = static). A spring with k>0 and nonzero summed inverse mass w limits the substep to safety*2/sqrt(k*w). n=ceil(dt_frame/h_min) clamped to [1,max_sub]; return [n, dt_frame/n rounded to 6, whether n had to be clamped down]. No limiting spring gives [1, dt_frame, False].

Why this case matters

Game and robotics physics loops depend on integrator update order, step control and stabilization terms; a wrong decision point turns a stable simulation into drifting or exploding motion.

1 / The failure

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
import math
N = 1
observations = []
def solve(springs, safety, dt_frame, max_sub):
    hc = None
    for k, im1, im2 in springs:
        w = im1 + im2
        if w == 0 or k <= 0:
            continue
        h = safety * 2.0 / (k * w)
        if hc is None or h < hc:
            hc = h
    if hc is None:
        return [1, round(dt_frame, 6), False]
    n = math.ceil(dt_frame / hc - 1e-12)
    clamped = n > max_sub
    n = min(max(n, 1), max_sub)
    return [n, round(dt_frame / n, 6), clamped]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[[[[[217.3, 0.0, 0.272], [226.4, 1.256, 1.506], [86.4, 1.936, 1.121]], 0.8, 0.1, 7], [2, 0.05, False]], [[[[39.9, 0.852, 0.112]], 0.9, 0.03333333333333333, 8], [1, 0.033333, False]], [[[[176.6, 0.318, 1.727]], 0.9, 0.1, 1], [1, 0.1, True]], [[[[1.7, 0.0, 0.738], [238.1, 1.296, 1.984], [33.2, 1.635, 0.592], [264.5, 0.289, 1.887]], 0.8, 0.016666666666666666, 12], [1, 0.016667, False]], [[[[0.0, 1.613, 0.892], [187.4, 0.0, 0.0]], 0.9, 0.1, 6], [1, 0.1, False]], [[[[172.3, 1.054, 0.0]], 0.5, 0.1, 12], [2, 0.05, False]], [[[[0.0, 0.378, 0.0]], 0.9, 0.05, 4], [1, 0.05, False]], [[[[309.6, 0.307, 0.0]], 0.5, 0.1, 5], [1, 0.1, False]]], [[[[[97.9, 0.409, 0.102], [187.1, 0.0, 1.876], [175.5, 0.772, 1.165]], 0.9, 0.1, 3], [2, 0.05, False]], [[[[22.5, 0.986, 1.718]], 0.8, 0.05, 7], [1, 0.05, False]], [[[[0.0, 0.986, 0.215]], 0.5, 0.05, 5], [1, 0.05, False]], [[[[393.1, 0.372, 0.831]], 0.8, 0.03333333333333333, 1], [1, 0.033333, False]], [[[[192.5, 0.226, 1.644], [299.3, 0.0, 0.204]], 0.8, 0.016666666666666666, 4], [1, 0.016667, False]], [[[[10.3, 1.659, 0.0], [7.1, 0.0, 1.581], [0.0, 1.971, 0.816], [57.3, 0.4, 0.0]], 0.8, 0.016666666666666666, 12], [1, 0.016667, False]], [[[[176.2, 1.797, 1.825], [298.2, 0.526, 0.891], [118.3, 0.227, 0.0]], 0.5, 0.1, 2], [2, 0.05, True]], [[[[35.3, 1.054, 0.0], [371.9, 1.288, 1.017]], 0.8, 0.1, 5], [2, 0.05, False]]], [[[[[0.0, 0.686, 0.27]], 0.9, 0.05, 11], [1, 0.05, False]], [[[[36.1, 0.0, 0.765], [178.8, 1.201, 1.609], [361.7, 0.0, 0.24]], 0.8, 0.1, 12], [2, 0.05, False]], [[[[241.8, 1.076, 1.735], [150.9, 0.0, 0.0]], 0.8, 0.05, 2], [1, 0.05, False]], [[[[120.7, 0.983, 1.303]], 0.9, 0.1, 9], [1, 0.1, False]], [[[[0.0, 0.0, 0.245]], 0.8, 0.1, 6], [1, 0.1, False]], [[[[0.0, 1.763, 0.721]], 0.8, 0.1, 11], [1, 0.1, False]], [[[[219.4, 0.47, 0.357], [244.7, 1.869, 0.0], [206.2, 0.734, 1.4]], 0.9, 0.1, 8], [2, 0.05, False]], [[[[146.1, 0.0, 0.0], [0.0, 1.802, 0.0], [153.6, 0.0, 0.95]], 0.9, 0.1, 3], [1, 0.1, False]]], [[[[[218.1, 0.0, 0.251], [45.1, 0.422, 1.694]], 0.8, 0.1, 7], [1, 0.1, False]], [[[[11.5, 1.12, 0.0]], 0.8, 0.03333333333333333, 8], [1, 0.033333, False]], [[[[0.0, 0.0, 0.55]], 0.5, 0.03333333333333333, 3], [1, 0.033333, False]], [[[[30.9, 0.794, 0.198], [0.0, 0.658, 0.0], [398.0, 1.934, 0.424]], 0.8, 0.1, 12], [2, 0.05, False]], [[[[313.6, 0.0, 0.0], [0.0, 0.166, 0.299], [211.1, 1.062, 1.481]], 0.5, 0.1, 11], [3, 0.033333, False]], [[[[20.9, 0.0, 0.0], [250.8, 0.0, 0.0]], 0.9, 0.05, 10], [1, 0.05, False]], [[[[98.3, 1.017, 0.0]], 0.5, 0.016666666666666666, 8], [1, 0.016667, False]], [[[[295.6, 1.379, 0.496], [26.1, 1.99, 1.706], [6.0, 1.103, 1.549]], 0.8, 0.1, 10], [2, 0.05, False]]], [[[[[383.1, 0.0, 0.0], [50.5, 1.823, 0.0], [34.7, 0.0, 0.14]], 0.5, 0.03333333333333333, 7], [1, 0.033333, False]], [[[[247.4, 0.0, 0.0]], 0.9, 0.016666666666666666, 5], [1, 0.016667, False]], [[[[186.8, 1.54, 0.646], [294.8, 1.37, 0.598], [270.5, 0.161, 0.0], [31.5, 0.51, 0.753]], 0.9, 0.1, 4], [2, 0.05, False]], [[[[60.2, 0.0, 0.0]], 0.8, 0.05, 1], [1, 0.05, False]], [[[[373.0, 1.043, 1.229], [318.1, 0.0, 1.235], [6.5, 0.12, 0.231]], 0.5, 0.05, 5], [2, 0.025, False]], [[[[63.8, 0.303, 0.866]], 0.8, 0.016666666666666666, 8], [1, 0.016667, False]], [[[[0.0, 0.0, 1.739], [342.6, 0.191, 0.489], [366.4, 0.0, 1.184]], 0.5, 0.016666666666666666, 11], [1, 0.016667, False]], [[[[70.2, 1.762, 1.247], [340.8, 0.0, 1.231]], 0.9, 0.1, 12], [2, 0.05, False]]]]
for i, (args, expected) in enumerate(fixtures[N-1]):
    check("case %d" % i, 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
case 0[7, 0.014286, True][2, 0.05, False]Failed
case 1[1, 0.033333, False][1, 0.033333, False]Passed
case 2[1, 0.1, True][1, 0.1, True]Passed
case 3[9, 0.001852, False][1, 0.016667, False]Failed
case 4[1, 0.1, False][1, 0.1, False]Passed
case 5[12, 0.008333, True][2, 0.05, False]Failed
case 6[1, 0.05, False][1, 0.05, False]Passed
case 7[5, 0.02, True][1, 0.1, False]Failed

SHA-256 / 32900e2a7d8ea637b1e697dbe5c29158cbb868ad01b2c06850530e4fd818503a

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
import math
N = 1
observations = []
def solve(springs, safety, dt_frame, max_sub):
    hc = None
    for k, im1, im2 in springs:
        w = im1 + im2
        if w == 0 or k <= 0:
            continue
        h = safety * 2.0 / math.sqrt(k / w)
        if hc is None or h < hc:
            hc = h
    if hc is None:
        return [1, round(dt_frame, 6), False]
    n = math.ceil(dt_frame / hc - 1e-12)
    clamped = n > max_sub
    n = min(max(n, 1), max_sub)
    return [n, round(dt_frame / n, 6), clamped]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[[[[[217.3, 0.0, 0.272], [226.4, 1.256, 1.506], [86.4, 1.936, 1.121]], 0.8, 0.1, 7], [2, 0.05, False]], [[[[39.9, 0.852, 0.112]], 0.9, 0.03333333333333333, 8], [1, 0.033333, False]], [[[[176.6, 0.318, 1.727]], 0.9, 0.1, 1], [1, 0.1, True]], [[[[1.7, 0.0, 0.738], [238.1, 1.296, 1.984], [33.2, 1.635, 0.592], [264.5, 0.289, 1.887]], 0.8, 0.016666666666666666, 12], [1, 0.016667, False]], [[[[0.0, 1.613, 0.892], [187.4, 0.0, 0.0]], 0.9, 0.1, 6], [1, 0.1, False]], [[[[172.3, 1.054, 0.0]], 0.5, 0.1, 12], [2, 0.05, False]], [[[[0.0, 0.378, 0.0]], 0.9, 0.05, 4], [1, 0.05, False]], [[[[309.6, 0.307, 0.0]], 0.5, 0.1, 5], [1, 0.1, False]]], [[[[[97.9, 0.409, 0.102], [187.1, 0.0, 1.876], [175.5, 0.772, 1.165]], 0.9, 0.1, 3], [2, 0.05, False]], [[[[22.5, 0.986, 1.718]], 0.8, 0.05, 7], [1, 0.05, False]], [[[[0.0, 0.986, 0.215]], 0.5, 0.05, 5], [1, 0.05, False]], [[[[393.1, 0.372, 0.831]], 0.8, 0.03333333333333333, 1], [1, 0.033333, False]], [[[[192.5, 0.226, 1.644], [299.3, 0.0, 0.204]], 0.8, 0.016666666666666666, 4], [1, 0.016667, False]], [[[[10.3, 1.659, 0.0], [7.1, 0.0, 1.581], [0.0, 1.971, 0.816], [57.3, 0.4, 0.0]], 0.8, 0.016666666666666666, 12], [1, 0.016667, False]], [[[[176.2, 1.797, 1.825], [298.2, 0.526, 0.891], [118.3, 0.227, 0.0]], 0.5, 0.1, 2], [2, 0.05, True]], [[[[35.3, 1.054, 0.0], [371.9, 1.288, 1.017]], 0.8, 0.1, 5], [2, 0.05, False]]], [[[[[0.0, 0.686, 0.27]], 0.9, 0.05, 11], [1, 0.05, False]], [[[[36.1, 0.0, 0.765], [178.8, 1.201, 1.609], [361.7, 0.0, 0.24]], 0.8, 0.1, 12], [2, 0.05, False]], [[[[241.8, 1.076, 1.735], [150.9, 0.0, 0.0]], 0.8, 0.05, 2], [1, 0.05, False]], [[[[120.7, 0.983, 1.303]], 0.9, 0.1, 9], [1, 0.1, False]], [[[[0.0, 0.0, 0.245]], 0.8, 0.1, 6], [1, 0.1, False]], [[[[0.0, 1.763, 0.721]], 0.8, 0.1, 11], [1, 0.1, False]], [[[[219.4, 0.47, 0.357], [244.7, 1.869, 0.0], [206.2, 0.734, 1.4]], 0.9, 0.1, 8], [2, 0.05, False]], [[[[146.1, 0.0, 0.0], [0.0, 1.802, 0.0], [153.6, 0.0, 0.95]], 0.9, 0.1, 3], [1, 0.1, False]]], [[[[[218.1, 0.0, 0.251], [45.1, 0.422, 1.694]], 0.8, 0.1, 7], [1, 0.1, False]], [[[[11.5, 1.12, 0.0]], 0.8, 0.03333333333333333, 8], [1, 0.033333, False]], [[[[0.0, 0.0, 0.55]], 0.5, 0.03333333333333333, 3], [1, 0.033333, False]], [[[[30.9, 0.794, 0.198], [0.0, 0.658, 0.0], [398.0, 1.934, 0.424]], 0.8, 0.1, 12], [2, 0.05, False]], [[[[313.6, 0.0, 0.0], [0.0, 0.166, 0.299], [211.1, 1.062, 1.481]], 0.5, 0.1, 11], [3, 0.033333, False]], [[[[20.9, 0.0, 0.0], [250.8, 0.0, 0.0]], 0.9, 0.05, 10], [1, 0.05, False]], [[[[98.3, 1.017, 0.0]], 0.5, 0.016666666666666666, 8], [1, 0.016667, False]], [[[[295.6, 1.379, 0.496], [26.1, 1.99, 1.706], [6.0, 1.103, 1.549]], 0.8, 0.1, 10], [2, 0.05, False]]], [[[[[383.1, 0.0, 0.0], [50.5, 1.823, 0.0], [34.7, 0.0, 0.14]], 0.5, 0.03333333333333333, 7], [1, 0.033333, False]], [[[[247.4, 0.0, 0.0]], 0.9, 0.016666666666666666, 5], [1, 0.016667, False]], [[[[186.8, 1.54, 0.646], [294.8, 1.37, 0.598], [270.5, 0.161, 0.0], [31.5, 0.51, 0.753]], 0.9, 0.1, 4], [2, 0.05, False]], [[[[60.2, 0.0, 0.0]], 0.8, 0.05, 1], [1, 0.05, False]], [[[[373.0, 1.043, 1.229], [318.1, 0.0, 1.235], [6.5, 0.12, 0.231]], 0.5, 0.05, 5], [2, 0.025, False]], [[[[63.8, 0.303, 0.866]], 0.8, 0.016666666666666666, 8], [1, 0.016667, False]], [[[[0.0, 0.0, 1.739], [342.6, 0.191, 0.489], [366.4, 0.0, 1.184]], 0.5, 0.016666666666666666, 11], [1, 0.016667, False]], [[[[70.2, 1.762, 1.247], [340.8, 0.0, 1.231]], 0.9, 0.1, 12], [2, 0.05, False]]]]
for i, (args, expected) in enumerate(fixtures[N-1]):
    check("case %d" % i, 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
case 0[2, 0.05, False][2, 0.05, False]Passed
case 1[1, 0.033333, False][1, 0.033333, False]Passed
case 2[1, 0.1, False][1, 0.1, True]Failed
case 3[1, 0.016667, False][1, 0.016667, False]Passed
case 4[1, 0.1, False][1, 0.1, False]Passed
case 5[2, 0.05, False][2, 0.05, False]Passed
case 6[1, 0.05, False][1, 0.05, False]Passed
case 7[4, 0.025, False][1, 0.1, False]Failed

SHA-256 / ef22550d3647c8735b40eed9903a37528707e37fb5da72d0686a717ff4579da7

3 / The verified repair

Exit 0
"""Failure Map reference implementation. Python standard library only."""
import json
import math
N = 1
observations = []
def solve(springs, safety, dt_frame, max_sub):
    hc = None
    for k, im1, im2 in springs:
        w = im1 + im2
        if w == 0 or k <= 0:
            continue
        h = safety * 2.0 / math.sqrt(k * w)
        if hc is None or h < hc:
            hc = h
    if hc is None:
        return [1, round(dt_frame, 6), False]
    n = math.ceil(dt_frame / hc - 1e-12)
    clamped = n > max_sub
    n = min(max(n, 1), max_sub)
    return [n, round(dt_frame / n, 6), clamped]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[[[[[217.3, 0.0, 0.272], [226.4, 1.256, 1.506], [86.4, 1.936, 1.121]], 0.8, 0.1, 7], [2, 0.05, False]], [[[[39.9, 0.852, 0.112]], 0.9, 0.03333333333333333, 8], [1, 0.033333, False]], [[[[176.6, 0.318, 1.727]], 0.9, 0.1, 1], [1, 0.1, True]], [[[[1.7, 0.0, 0.738], [238.1, 1.296, 1.984], [33.2, 1.635, 0.592], [264.5, 0.289, 1.887]], 0.8, 0.016666666666666666, 12], [1, 0.016667, False]], [[[[0.0, 1.613, 0.892], [187.4, 0.0, 0.0]], 0.9, 0.1, 6], [1, 0.1, False]], [[[[172.3, 1.054, 0.0]], 0.5, 0.1, 12], [2, 0.05, False]], [[[[0.0, 0.378, 0.0]], 0.9, 0.05, 4], [1, 0.05, False]], [[[[309.6, 0.307, 0.0]], 0.5, 0.1, 5], [1, 0.1, False]]], [[[[[97.9, 0.409, 0.102], [187.1, 0.0, 1.876], [175.5, 0.772, 1.165]], 0.9, 0.1, 3], [2, 0.05, False]], [[[[22.5, 0.986, 1.718]], 0.8, 0.05, 7], [1, 0.05, False]], [[[[0.0, 0.986, 0.215]], 0.5, 0.05, 5], [1, 0.05, False]], [[[[393.1, 0.372, 0.831]], 0.8, 0.03333333333333333, 1], [1, 0.033333, False]], [[[[192.5, 0.226, 1.644], [299.3, 0.0, 0.204]], 0.8, 0.016666666666666666, 4], [1, 0.016667, False]], [[[[10.3, 1.659, 0.0], [7.1, 0.0, 1.581], [0.0, 1.971, 0.816], [57.3, 0.4, 0.0]], 0.8, 0.016666666666666666, 12], [1, 0.016667, False]], [[[[176.2, 1.797, 1.825], [298.2, 0.526, 0.891], [118.3, 0.227, 0.0]], 0.5, 0.1, 2], [2, 0.05, True]], [[[[35.3, 1.054, 0.0], [371.9, 1.288, 1.017]], 0.8, 0.1, 5], [2, 0.05, False]]], [[[[[0.0, 0.686, 0.27]], 0.9, 0.05, 11], [1, 0.05, False]], [[[[36.1, 0.0, 0.765], [178.8, 1.201, 1.609], [361.7, 0.0, 0.24]], 0.8, 0.1, 12], [2, 0.05, False]], [[[[241.8, 1.076, 1.735], [150.9, 0.0, 0.0]], 0.8, 0.05, 2], [1, 0.05, False]], [[[[120.7, 0.983, 1.303]], 0.9, 0.1, 9], [1, 0.1, False]], [[[[0.0, 0.0, 0.245]], 0.8, 0.1, 6], [1, 0.1, False]], [[[[0.0, 1.763, 0.721]], 0.8, 0.1, 11], [1, 0.1, False]], [[[[219.4, 0.47, 0.357], [244.7, 1.869, 0.0], [206.2, 0.734, 1.4]], 0.9, 0.1, 8], [2, 0.05, False]], [[[[146.1, 0.0, 0.0], [0.0, 1.802, 0.0], [153.6, 0.0, 0.95]], 0.9, 0.1, 3], [1, 0.1, False]]], [[[[[218.1, 0.0, 0.251], [45.1, 0.422, 1.694]], 0.8, 0.1, 7], [1, 0.1, False]], [[[[11.5, 1.12, 0.0]], 0.8, 0.03333333333333333, 8], [1, 0.033333, False]], [[[[0.0, 0.0, 0.55]], 0.5, 0.03333333333333333, 3], [1, 0.033333, False]], [[[[30.9, 0.794, 0.198], [0.0, 0.658, 0.0], [398.0, 1.934, 0.424]], 0.8, 0.1, 12], [2, 0.05, False]], [[[[313.6, 0.0, 0.0], [0.0, 0.166, 0.299], [211.1, 1.062, 1.481]], 0.5, 0.1, 11], [3, 0.033333, False]], [[[[20.9, 0.0, 0.0], [250.8, 0.0, 0.0]], 0.9, 0.05, 10], [1, 0.05, False]], [[[[98.3, 1.017, 0.0]], 0.5, 0.016666666666666666, 8], [1, 0.016667, False]], [[[[295.6, 1.379, 0.496], [26.1, 1.99, 1.706], [6.0, 1.103, 1.549]], 0.8, 0.1, 10], [2, 0.05, False]]], [[[[[383.1, 0.0, 0.0], [50.5, 1.823, 0.0], [34.7, 0.0, 0.14]], 0.5, 0.03333333333333333, 7], [1, 0.033333, False]], [[[[247.4, 0.0, 0.0]], 0.9, 0.016666666666666666, 5], [1, 0.016667, False]], [[[[186.8, 1.54, 0.646], [294.8, 1.37, 0.598], [270.5, 0.161, 0.0], [31.5, 0.51, 0.753]], 0.9, 0.1, 4], [2, 0.05, False]], [[[[60.2, 0.0, 0.0]], 0.8, 0.05, 1], [1, 0.05, False]], [[[[373.0, 1.043, 1.229], [318.1, 0.0, 1.235], [6.5, 0.12, 0.231]], 0.5, 0.05, 5], [2, 0.025, False]], [[[[63.8, 0.303, 0.866]], 0.8, 0.016666666666666666, 8], [1, 0.016667, False]], [[[[0.0, 0.0, 1.739], [342.6, 0.191, 0.489], [366.4, 0.0, 1.184]], 0.5, 0.016666666666666666, 11], [1, 0.016667, False]], [[[[70.2, 1.762, 1.247], [340.8, 0.0, 1.231]], 0.9, 0.1, 12], [2, 0.05, False]]]]
for i, (args, expected) in enumerate(fixtures[N-1]):
    check("case %d" % i, 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
case 0[2, 0.05, False][2, 0.05, False]Passed
case 1[1, 0.033333, False][1, 0.033333, False]Passed
case 2[1, 0.1, True][1, 0.1, True]Passed
case 3[1, 0.016667, False][1, 0.016667, False]Passed
case 4[1, 0.1, False][1, 0.1, False]Passed
case 5[2, 0.05, False][2, 0.05, False]Passed
case 6[1, 0.05, False][1, 0.05, False]Passed
case 7[1, 0.1, False][1, 0.1, False]Passed

SHA-256 / 820271f90da241a911a8dc100aecef46f106bba12fa22c6da6eab7fe3e4382b7

Verification & scope

A deterministic bounded teaching model with stipulated toy conventions and rounded float output; not a production physics engine or a proof of numerical stability. 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:50:54.119900+00:00.

Case digest / ab4868ac5d16a0fba7e5998fde3ea9ab8ba272baed1c8016dac2821428c302ba