FA-87041 / Physics integrator stability / Open access
Adaptive integrator propagates the low-order Euler solution · case 01
The error estimate refers to Heun but the state follows Euler, so accuracy is worse than tol suggests.
ROOT CAUSE
Accepted steps set y = y_low.
THE FAILURE
Accepted steps set y = y_low.
Unsuccessful approach: Averaging the two solutions is a different, unestimated scheme.
Case contract
solve(y0, lam, s, t_end, dt0, tol): integrate y'=-lam*y+s to t_end with the embedded Euler/Heun pair. err=|y_heun-y_euler|/max(1,|y|) at the step start. Accept if err<=tol (propagate Heun); grow h by min(2, 0.9*(tol/err)^(1/2)) (2 when err=0); on reject shrink by max(0.2, 0.9*(tol/err)^(1/2)). Steps are clipped to t_end; at most 500 attempts. Return [y, accepted, rejected, last h] rounded.
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(y0, lam, s, t_end, dt0, tol):
def f(y):
return -lam * y + s
t, y, h = 0.0, y0, dt0
acc = rej = 0
while t < t_end - 1e-12 and acc + rej < 500:
h = min(h, t_end - t)
k1 = f(y)
k2 = f(y + h * k1)
y_low = y + h * k1
y_high = y + h / 2 * (k1 + k2)
err = abs(y_high - y_low) / max(1.0, abs(y))
if err <= tol:
t += h
y = y_low
acc += 1
grow = 2.0 if err == 0 else min(2.0, 0.9 * (tol / err) ** 0.5)
h = h * grow
else:
rej += 1
h = h * max(0.2, 0.9 * (tol / err) ** 0.5)
return [round(y, 6), acc, rej, round(h, 6)]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[[[1.277, 4.761, -1.617, 0.5, 0.1, 0.0001], [-0.190065, 140, 3, 0.006855]], [[1.689, 0.0, 0.476, 0.5, 0.3, 0.001], [1.927, 2, 0, 0.4]], [[-2.45, 3.377, -1.852, 2.0, 0.05, 0.01], [-0.552205, 23, 1, 0.101538]], [[2.009, 1.907, -1.617, 0.5, 0.3, 0.01], [0.255071, 10, 1, 0.029016]], [[-0.514, 2.551, -1.015, 1.0, 0.05, 0.01], [-0.408549, 7, 0, 0.073483]], [[1.301, 0.0, 1.346, 0.5, 0.1, 0.0001], [1.974, 3, 0, 0.4]], [[-0.603, 0.0, 1.691, 2.0, 0.1, 0.0001], [2.779, 5, 0, 1.0]], [[-0.952, 1.695, -1.777, 2.0, 0.3, 0.01], [-1.043824, 6, 1, 0.806875]]], [[[-0.876, 0.0, -0.17, 0.5, 0.05, 0.0001], [-0.961, 4, 0, 0.3]], [[-1.169, 4.728, 0.065, 1.0, 0.3, 0.0001], [0.003263, 158, 3, 0.025334]], [[0.997, 1.294, 1.309, 1.0, 0.7, 0.01], [1.006534, 2, 0, 0.6]], [[-2.941, 2.957, -1.527, 1.0, 0.05, 0.01], [-0.64488, 17, 0, 0.107018]], [[-0.207, 3.318, -0.298, 1.0, 0.05, 0.001], [-0.094257, 16, 1, 0.151659]], [[-2.326, 4.308, 0.769, 2.0, 0.7, 0.0001], [0.178032, 236, 4, 0.069889]], [[-2.2, 0.0, -0.933, 1.0, 0.3, 0.001], [-3.133, 3, 0, 0.2]], [[2.431, 0.0, 0.71, 1.0, 0.1, 0.01], [3.141, 4, 0, 0.6]]], [[[-2.618, 0.0, -1.013, 1.0, 0.1, 0.001], [-3.631, 4, 0, 0.6]], [[0.01, 4.331, -0.279, 1.5, 0.1, 0.0001], [-0.064291, 46, 2, 0.145024]], [[0.299, 2.489, -1.677, 0.5, 0.3, 0.001], [-0.393348, 24, 2, 0.029906]], [[1.267, 2.693, -0.039, 0.5, 0.7, 0.0001], [0.318914, 87, 3, 0.008112]], [[0.28, 0.0, -0.418, 0.5, 0.3, 0.01], [0.071, 2, 0, 0.4]], [[-2.605, 4.58, 1.505, 0.5, 0.1, 0.01], [0.029147, 18, 1, 0.021233]], [[-1.057, 1.633, -1.528, 1.5, 0.3, 0.0001], [-0.946197, 41, 2, 0.02163]], [[-2.296, 0.0, -1.609, 1.5, 0.3, 0.001], [-4.7095, 3, 0, 1.2]]], [[[0.741, 0.0, 1.287, 1.5, 0.1, 0.001], [2.6715, 4, 0, 1.6]], [[-1.416, 3.263, -0.863, 0.5, 0.05, 0.0001], [-0.489781, 93, 2, 0.002341]], [[-2.5, 0.0, 0.727, 1.0, 0.05, 0.0001], [-1.773, 5, 0, 0.5]], [[-0.815, 0.978, -0.497, 0.5, 0.3, 0.001], [-0.696428, 7, 1, 0.050506]], [[-2.519, 0.0, 1.258, 2.0, 0.1, 0.01], [-0.003, 5, 0, 1.0]], [[2.242, 1.044, -1.112, 2.0, 0.3, 0.001], [-0.655028, 56, 2, 0.058769]], [[-0.984, 1.04, -1.056, 1.5, 0.1, 0.001], [-1.008638, 7, 0, 0.200496]], [[-1.45, 1.621, 1.381, 1.0, 0.7, 0.001], [0.396634, 43, 3, 0.003956]]], [[[-1.375, 1.447, 0.137, 2.0, 0.7, 0.01], [0.011153, 17, 2, 0.010327]], [[-0.509, 0.0, 1.966, 1.5, 0.3, 0.001], [2.44, 3, 0, 1.2]], [[-1.681, 0.0, -1.23, 0.5, 0.1, 0.0001], [-2.296, 3, 0, 0.4]], [[-0.023, 1.232, 1.762, 1.5, 0.3, 0.001], [1.201016, 38, 2, 0.019925]], [[-2.792, 3.052, 0.797, 2.0, 0.3, 0.001], [0.254108, 79, 2, 0.135662]], [[-0.195, 0.0, -1.909, 2.0, 0.1, 0.001], [-4.013, 5, 0, 1.0]], [[2.86, 0.478, 0.373, 1.0, 0.7, 0.0001], [2.069798, 31, 2, 0.033635]], [[1.902, 0.0, 1.399, 0.5, 0.1, 0.001], [2.6015, 3, 0, 0.4]]]]
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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| case 0 | [-0.193496, 140, 3, 0.000617] | [-0.190065, 140, 3, 0.006855] | Failed |
| case 1 | [1.927, 2, 0, 0.4] | [1.927, 2, 0, 0.4] | Passed |
| case 2 | [-0.548171, 21, 1, 0.299551] | [-0.552205, 23, 1, 0.101538] | Failed |
| case 3 | [0.197157, 10, 1, 0.024348] | [0.255071, 10, 1, 0.029016] | Failed |
| case 4 | [-0.400745, 6, 0, 0.504839] | [-0.408549, 7, 0, 0.073483] | Failed |
| case 5 | [1.974, 3, 0, 0.4] | [1.974, 3, 0, 0.4] | Passed |
| case 6 | [2.779, 5, 0, 1.0] | [2.779, 5, 0, 1.0] | Passed |
| case 7 | [-1.048489, 6, 1, 0.356455] | [-1.043824, 6, 1, 0.806875] | Failed |
SHA-256 / 75b3b23fd965b5e6cf7283a788341162be9dc19a9ddc2ea44ec2d71af8f9fbc6
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
import math
N = 1
observations = []
def solve(y0, lam, s, t_end, dt0, tol):
def f(y):
return -lam * y + s
t, y, h = 0.0, y0, dt0
acc = rej = 0
while t < t_end - 1e-12 and acc + rej < 500:
h = min(h, t_end - t)
k1 = f(y)
k2 = f(y + h * k1)
y_low = y + h * k1
y_high = y + h / 2 * (k1 + k2)
err = abs(y_high - y_low) / max(1.0, abs(y))
if err <= tol:
t += h
y = (y_low + y_high) / 2
acc += 1
grow = 2.0 if err == 0 else min(2.0, 0.9 * (tol / err) ** 0.5)
h = h * grow
else:
rej += 1
h = h * max(0.2, 0.9 * (tol / err) ** 0.5)
return [round(y, 6), acc, rej, round(h, 6)]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[[[1.277, 4.761, -1.617, 0.5, 0.1, 0.0001], [-0.190065, 140, 3, 0.006855]], [[1.689, 0.0, 0.476, 0.5, 0.3, 0.001], [1.927, 2, 0, 0.4]], [[-2.45, 3.377, -1.852, 2.0, 0.05, 0.01], [-0.552205, 23, 1, 0.101538]], [[2.009, 1.907, -1.617, 0.5, 0.3, 0.01], [0.255071, 10, 1, 0.029016]], [[-0.514, 2.551, -1.015, 1.0, 0.05, 0.01], [-0.408549, 7, 0, 0.073483]], [[1.301, 0.0, 1.346, 0.5, 0.1, 0.0001], [1.974, 3, 0, 0.4]], [[-0.603, 0.0, 1.691, 2.0, 0.1, 0.0001], [2.779, 5, 0, 1.0]], [[-0.952, 1.695, -1.777, 2.0, 0.3, 0.01], [-1.043824, 6, 1, 0.806875]]], [[[-0.876, 0.0, -0.17, 0.5, 0.05, 0.0001], [-0.961, 4, 0, 0.3]], [[-1.169, 4.728, 0.065, 1.0, 0.3, 0.0001], [0.003263, 158, 3, 0.025334]], [[0.997, 1.294, 1.309, 1.0, 0.7, 0.01], [1.006534, 2, 0, 0.6]], [[-2.941, 2.957, -1.527, 1.0, 0.05, 0.01], [-0.64488, 17, 0, 0.107018]], [[-0.207, 3.318, -0.298, 1.0, 0.05, 0.001], [-0.094257, 16, 1, 0.151659]], [[-2.326, 4.308, 0.769, 2.0, 0.7, 0.0001], [0.178032, 236, 4, 0.069889]], [[-2.2, 0.0, -0.933, 1.0, 0.3, 0.001], [-3.133, 3, 0, 0.2]], [[2.431, 0.0, 0.71, 1.0, 0.1, 0.01], [3.141, 4, 0, 0.6]]], [[[-2.618, 0.0, -1.013, 1.0, 0.1, 0.001], [-3.631, 4, 0, 0.6]], [[0.01, 4.331, -0.279, 1.5, 0.1, 0.0001], [-0.064291, 46, 2, 0.145024]], [[0.299, 2.489, -1.677, 0.5, 0.3, 0.001], [-0.393348, 24, 2, 0.029906]], [[1.267, 2.693, -0.039, 0.5, 0.7, 0.0001], [0.318914, 87, 3, 0.008112]], [[0.28, 0.0, -0.418, 0.5, 0.3, 0.01], [0.071, 2, 0, 0.4]], [[-2.605, 4.58, 1.505, 0.5, 0.1, 0.01], [0.029147, 18, 1, 0.021233]], [[-1.057, 1.633, -1.528, 1.5, 0.3, 0.0001], [-0.946197, 41, 2, 0.02163]], [[-2.296, 0.0, -1.609, 1.5, 0.3, 0.001], [-4.7095, 3, 0, 1.2]]], [[[0.741, 0.0, 1.287, 1.5, 0.1, 0.001], [2.6715, 4, 0, 1.6]], [[-1.416, 3.263, -0.863, 0.5, 0.05, 0.0001], [-0.489781, 93, 2, 0.002341]], [[-2.5, 0.0, 0.727, 1.0, 0.05, 0.0001], [-1.773, 5, 0, 0.5]], [[-0.815, 0.978, -0.497, 0.5, 0.3, 0.001], [-0.696428, 7, 1, 0.050506]], [[-2.519, 0.0, 1.258, 2.0, 0.1, 0.01], [-0.003, 5, 0, 1.0]], [[2.242, 1.044, -1.112, 2.0, 0.3, 0.001], [-0.655028, 56, 2, 0.058769]], [[-0.984, 1.04, -1.056, 1.5, 0.1, 0.001], [-1.008638, 7, 0, 0.200496]], [[-1.45, 1.621, 1.381, 1.0, 0.7, 0.001], [0.396634, 43, 3, 0.003956]]], [[[-1.375, 1.447, 0.137, 2.0, 0.7, 0.01], [0.011153, 17, 2, 0.010327]], [[-0.509, 0.0, 1.966, 1.5, 0.3, 0.001], [2.44, 3, 0, 1.2]], [[-1.681, 0.0, -1.23, 0.5, 0.1, 0.0001], [-2.296, 3, 0, 0.4]], [[-0.023, 1.232, 1.762, 1.5, 0.3, 0.001], [1.201016, 38, 2, 0.019925]], [[-2.792, 3.052, 0.797, 2.0, 0.3, 0.001], [0.254108, 79, 2, 0.135662]], [[-0.195, 0.0, -1.909, 2.0, 0.1, 0.001], [-4.013, 5, 0, 1.0]], [[2.86, 0.478, 0.373, 1.0, 0.7, 0.0001], [2.069798, 31, 2, 0.033635]], [[1.902, 0.0, 1.399, 0.5, 0.1, 0.001], [2.6015, 3, 0, 0.4]]]]
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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| case 0 | [-0.191779, 140, 3, 0.003854] | [-0.190065, 140, 3, 0.006855] | Failed |
| case 1 | [1.927, 2, 0, 0.4] | [1.927, 2, 0, 0.4] | Passed |
| case 2 | [-0.549118, 22, 1, 0.164561] | [-0.552205, 23, 1, 0.101538] | Failed |
| case 3 | [0.225905, 10, 1, 0.027216] | [0.255071, 10, 1, 0.029016] | Failed |
| case 4 | [-0.403859, 7, 0, 0.000236] | [-0.408549, 7, 0, 0.073483] | Failed |
| case 5 | [1.974, 3, 0, 0.4] | [1.974, 3, 0, 0.4] | Passed |
| case 6 | [2.779, 5, 0, 1.0] | [2.779, 5, 0, 1.0] | Passed |
| case 7 | [-1.046733, 6, 1, 0.609566] | [-1.043824, 6, 1, 0.806875] | Failed |
SHA-256 / 2e08b63a983ab5785cbedea4ab7a718e7d4570c675fdb9a43e036728fd6de399
HELD IN THE MEMBER ARCHIVE
The verified repair and its recorded checks are member-only.
This mechanism has 8 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
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:55.111169+00:00.
Case digest / 1d14a6f75a2c0ccea974d69da8efd45d2820a872ac4be6f894e1807145e69a89