Does light charge the quons? › Files cited on the page › papers/

review_checks.py

In the investigation at sim/light_ether_review/review_checks.py · last changed in commit dfdd296, 23 November 2026 · 18,995 bytes


#!/usr/bin/env python3
"""The author seat's own checks for its review of Fable's outline, sim/light_ether_fable/OUTLINE.md (the wheel-and-band ether).

Claude Opus 5.5, 23 November 2026, at Doug Westmoreland's request ("review the Fable model for consideration").
Own code: nothing is imported from sim/light_ether_fable. Not a trial; nothing pre-registered; all of it post hoc.
Run 1 (review_checks_run1.py.txt, review_checks_out_run1_3fails.txt): 17 of 20. The three failures were my slips: the divergence of the
other side (cells in place of corners, and the reverse). Run 2 corrects them and takes more samples in section 8
(review_checks_run2.py.txt, review_checks_out_run2_count_rounding.txt, 20 of 20). Run 3 compares section 8 with the law at the fraction really
filled: a whole number of bands is not exactly 5% or 20% of 13,824, which shifted the small differences at p = 0.05 and 0.2.
Labels: [S] standard physics, [I] measured input, [D] derived here, [M] modelling choice, [P] proposal.
"""
import math
import subprocess

import mpmath as mp
import numpy as np
from scipy import integrate, optimize

print("The author seat's checks for its review of the wheel-and-band outline. Own code; post hoc.")
print("git HEAD:", subprocess.run(["git", "rev-parse", "HEAD"], capture_output=True, text=True).stdout.strip())
hbar, c, e, eps0, me_kg = 1.054571818e-34, 299792458.0, 1.602176634e-19, 8.8541878188e-12, 9.1093837139e-31
mu0 = 1 / (eps0 * c * c)
hbarc = hbar * c / e                                   # eV m
me, mp_ = 510998.95, 938.27209e6                       # eV
alpha = e * e / (4 * math.pi * eps0 * hbar * c)
lP = 1.616255e-35
npass = ntot = 0


def check(ok, text, detail=""):
    global npass, ntot
    ntot += 1
    npass += bool(ok)
    print(f"   CHECK {'pass' if ok else 'FAIL'}: {text} {detail}")


def head(t):
    print("\n" + "=" * 100 + "\n" + t + "\n" + "=" * 100)


rng = np.random.default_rng(20261123)

# -------------------------------------------------------------------------------------------------------------------
head("1. The lattice, by another route: real-space arrays and plane waves (not matrices)")
# wheels u[3,N,N,N] on faces, bands on edges; curl with backward differences, its transpose with forward differences


def curlB(u):                                          # bands from wheels
    b = lambda a, ax: a - np.roll(a, 1, axis=ax)
    return np.stack([b(u[2], 1) - b(u[1], 2), b(u[0], 2) - b(u[2], 0), b(u[1], 0) - b(u[0], 1)])


def curlF(s):                                          # torques on wheels from band tensions: the transpose
    f = lambda a, ax: np.roll(a, -1, axis=ax) - a
    return np.stack([f(s[2], 1) - f(s[1], 2), f(s[0], 2) - f(s[2], 0), f(s[1], 0) - f(s[0], 1)])


def divB(s):
    return sum(s[a] - np.roll(s[a], 1, axis=a) for a in range(3))


def gradF(x):                                          # a gauge turn: wheel (r, a) between two cells
    return np.stack([x - np.roll(x, 1, axis=a) for a in range(3)])


N = 12
u1, s1 = rng.normal(size=(3, N, N, N)), rng.normal(size=(3, N, N, N))
check(abs(np.sum(curlB(u1) * s1) - np.sum(u1 * curlF(s1))) < 1e-9, "the pull of the bands is the transpose of their stretching (Newton's third law)")
divF = lambda s: sum(np.roll(s[a], -1, axis=a) - s[a] for a in range(3))     # net out of a cell (wheels); divB: net out of a corner (bands)
check(np.abs(divB(curlB(u1))).max() < 1e-12, "no wheel motion puts charge on a corner")
check(np.abs(divF(curlF(s1))).max() < 1e-12,
      "the bands' pull has no part along any gauge turn: such a spin can be neither slowed nor driven")
