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

t27_homes_fixed.py

In the investigation at sim/m8_engine/t27_homes_fixed.py · last changed in commit a6dc9f2, 25 November 2026 · 5,493 bytes · runnable copies in the scripts zip


#!/usr/bin/env python3
"""Trial 27: trial 26's three faulty designs corrected (H1b, G1, G3), and G2 given a control. Lock: papers/Lock_c2_homes_fixed_2026-11-25.md,
committed with this script before the run. Designed after seeing trial 26's output: post hoc in design, locked before its own run.
Author seat (Claude Opus 5.5), 25 November 2026."""
import math
import subprocess
import sys
import time

import numpy as np

sys.path.insert(0, ".")
from engine import Lattice, curl_f2e, static_field_of, prony_frequencies  # noqa: E402
from gyro_band import GyroLattice  # noqa: E402

print("Trial 27: trial 26's faulty designs corrected. Lock: papers/Lock_c2_homes_fixed_2026-11-25.md")
print("git HEAD:", subprocess.run(["git", "rev-parse", "HEAD"], capture_output=True, text=True).stdout.strip())
t0 = time.time()
V = {}

print("\nH1b'. One rotor alone in a 96^3 box (its light does not come back before t = 90)")
N, D, dt = 96, 4, 0.1
wA, wp2 = 1.65 / D, 0.2
shape = (N, N, N)
occ = np.zeros((3, *shape)); s = (48, 48, 48)
occ[0][s] = 1; occ[1][s] = 1
lat = Lattice(shape, dt, wb2=wA**2, wp2=wp2, occ=occ)
lat.P[0][s] = 1e-3; lat.V[1][s] = wA * 1e-3
lat.E = static_field_of(lat.P)
es = []
for it in range(800):
    lat.step()
    es.append(0.5 * (lat.wb2 * (lat.P[0][s] ** 2 + lat.P[1][s] ** 2) + lat.V[0][s] ** 2 + lat.V[1][s] ** 2) / wp2)
es = np.array(es); t_ = (np.arange(800) + 1) * dt
early, late = es[(t_ >= 10) & (t_ < 25)].mean(), es[(t_ >= 65) & (t_ < 80)].mean()
loss = 1 - late / early
pred = 0.1246
V["H1b'"] = abs(loss / pred - 1) < 0.20
print(f"   means over t = 10 to 25 and 65 to 80: {early:.5e}, {late:.5e}; loss {loss:.4f}; predicted {pred} (t27_prep_out.txt)")
print(f"   H1b' (the loss within 20% of the prediction): {'PASS' if V[chr(72)+'1b'+chr(39)] else 'MISS'}")

h, A, dtg = 1 / 6, 1 / 36, 0.01
print("\nG1'. Variant G, small waves along an axis, the probe at x = 0 (no node for m = 1, 2, 3)")
G1 = []
for m in (1, 2, 3):
    Ng = 12
    shp = (Ng, 2, 2)
    g = GyroLattice(shp, h, A)
    kk = 2 * math.pi * m / Ng
    pos = np.stack(np.meshgrid(*[np.arange(q, dtype=float) for q in shp], indexing="ij"))
    g.phi[2] = 1e-5 * np.cos(kk * (pos[0] + 0.5))
    g.start_in_step()
    xs = []
    for _ in range(3000):
        g.step(dtg); xs.append(g.phi[2][0, 0, 0])
    w, _ = prony_frequencies(np.array(xs), dtg, 1)
    lam = 4 * math.sin(kk / 2) ** 2
    pr = math.sqrt(lam / (1 + A * lam))
    G1.append(abs(w[0] / pr - 1))
    print(f"   m = {m}: probe's starting value {1e-5*math.cos(kk*0.5):.2e}; run {w[0]:.7f}; law {pr:.7f}; plain band {math.sqrt(lam):.7f}; difference {G1[-1]:.1e}")
V["G1'"] = max(G1) < 1e-5
print(f"   G1' (within 1e-5): {'PASS' if V[chr(71)+'1'+chr(39)] else 'MISS'}")

