FA-87011 / Physics integrator stability / Open access
RK4 fourth stage advances only half a step · case 01
End-of-step slope is evaluated at the midpoint and trajectories drift.
ROOT CAUSE
Stage four offsets the state by dt/2*k3.
THE FAILURE
Stage four offsets the state by dt/2*k3.
Unsuccessful approach: Using k2 for the full-step offset still skips the third slope.
Case contract
solve(x0, v0, k, c, F, wf, dt, steps): unit mass x''=-k*x-c*v+F*cos(wf*t) with wf in rad/s, t starting at 0, integrated with classical RK4. Return [x, v, t] rounded to 6.
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(x0, v0, k, c, F, wf, dt, steps):
def f(t, x, v):
return v, -k * x - c * v + F * math.cos(wf * t)
t = 0.0
x, v = x0, v0
for _ in range(steps):
k1x, k1v = f(t, x, v)
k2x, k2v = f(t + dt / 2, x + dt / 2 * k1x, v + dt / 2 * k1v)
k3x, k3v = f(t + dt / 2, x + dt / 2 * k2x, v + dt / 2 * k2v)
k4x, k4v = f(t + dt, x + dt / 2 * k3x, v + dt / 2 * k3v)
x = x + dt / 6 * (k1x + 2 * k2x + 2 * k3x + k4x)
v = v + dt / 6 * (k1v + 2 * k2v + 2 * k3v + k4v)
t = t + dt
return [round(x, 6), round(v, 6), round(t, 6)]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[[[0.037, 0.015, 18.944, 1.217, 0.336, 4.094, 0.05, 4], [0.032666, -0.056271, 0.2]], [[0.206, 0.096, 17.287, 0.284, 1.767, 2.847, 0.2, 1], [0.188435, -0.265686, 0.2]], [[0.039, -0.882, 11.673, 0.399, 0.713, 4.233, 0.2, 3], [-0.180777, 0.214002, 0.6]], [[0.477, 0.804, 9.463, 0.795, 0.343, 4.866, 0.2, 1], [0.539279, -0.178827, 0.2]], [[0.105, 0.838, 4.023, 1.065, 0.405, 4.968, 0.1, 5], [0.358254, 0.08841, 0.5]], [[0.594, 0.724, 5.574, 1.414, 0.54, 2.544, 0.2, 5], [0.050911, -1.000788, 1.0]], [[0.446, 0.832, 18.463, 0.804, 0.621, 3.458, 0.2, 3], [-0.159312, -1.479617, 0.6]], [[-0.109, -0.682, 16.643, 0.151, 1.208, 3.199, 0.05, 3], [-0.171504, -0.13078, 0.15]]], [[[0.35, 0.024, 2.459, 0.489, 1.678, 3.184, 0.2, 2], [0.401172, 0.137673, 0.4]], [[-0.032, 0.808, 18.227, 0.749, 0.437, 3.703, 0.1, 1], [0.04836, 0.775101, 0.1]], [[-0.017, 0.68, 3.032, 0.837, 0.432, 2.962, 0.05, 8], [0.225745, 0.477143, 0.4]], [[-0.926, 0.952, 5.429, 0.55, 1.365, 4.948, 0.2, 1], [-0.633361, 1.884933, 0.2]], [[-0.492, -0.144, 14.57, 1.424, 1.521, 1.605, 0.05, 3], [-0.421761, 1.012157, 0.15]], [[-0.137, -0.776, 8.235, 0.284, 1.595, 3.405, 0.05, 6], [-0.227382, 0.158148, 0.3]], [[0.5, 0.334, 18.653, 0.323, 1.653, 1.344, 0.2, 5], [-0.182262, 1.108817, 1.0]], [[-0.609, 0.599, 6.838, 1.12, 1.471, 2.154, 0.05, 4], [-0.404509, 1.365726, 0.2]]], [[[-0.297, 0.781, 2.001, 0.064, 0.974, 2.016, 0.1, 3], [-0.004067, 1.132644, 0.3]], [[-0.053, 0.994, 12.808, 0.487, 1.8, 1.164, 0.05, 5], [0.220226, 1.039905, 0.25]], [[-0.394, 0.849, 18.783, 1.27, 1.837, 1.788, 0.1, 10], [0.047492, -1.406422, 1.0]], [[-0.571, 0.019, 10.668, 1.333, 0.813, 4.88, 0.1, 10], [0.238859, -0.217571, 1.0]], [[0.94, -0.296, 5.863, 0.108, 0.67, 1.998, 0.05, 5], [0.725524, -1.365674, 0.25]], [[-0.82, -0.452, 6.501, 0.489, 1.04, 2.64, 0.1, 8], [0.231149, 1.692755, 0.8]], [[-0.367, -0.476, 6.934, 1.115, 0.351, 2.009, 0.05, 5], [-0.383984, 0.306397, 0.25]], [[0.156, -0.808, 12.089, 0.635, 0.926, 3.013, 0.05, 7], [-0.092465, -0.474045, 0.35]]], [[[-0.772, 0.752, 2.823, 0.497, 1.621, 2.92, 0.1, 6], [0.065151, 1.550767, 0.6]], [[-0.484, -0.908, 18.372, 0.481, 1.964, 2.315, 0.2, 2], [-0.051507, 2.343495, 0.4]], [[-0.198, -0.028, 4.048, 0.079, 1.642, 1.588, 0.2, 8], [0.361524, -1.100738, 1.6]], [[0.532, 0.956, 10.77, 1.064, 0.812, 2.846, 0.1, 4], [0.457971, -1.147408, 0.4]], [[-0.77, 0.902, 10.411, 0.846, 1.693, 1.454, 0.2, 1], [-0.438766, 2.258811, 0.2]], [[-0.442, 0.797, 6.557, 1.401, 1.795, 3.756, 0.1, 9], [0.25065, -0.396817, 0.9]], [[-0.481, 0.589, 9.513, 0.453, 0.932, 1.014, 0.1, 7], [0.468153, 0.929769, 0.7]], [[-0.93, -0.587, 15.161, 1.124, 1.467, 0.594, 0.1, 3], [-0.486864, 2.987903, 0.3]]], [[[-0.341, 0.921, 14.484, 0.78, 0.993, 4.954, 0.1, 11], [-0.092121, -0.961694, 1.1]], [[0.467, -0.477, 3.323, 0.374, 1.738, 2.046, 0.2, 1], [0.380232, -0.387088, 0.2]], [[0.059, -0.427, 15.895, 0.474, 0.892, 1.849, 0.1, 12], [0.043332, -0.18688, 1.2]], [[0.48, 0.991, 13.504, 0.938, 1.754, 1.99, 0.2, 8], [-0.112907, 0.598276, 1.6]], [[-0.653, 0.301, 2.747, 0.362, 0.302, 3.513, 0.1, 2], [-0.555676, 0.656608, 0.2]], [[0.639, -0.671, 17.636, 0.056, 1.617, 0.878, 0.05, 4], [0.339327, -2.145523, 0.2]], [[0.96, 0.368, 6.136, 0.868, 0.713, 4.277, 0.1, 13], [-0.632372, -0.226167, 1.3]], [[-0.795, -0.597, 18.803, 1.441, 1.505, 2.357, 0.2, 13], [0.139932, -0.532797, 2.6]]]]
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.032906, -0.057294, 0.2] | [0.032666, -0.056271, 0.2] | Failed |
| case 1 | [0.194057, -0.273314, 0.2] | [0.188435, -0.265686, 0.2] | Failed |
| case 2 | [-0.203225, 0.236543, 0.6] | [-0.180777, 0.214002, 0.6] | Failed |
| case 3 | [0.555078, -0.182519, 0.2] | [0.539279, -0.178827, 0.2] | Failed |
| case 4 | [0.36479, 0.085174, 0.5] | [0.358254, 0.08841, 0.5] | Failed |
| case 5 | [0.041954, -1.078154, 1.0] | [0.050911, -1.000788, 1.0] | Failed |
| case 6 | [-0.175884, -1.76739, 0.6] | [-0.159312, -1.479617, 0.6] | Failed |
| case 7 | [-0.173985, -0.132768, 0.15] | [-0.171504, -0.13078, 0.15] | Failed |
SHA-256 / 62da6bcdd12d93832ae42755116d663bde9ea1f45d34a8d4bb05d2ade3e9ee3e
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
import math
N = 1
observations = []
def solve(x0, v0, k, c, F, wf, dt, steps):
def f(t, x, v):
return v, -k * x - c * v + F * math.cos(wf * t)
t = 0.0
x, v = x0, v0
for _ in range(steps):
k1x, k1v = f(t, x, v)
k2x, k2v = f(t + dt / 2, x + dt / 2 * k1x, v + dt / 2 * k1v)
k3x, k3v = f(t + dt / 2, x + dt / 2 * k2x, v + dt / 2 * k2v)
k4x, k4v = f(t + dt, x + dt * k2x, v + dt * k2v)
x = x + dt / 6 * (k1x + 2 * k2x + 2 * k3x + k4x)
v = v + dt / 6 * (k1v + 2 * k2v + 2 * k3v + k4v)
t = t + dt
return [round(x, 6), round(v, 6), round(t, 6)]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[[[0.037, 0.015, 18.944, 1.217, 0.336, 4.094, 0.05, 4], [0.032666, -0.056271, 0.2]], [[0.206, 0.096, 17.287, 0.284, 1.767, 2.847, 0.2, 1], [0.188435, -0.265686, 0.2]], [[0.039, -0.882, 11.673, 0.399, 0.713, 4.233, 0.2, 3], [-0.180777, 0.214002, 0.6]], [[0.477, 0.804, 9.463, 0.795, 0.343, 4.866, 0.2, 1], [0.539279, -0.178827, 0.2]], [[0.105, 0.838, 4.023, 1.065, 0.405, 4.968, 0.1, 5], [0.358254, 0.08841, 0.5]], [[0.594, 0.724, 5.574, 1.414, 0.54, 2.544, 0.2, 5], [0.050911, -1.000788, 1.0]], [[0.446, 0.832, 18.463, 0.804, 0.621, 3.458, 0.2, 3], [-0.159312, -1.479617, 0.6]], [[-0.109, -0.682, 16.643, 0.151, 1.208, 3.199, 0.05, 3], [-0.171504, -0.13078, 0.15]]], [[[0.35, 0.024, 2.459, 0.489, 1.678, 3.184, 0.2, 2], [0.401172, 0.137673, 0.4]], [[-0.032, 0.808, 18.227, 0.749, 0.437, 3.703, 0.1, 1], [0.04836, 0.775101, 0.1]], [[-0.017, 0.68, 3.032, 0.837, 0.432, 2.962, 0.05, 8], [0.225745, 0.477143, 0.4]], [[-0.926, 0.952, 5.429, 0.55, 1.365, 4.948, 0.2, 1], [-0.633361, 1.884933, 0.2]], [[-0.492, -0.144, 14.57, 1.424, 1.521, 1.605, 0.05, 3], [-0.421761, 1.012157, 0.15]], [[-0.137, -0.776, 8.235, 0.284, 1.595, 3.405, 0.05, 6], [-0.227382, 0.158148, 0.3]], [[0.5, 0.334, 18.653, 0.323, 1.653, 1.344, 0.2, 5], [-0.182262, 1.108817, 1.0]], [[-0.609, 0.599, 6.838, 1.12, 1.471, 2.154, 0.05, 4], [-0.404509, 1.365726, 0.2]]], [[[-0.297, 0.781, 2.001, 0.064, 0.974, 2.016, 0.1, 3], [-0.004067, 1.132644, 0.3]], [[-0.053, 0.994, 12.808, 0.487, 1.8, 1.164, 0.05, 5], [0.220226, 1.039905, 0.25]], [[-0.394, 0.849, 18.783, 1.27, 1.837, 1.788, 0.1, 10], [0.047492, -1.406422, 1.0]], [[-0.571, 0.019, 10.668, 1.333, 0.813, 4.88, 0.1, 10], [0.238859, -0.217571, 1.0]], [[0.94, -0.296, 5.863, 0.108, 0.67, 1.998, 0.05, 5], [0.725524, -1.365674, 0.25]], [[-0.82, -0.452, 6.501, 0.489, 1.04, 2.64, 0.1, 8], [0.231149, 1.692755, 0.8]], [[-0.367, -0.476, 6.934, 1.115, 0.351, 2.009, 0.05, 5], [-0.383984, 0.306397, 0.25]], [[0.156, -0.808, 12.089, 0.635, 0.926, 3.013, 0.05, 7], [-0.092465, -0.474045, 0.35]]], [[[-0.772, 0.752, 2.823, 0.497, 1.621, 2.92, 0.1, 6], [0.065151, 1.550767, 0.6]], [[-0.484, -0.908, 18.372, 0.481, 1.964, 2.315, 0.2, 2], [-0.051507, 2.343495, 0.4]], [[-0.198, -0.028, 4.048, 0.079, 1.642, 1.588, 0.2, 8], [0.361524, -1.100738, 1.6]], [[0.532, 0.956, 10.77, 1.064, 0.812, 2.846, 0.1, 4], [0.457971, -1.147408, 0.4]], [[-0.77, 0.902, 10.411, 0.846, 1.693, 1.454, 0.2, 1], [-0.438766, 2.258811, 0.2]], [[-0.442, 0.797, 6.557, 1.401, 1.795, 3.756, 0.1, 9], [0.25065, -0.396817, 0.9]], [[-0.481, 0.589, 9.513, 0.453, 0.932, 1.014, 0.1, 7], [0.468153, 0.929769, 0.7]], [[-0.93, -0.587, 15.161, 1.124, 1.467, 0.594, 0.1, 3], [-0.486864, 2.987903, 0.3]]], [[[-0.341, 0.921, 14.484, 0.78, 0.993, 4.954, 0.1, 11], [-0.092121, -0.961694, 1.1]], [[0.467, -0.477, 3.323, 0.374, 1.738, 2.046, 0.2, 1], [0.380232, -0.387088, 0.2]], [[0.059, -0.427, 15.895, 0.474, 0.892, 1.849, 0.1, 12], [0.043332, -0.18688, 1.2]], [[0.48, 0.991, 13.504, 0.938, 1.754, 1.99, 0.2, 8], [-0.112907, 0.598276, 1.6]], [[-0.653, 0.301, 2.747, 0.362, 0.302, 3.513, 0.1, 2], [-0.555676, 0.656608, 0.2]], [[0.639, -0.671, 17.636, 0.056, 1.617, 0.878, 0.05, 4], [0.339327, -2.145523, 0.2]], [[0.96, 0.368, 6.136, 0.868, 0.713, 4.277, 0.1, 13], [-0.632372, -0.226167, 1.3]], [[-0.795, -0.597, 18.803, 1.441, 1.505, 2.357, 0.2, 13], [0.139932, -0.532797, 2.6]]]]
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.03266, -0.056251, 0.2] | [0.032666, -0.056271, 0.2] | Failed |
| case 1 | [0.186301, -0.267216, 0.2] | [0.188435, -0.265686, 0.2] | Failed |
| case 2 | [-0.17546, 0.208594, 0.6] | [-0.180777, 0.214002, 0.6] | Failed |
| case 3 | [0.536023, -0.178877, 0.2] | [0.539279, -0.178827, 0.2] | Failed |
| case 4 | [0.358094, 0.08852, 0.5] | [0.358254, 0.08841, 0.5] | Failed |
| case 5 | [0.053002, -0.994687, 1.0] | [0.050911, -1.000788, 1.0] | Failed |
| case 6 | [-0.160144, -1.36537, 0.6] | [-0.159312, -1.479617, 0.6] | Failed |
| case 7 | [-0.171453, -0.130734, 0.15] | [-0.171504, -0.13078, 0.15] | Failed |
SHA-256 / 22b2622ddac803103f06fc526a63d0ac309eeee2e3c955d0f65ddff6535f4160
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:54.724071+00:00.
Case digest / 4152183010459aac02d070deaea78b48efa5bf605e5a13cd45bb860fa459ba51