worst = 0.0
for _ in range(200):
    m = rng.integers(0, N, 3)
    k = 2 * math.pi * m / N
    X = np.stack(np.meshgrid(*[np.arange(N)] * 3, indexing="ij"))
    ph = np.exp(1j * np.tensordot(k, X, 1))
    amp = rng.normal(size=3) + 1j * rng.normal(size=3)
                                 # (kept general; the longitudinal part is projected next)
    lam = np.sum(4 * np.sin(k / 2) ** 2)
    if lam > 0:
        Kb = 1 - np.exp(-1j * k)                       # backward symbol: wheels are gauge-turned along Kb
        Kb_dir = Kb / np.linalg.norm(Kb)
        amp = amp - Kb_dir * np.vdot(Kb_dir, amp)
    u = amp[:, None, None, None] * ph
    worst = max(worst, np.abs(curlF(curlB(u)) - lam * u).max())
check(worst < 1e-11, "every transverse plane wave obeys the law, both polarizations alike (200 random waves)", f"({worst:.1e})")
check(np.abs(curlB(gradF(rng.normal(size=(N, N, N))))).max() < 1e-12, "a gauge turn stretches no band")

worst_p = worst_g = 0
mp.mp.dps = 50
for _ in range(50):
    v = rng.normal(size=3)
    n = [mp.mpf(float(x)) for x in v]
    r = mp.sqrt(sum(x * x for x in n))
    n = [x / r for x in n]
    S4 = sum(x**4 for x in n)
    kd = mp.mpf(10) ** -4
    k = [kd * x for x in n]
    W = 2 * mp.sqrt(sum(mp.sin(x / 2) ** 2 for x in k))
    vg = [mp.sin(x) / W for x in k]
    ng = 1 / mp.sqrt(sum(x * x for x in vg))
    worst_p = max(worst_p, abs((kd / W - 1) / (kd**2 * S4 / 24) - 1))
    worst_g = max(worst_g, abs((ng - 1) / (kd**2 * S4 / 8) - 1))
check(worst_p < 1e-6 and worst_g < 1e-6, "the grain's law (kd)^2 S4/24 (phase), /8 (packets), 50 random directions", f"({float(worst_p):.1e}, {float(worst_g):.1e})")
g = (np.arange(60) + 0.5) / 60 * math.pi
sx = np.sin(g / 2) ** 2
zp = np.mean(2 * np.sqrt(sx[:, None, None] + sx[None, :, None] + sx[None, None, :]))
check(abs(zp - 2.38760) < 2e-4, "zero-point mean of omega d/c", f"({zp:.5f})")

# -------------------------------------------------------------------------------------------------------------------
head("2. The timing bounds again, and the one the outline leaves out (LHAASO, GRB 221009A)")
H0 = 67.4e3 / 3.0856775814914e22
T2 = integrate.quad(lambda z: (1 + z) ** 2 / (H0 * math.sqrt(0.3153 * (1 + z) ** 3 + 0.6847)), 0, 0.9)[0]
print(f"   T2(z = 0.900) = {T2:.4e} s (the outline: 6.6541e17)")
for lab, dt in (("(a) 859 ms", 0.859), ("(e) 10 ms", 0.010)):
    d = hbarc / 28.0e9 * math.sqrt(8 * dt / T2)
    print(f"   GRB 090510 {lab}: d below {d:.3e} m (axis), {d*math.sqrt(3):.3e} m (cube diagonal)")