print("\nG2'. One band slipped by 0.06, 10^3 cells: gyrostats against a plain lattice, the same averages")
Ng = 10
shp = (Ng, Ng, Ng)
s0 = 0.06
slip = np.zeros((3, *shp)); slip[0, 5, 5, 5] = s0
th_s = s0 * ((1 - 1 / Ng**3) / 3 + 1 / Ng**3)
t1 = math.pi * A / (2 * h * th_s)
g = GyroLattice(shp, h, A, slip=slip); g.start_in_step()
gc, gt = [], []
for it in range(int(4 * t1 / dtg) + 1):
    g.step(dtg)
    if it % 5 == 4:
        gc.append(g.couple()[0, 5, 5, 5]); gt.append(g.t)
pl = Lattice(shp, 0.05); pl.E = slip.copy()
pc, pt = [], []
for it in range(int(4 * t1 / 0.05) + 1):
    pl.step(); pc.append(pl.E[0, 5, 5, 5]); pt.append(pl.t)
gc, gt, pc, pt = map(np.array, (gc, gt, pc, pt))
print(f"   t1 = {t1:.3f}; window means of the slipped band's tension or couple, over the settled twist {th_s:.5f}; one gyrostat alone would give +0.900, +0.373, -0.637, -0.637, +0.637")
row = {}
for a, b in ((0, 0.5), (0.5, 1), (1, 2), (2, 3), (3, 4)):
    gm_ = gc[(gt >= a * t1) & (gt < b * t1)].mean() / th_s
    pm_ = pc[(pt >= a * t1) & (pt < b * t1)].mean() / th_s
    row[(a, b)] = (gm_, pm_)
    print(f"   t = {a} t1 to {b} t1: gyrostats {gm_:+.3f}; plain lattice {pm_:+.3f}")
V["G2'"] = row[(1, 2)][0] < 0 and row[(1, 2)][1] > 0.7
print(f"   G2' (over t1 to 2 t1: gyrostats below zero, plain lattice above 0.7): {'PASS' if V[chr(71)+'2'+chr(39)] else 'MISS'}")

print("\nG3'. Light's push on a gimbal, the band at x = 1 (no node)")
Ng, m = 12, 2
shp = (Ng, 2, 2)
kk = 2 * math.pi * m / Ng
lam = 4 * math.sin(kk / 2) ** 2
wv = math.sqrt(lam / (1 + A * lam))
amp_phi = 0.02
pos = np.stack(np.meshgrid(*[np.arange(q, dtype=float) for q in shp], indexing="ij"))
phi_z = amp_phi * np.cos(kk * (pos[0] + 0.5))
th_amp = abs(curl_f2e(np.stack([np.zeros(shp), np.zeros(shp), phi_z]))[1, 1, 0, 0])
seps = []
for sgn in (+1, -1):
    g = GyroLattice(shp, h, A)
    g.phi[2] = phi_z.copy(); g.start_in_step()
    g.beta[1, 1, 0, 0] += sgn * 1e-4
    tr = []
    for it in range(4000):
        g.step(dtg)
        if it % 50 == 49:
            tr.append(g.beta[1, 1, 0, 0])
    seps.append(np.array(tr))
sep = (seps[0] - seps[1]) / 2e-4
tt = np.arange(1, len(sep) + 1) * 50 * dtg
gfit = np.polyfit(tt[len(tt) // 3:], np.log(np.abs(sep[len(tt) // 3:])), 1)[0]
gpred = th_amp * math.sqrt((h * h / A**2 - wv**2) / 2)
print(f"   the band's twist amplitude {th_amp:.4e} (must be above 1e-3: {th_amp > 1e-3}); predicted growth rate {gpred:.4e}; measured {gfit:.4e}; separation at the end {sep[-1]:.2f}")
V["G3'"] = th_amp > 1e-3 and abs(gfit / gpred - 1) < 0.25
print(f"   G3' (within 25%): {'PASS' if V[chr(71)+'3'+chr(39)] else 'MISS'}")
print("\nVerdicts by the lock:", ", ".join(f"{k} {'PASS' if v else 'MISS'}" for k, v in V.items()))
print(f"(run took {time.time() - t0:.0f} s)")