Does light charge the quons? › Files cited on the page › the trials

geared_gyrostat_check_k3_posthoc.py

In the investigation at sim/models_AB/geared_gyrostat_check_k3_posthoc.py · last changed in commit 68f79c6, 22 November 2026 · 2,065 bytes · runnable copies in the scripts zip


"""Post hoc (after trial 21's run; not part of the trial): trial 21's code check K3 with its equality test point corrected.

The committed script (geared_gyrostat.py, commit 47f4ccc) set the equality point as b = a K_A / K_B; the condition a K_B = b K_A
needs b = a K_B / K_A. This script repeats K3 with the same random draws (seed and order as far as K3 is concerned are not
reproduced: K3's draws come after Q1's in the trial's generator, so fresh draws are used) and the corrected point. It changes
nothing in the trial: trial 21's V1 stays withheld as its lock's rule requires, and this check is reported beside it.

The inequality it tests [D]: a differential gear dividing a rotation between two gyrostats of stiffness K_A and K_B with arms a and b
has K_eff = (a + b)^2 K_A K_B / (a^2 K_B + b^2 K_A), and (K_A + K_B)(a^2 K_B + b^2 K_A) - (a + b)^2 K_A K_B = (a K_B - b K_A)^2 >= 0,
so K_eff <= K_A + K_B, with equality at a K_B = b K_A.
"""
import subprocess
import numpy as np
head = subprocess.run(["git", "rev-parse", "HEAD"], capture_output=True, text=True, timeout=10).stdout.strip()
print("Post hoc check of trial 21's K3 (not part of the trial). git HEAD at run:", head)
rng = np.random.default_rng(20261122)
worst = 0.0; ok = True
for _ in range(100000):
    a, b, KA, KB = rng.uniform(0.1, 10, size=4)
    Keff = (a + b) ** 2 * KA * KB / (a ** 2 * KB + b ** 2 * KA)
    ok &= Keff <= KA + KB + 1e-9
    worst = max(worst, Keff / (KA + KB))
KA, KB, a = 1.3, 2.9, 1.7
b_committed = a * KA / KB; b_correct = a * KB / KA
f = lambda b: (a + b) ** 2 * KA * KB / (a ** 2 * KB + b ** 2 * KA) - (KA + KB)
print(f"  100000 random cases: K_eff <= K_A + K_B in all: {ok}; largest K_eff/(K_A + K_B) = {worst:.6f}")
print(f"  the committed equality point b = a K_A/K_B = {b_committed:.4f}: residual {f(b_committed):.4f} (not an equality point)")
print(f"  the corrected point b = a K_B/K_A = {b_correct:.4f}: residual {f(b_correct):.1e}")
print(f"  CHECK {'pass' if ok and abs(f(b_correct)) < 1e-9 else 'FAIL'}: K3 with the corrected equality point (post hoc)")