check(abs(hbarc / 28.0e9 * math.sqrt(8 * 0.01 / T2) / 2.444e-27 - 1) < 1e-3, "reproduces the outline's 2.444e-27 m")
EQG2 = 6.9e11 * 1e9
dL = math.sqrt(12) * hbarc / EQG2
print(f"   LHAASO, GRB 221009A [I, arXiv:2402.06009 Table I, read at source]: E_QG,2 > 6.9e11 GeV (95%, a delay), 'the best time-of-flight limit'")
print(f"      d below {dL:.3e} m (axis), {dL*math.sqrt(3):.3e} m (cube diagonal): {2.444e-27/dL:.2f} times tighter than (e), {2.265e-26/dL:.0f} times tighter than (a)")
print("      and it rests on many photons, not on one photon tied to one spike. It assumes, as they do, no lag at the source.")

# -------------------------------------------------------------------------------------------------------------------
head("3. Reading 1 (matter's law ordinary): the outline's bound uses electrons only; the cosmic rays say far more")


def d_th(E, M):
    return 9 * hbarc * M / E**2                       # cube axis; divide by sqrt(S4) otherwise


print("   d_th = 9 hbar c M/E^2 (the outline's own formula, 10.3), cube axis; times sqrt(3) on the cube diagonal")
for lab, E, M in (("1.1 PeV electron (inferred, the outline's row)", 1.1e15, me), ("40 TeV electron (detected)", 4e13, me),
                  ("3.2e20 eV as iron, nucleon by nucleon (E/56 each)", 3.2e20 / 56, mp_), ("1e20 eV as a proton", 1e20, mp_), ("3.2e20 eV as a proton", 3.2e20, mp_)):
    d = d_th(E, M)
    print(f"   {lab:52s} d below {d:.2e} m = {d/lP:9.2e} Planck lengths; {7.5e-31/d:.1e} times tighter than 7.5e-31")
# brute force of the threshold, exact lattice balance, ordinary matter (electron, 40 TeV, axis)
E, M = mp.mpf(4e13), mp.mpf(me)
def surplus(d, y):
    p = mp.sqrt(E * E - M * M)
    k = y * p
    Ee2 = mp.sqrt((p - k) ** 2 + M * M)
    w = 2 * mp.mpf(hbarc) / d * mp.sin(k * d / (2 * mp.mpf(hbarc)))
    return E - Ee2 - w


d0 = mp.mpf(d_th(4e13, me))
lo = max(surplus(d0 * mp.mpf("0.999"), mp.mpf(y) / 200) for y in range(1, 200))
hi = max(surplus(d0 * mp.mpf("1.001"), mp.mpf(y) / 200) for y in range(1, 200))
check(lo < 0 < hi, "brute force at 40 TeV: no light just below d_th, light just above", f"({mp.nstr(lo,3)}, {mp.nstr(hi,3)} eV)")

# -------------------------------------------------------------------------------------------------------------------
head("4. Reading 2 (a body shares the lattice's law): the Crab's synchrotron light bounds it")
print("   E^2 = m^2 + W^2 along an axis [the outline's 10.3], so 1 - v/c = m^2/(2E^2) + (kd)^2/8 [D]: a top speed below c.")
print("   Synchrotron cutoff [S; Jacobson, Liberati and Mattingly 2003, eq. 4, read at source]: omega_c = (3/2) e B c^2 gamma(v)^3/E.")
Bc = me_kg**2 * c**2 / (e * hbar)                      # 4.41e9 T


def wc(E, B, d):                                       # eV, with gamma from the lattice law's group speed
    gam = 1 / math.sqrt((me / E) ** 2 + (E * d / hbarc) ** 2 / 4)
    return 1.5 * (B / Bc) * me * me * gam**3 / E


# check the group speed law numerically
x, m_ = mp.mpf("1e-6"), mp.mpf("1e-8")
Wf = lambda q: 2 * mp.sin(q / 2)
v = mp.diff(lambda q: mp.sqrt(m_**2 + Wf(q) ** 2), x)
check(abs((1 - v) / (m_**2 / (2 * x**2) + x**2 / 8) - 1) < 1e-3, "the body's speed on the lattice: 1 - v = m^2/(2p^2) + p^2/8")


def dmax(B, w):                                        # largest d whose maximum cutoff reaches w (eV)
    f = lambda ld: math.log(max(wc(10**x, B, 10**ld) for x in np.linspace(13, 18, 4001)) / w)
    return 10 ** optimize.brentq(f, -36, -26)


for B in (0.6e-7, 0.15e-7):
    d = dmax(B, 1e8)
    cf = 2 / math.sqrt(3) * (B / Bc) * hbarc / 1e8     # closed form: max = (2/sqrt 3)(B/Bc) hbar c/d, at E^2 = sqrt(2) m hbar c/d
    Es = math.sqrt(math.sqrt(2) * me * hbarc / d)
    print(f"   B = {B*1e7:.2f} mG, light to 100 MeV: d below {d:.2e} m (axis; closed form {cf:.2e}); diagonal {d*math.sqrt(3):.1e}; "
          f"best electron {Es/1e12:.0f} TeV; {9.894e-28/d:.0e} times tighter than LHAASO's timing")
    check(abs(d / cf - 1) < 2e-3, "closed form (2/sqrt 3)(B/B_c) hbar c/omega")
dsimple = 2 * me / 1.5e15 * hbarc / 1.5e15
print(f"   the record's rougher rule (trial 22 section 5: the deficit below m^2/(2E^2) at 1500 TeV): d below {dsimple:.1e} m")
print("   0.6 mG is the largest of their range 0.15 to 0.6 mG: the weakest bound. Assumes the Crab's 100 MeV light is synchrotron light,")
print("   as they do, and treats the bound as if the electrons moved along a cube axis (a factor sqrt 3 at most otherwise).")
print("   So the outline's 'the timing bounds of 6a are the ones that stand' in reading 2 is not right: this one is ~10^4 to 10^5 tighter.")

# -------------------------------------------------------------------------------------------------------------------
head("5. What is left to see, with those bounds: the grain, cube axis")
d2, d1 = dmax(0.6e-7, 1e8) * math.sqrt(3), d_th(3.2e20 / 56, mp_) * math.sqrt(3)
print(f"   largest cells left, any orientation: reading 2 {d2:.1e} m; reading 1 {d1:.1e} m (the weakest cosmic-ray reading, iron)")
for lab, E, T in (("GRB 090510, 28 GeV, whole path (T2)", 28e9, T2), ("7 TeV over z = 0.151 (about GRB 221009A; 7e16 s)", 7e12, 7e16), ("1.42 PeV over 1.4 kpc", 1.42e15, 1.44e11)):
    print(f"   {lab:52s}" + "".join(f"  d = {d:.1e}: delay {(E*d/hbarc)**2/8*T:.1e} s;" for d in (d2, d1)))
print(f"   top of light's band, 2 hbar c/d: {2*hbarc/d2:.1e} eV (reading 2), {2*hbarc/d1:.1e} eV (reading 1); Planck energy 1.22e28 eV")
print(f"   the direction pattern (S4, three to one) is a fraction of those delays. At 7 TeV it is about {(7e12*d2/hbarc)**2/8*7e16:.0e} s:"
      f" a burst timed to 1 s misses it by {1/((7e12*d2/hbarc)**2/8*7e16):.0e}.")

# -------------------------------------------------------------------------------------------------------------------
head("6. The magnetic force follows from the wheels (the outline puts it in, 5.9): an identity, tested on a run of waves")
print("   Action = sum of (1/2) I (dphi/dt)^2 - (1/2) kappa |curl phi + slip|^2. Carry one notch of charge from a corner to the opposite corner")
print("   of a face by its two routes, at one instant t0, in the same given waves. The slips differ by one notch round the face = one notch of")
print("   that wheel. Turn that wheel by the notch for t > t0 and the strains agree at all times [8.2]; only the motion term at t0 differs.")
N, dt = 8, 0.05
phi = np.zeros((41, 3, N, N, N))
phi[0] = 0.3 * rng.normal(size=(3, N, N, N))
phi[1] = phi[0] + dt * rng.normal(size=(3, N, N, N))
for t in range(1, 40):
    phi[t + 1] = 2 * phi[t] - phi[t - 1] - dt * dt * curlF(curlB(phi[t]))
s0, t0, f = 0.01, 20, (2, 3, 3, 3)                     # the wheel on a face normal to z
unit = np.zeros((3, N, N, N))
unit[f] = 1.0
ring = curlB(unit)
route1 = np.where(ring > 0, ring, 0.0)                 # two of the four bands
route2 = np.where(ring < 0, -ring, 0.0)                # the other two, the other way: route1 - route2 = ring
check(np.abs(route1 - route2 - ring).max() == 0 and np.abs(divB(route1) - divB(route2)).max() < 1e-15 and np.count_nonzero(divB(route1)) == 2,
      "two routes, the same two ends, differing by one wheel's notch")


def action(ph, slip, sl):
    kin = sum(0.5 * np.sum((ph[t + 1] - ph[t]) ** 2) / dt for t in range(40))
    pot = sum(0.5 * dt * np.sum((curlB(ph[t]) + (sl * slip if t > t0 else 0)) ** 2) for t in range(41))
    return kin - pot


phi2 = phi.copy()
phi2[t0 + 1:] += s0 * unit                             # route 2's history, with the wheel turned by a notch after t0
dS = action(phi2, route2, s0) - action(phi, route1, s0)
rate = (phi[t0 + 1] - phi[t0])[f] / dt
pred = s0 * rate + 0.5 * s0**2 / dt
check(abs(dS - pred) < 1e-9, "the actions differ by (notch) x (the wheel's angular momentum), plus the notch's own jump", f"({dS:.9f} against {pred:.9f})")
print("   In fields: I (dphi/dt) s0 = B d^2 e [with B = I phidot/(g d^3), e = g s0 d]: the action of a displaced path changes by e x (the flux between),")
print("   which is the whole of e v x B [S, Feynman-Hibbs form; Dirac 1948 for the string, from memory]. The second term is the same for every")
print("   displacement and every field. So 'the magnetic force is put in' (5.9, 9.3, 12) can be withdrawn: it follows from 8.2. [D, mine, not independently checked]")

# -------------------------------------------------------------------------------------------------------------------
head("7. Home 2 (the free alternating spin): light cannot see it, but a charge can")
N = 8
X = np.stack(np.meshgrid(*[np.arange(N)] * 3, indexing="ij"))
stag = (-1.0) ** X.sum(0)
spin = gradF(stag) / 2
check(np.abs(np.abs(spin) - 1).max() == 0 and np.abs(curlB(spin)).max() == 0, "the alternating gauge turn: every wheel turns at the same rate, no band is stretched")
out = np.roll(spin[0], -1, 0) - spin[0] + np.roll(spin[1], -1, 1) - spin[1] + np.roll(spin[2], -1, 2) - spin[2]
check(np.abs(np.abs(out) - 6).max() == 0, "each cell is a magnetic pole: the flux of six wheels out of one cell, into the next")
print("   By section 6 a charge carried round a face picks up e x flux = s0 L, L = the wheel's angular momentum. It is not blind to this spin.")
print("   If the slipped line is book-keeping only (8.2) and the lattice is made quantum, turning a cell's six wheels by one notch each changes")
print("   nothing, so 6 s0 L = 2 pi hbar n: Dirac's condition [S]; the pole is n h/e. So the rate is not free: L = n pi hbar/(3 s0). [D, quantum version only]")
print("   With I = mu0 d e^2/s0^2 (from 5.3 and e = g s0 d) and rim speed c/2 at radius r: L = 2 pi alpha hbar d/(r s0^2); then s0 = 6 alpha d/(n r).")
I_ = lambda d, s: mu0 * d * e * e / s**2
d, r, n = 1e-31, 0.5e-31, 1
s = 6 * alpha * d / (n * r)
L = I_(d, s) * (c / 2) / r
check(abs(6 * s * L / (2 * math.pi * hbar * n) - 1) < 1e-9, "the relation, in numbers", f"(r = d/2, n = 1: notch {s:.5f} rad = {math.degrees(s):.2f} degrees, {2*math.pi/s:.2f} notches a turn)")
print("   A relation between alpha, the notch and r/d, not a prediction: r/d, n and the number of notches are free. hbar/2 a wheel is allowed for s0 = 2 pi n/3.")
Phi = 2 * math.pi * hbar / (6 * e)
print(f"   Field of one wheel's flux h/(6e) at d = 1e-31 m: B = {Phi/d**2:.1e} T, alternating cell by cell; energy {3*Phi**2/(2*mu0*d)/d**3/c**2:.1e} kg/m^3.")

# -------------------------------------------------------------------------------------------------------------------
head("8. The outline's P3: random filling against Clausius and Mossotti, solved on the steady lattice")
N = 24
kv = 2 * math.pi * np.fft.fftfreq(N)
K = np.stack(np.meshgrid(*[1 - np.exp(-1j * kv)] * 3, indexing="ij"))
K2 = np.sum(np.abs(K) ** 2, axis=0)
K2[0, 0, 0] = 1


def PL(v):                                            # longitudinal projector on the bands (edges); k = 0 part zero (mean field held)
    h = np.fft.fftn(v, axes=(1, 2, 3))
    Kf = np.exp(1j * np.stack(np.meshgrid(*[kv] * 3, indexing="ij"))) - 1      # gradient on edges: forward difference
    s = np.sum(np.conj(Kf) * h, axis=0) / K2
    s[0, 0, 0] = 0
    return np.real(np.fft.ifftn(Kf * s, axes=(1, 2, 3)))


tst = np.zeros((3, N, N, N))
tst[0, 0, 0, 0] = 1
own = PL(tst)[0, 0, 0, 0]
check(abs(own - (1 - 1 / N**3) / 3) < 1e-12, "a band's own share is (1/3)(1 - 1/cells)", f"({own:.6f})")
check(abs(np.sum(PL(tst) ** 2) - own**2 - (own - own**2)) < 1e-12, "the squared field on all other bands sums to 1/3 - 1/9 = 2/9 on a large lattice", f"({np.sum(PL(tst)**2)-own**2:.6f})")


def eps_eff(y, p, seed):
    r = np.random.default_rng(seed)
    chi = 3 * y / (1 - y)
    th = np.stack([(r.permutation(N**3) < round(p * N**3)).reshape(N, N, N) for _ in range(3)]).astype(float)
    E0 = np.zeros((3, N, N, N))
    E0[0] = 1
    E = E0.copy()
    for _ in range(400):                              # converges: a contraction in the symmetrised form
        # Lippmann-Schwinger with reference eps = 1 + chi/2
        new = E - PL(E * (1 + chi * th) / (1 + chi / 2)) - (E.mean(axis=(1, 2, 3)) - np.array([1, 0, 0]))[:, None, None, None]
        if np.abs(new - E).max() < 1e-12:
            break
        E = new
    return 1 + chi * np.mean(th[0] * E[0])


check(abs(eps_eff(0.2, 1.0, 1) - 1.75) < 1e-9, "full lattice: 1.75 (Clausius and Mossotti at y = 0.2)")
print("   y     p     solved (mean of 150, +- s.e.)     C-M         difference   the outline's 6 p^2 (1-p) y^3   ratio")
for y in (0.05, 0.1, 0.2):
    for p in (0.05, 0.2, 0.5):
        v = np.array([eps_eff(y, p, 100 + i) for i in range(150)])
        q = round(p * N**3) / N**3                    # the fraction really filled: a whole number of bands
        cm = (1 + 2 * q * y) / (1 - q * y)
        pr = 6 * q * q * (1 - q) * y**3
        se = v.std(ddof=1) / math.sqrt(150)
        print(f"   {y:<5} {p:<5} {v.mean():.8f} +- {se:.1e}         {cm:.8f}  {v.mean()-cm:+.3e}   {pr:.3e}                       {(v.mean()-cm)/pr:.3f} +- {se/pr:.3f}")
print(f"\nChecks: {npass} of {ntot} pass.")