Does light charge the quons? › Files cited on the page › papers/
outline_checks.py
#!/usr/bin/env python3
"""Checks of the algebra in OUTLINE.md: a wheel-and-band ether as a model of how light travels.
Written by the proposer (Fable 5.2, maximum effort) on 23 November 2026, at Doug Westmoreland's request for a
light propagation model. Own code; nothing is imported from any trial.
THIS IS NOT A TRIAL. Nothing here is pre-registered. Every bound reuses the measured limits met in the review of
trial 23 (task T1) and is post hoc. The chain runs of section 3 compare the lattice with its own law: they test the
code and the algebra, not nature.
Run from this folder:
OMP_NUM_THREADS=1 ~/aspden-review-venv/bin/python3 outline_checks.py > outline_checks_out.txt 2> outline_checks_err.txt
THIS IS RUN 2. Run 1 (23 November 2026) gave 71 of 75 checks; four failed. Its script and output are kept beside this file
as outline_checks_run1.py.txt and outline_checks_out_run1_4fails.txt. What changed, all of it after seeing run 1 (post hoc):
- Section 5, three failures: my check's mistake. A periodic lattice's mode sum leaves out the k = 0 mode; the endless
lattice's integral includes its neighbourhood. The k = 0 term (2/3)/(kappa^2 N^3) is now added before the two are compared,
the symmetry behind the factor 2/3 is checked directly, and the radiation term is also taken from the endless lattice.
- Section 4b, one failure: a real effect. The difference from the law is second order in the twist and grows with the
length of the run: a forced twist slowly turns the gimbal. 4b now shows the order; the new 4e checks the drift itself.
The gimbal's deviation is now integrated directly (not the angle), and the couple is projected with the trapezoid rule.
- Small: a leftover line in 4c removed; one formula in 6c's printed text corrected; a table of the speed at every colour (6i)
and two rough lines on the drift (6f) added.
A test run of sections 4 to 6 with those changes (run 2a; its script, driver, output and error file are kept beside this file as
outline_checks_run2a*.txt and outline_checks_*_run2a*.txt) failed two of its 44 checks. What changed after it (post hoc again):
- 4e's check that one gimbal's small tilt grows as cosh(g t): the tilt outgrew it by 10 to 22%. The rate g was right. The
twist's sudden start at its extreme had left the gimbal with a slow steady rate, third order in the twist, which I had left
out. 4e now follows two gimbals: their separation tests the rate, and their mean tests the start-up term.
- Section 5's direct integral came back 'nan': scipy's exp(-x) I0(x) returns nan above about x = 1e12. Beyond x = 1e4 the
standard asymptotic series is now used (ive0), and it is checked against scipy's value where the two meet.
The first complete run 2 passed 94 of 94 checks, but section 6a printed one of Abdo et al.'s phrases against the wrong limit:
'somewhat less conservative but still very reasonable' is their word for limit (d); limit (e) they call their 'least
conservative limit'. In 6a two printed lines became four, and five label lines changed (one in 6d, two in 6e, two in 6h);
the script was run again and no number changed. That run's script and output are kept as
outline_checks_run2_before_wording_fix.py.txt and outline_checks_out_run2_before_wording_fix.txt.
After that rerun (94 of 94) one part was added: 6j, on a body that shares the lattice's own law (it gives off no light in the
vacuum at any energy), with nine checks of its own. Nothing else was changed but this note, the list of sections and the
header that main() prints. The rerun before 6j is kept as outline_checks_run2_before_6j.py.txt and
outline_checks_out_run2_before_6j.txt. 6j is post hoc, like everything here.
Sections
1. The lattice operator: wheels on faces, bands on edges. Spectrum, gauge identities, the 2D board, a slipped band.
2. The grain law at long waves: n - 1 and n_g - 1 against (kd)^2 S4/24 and (kd)^2 S4/8.
3. Chain runs in time: packets on the bare chain, and on a chain of held charges (the relay) for contrast.
4. Kelvin's gyrostat: the exact equations against the small-angle spring; a turned gimbal; a held twist; light's slow push.
5. A dipole on one band: its own field on the lattice, Watson's integral, the radiation term.
6. Numbers: the bounds on the cell size, the costs, the speed at every colour, and a body that shares the lattice's law.
Labels: [S] standard physics, [I] measured input, [D] derived here, [M] modelling choice, [P] proposal, [A] Aspden's.
Units in sections 1 to 5: cell size d = 1, light's speed c = 1, eps0 = mu0 = 1.
"""
import math
import subprocess
import sys
import time
import mpmath as mp
import numpy as np
import scipy
from scipy import constants as K
from scipy import integrate, optimize, special
checks = [0, 0]
E3 = np.eye(3, dtype=int)
def check(ok, text, detail=""):
checks[1] += 1
checks[0] += bool(ok)
print(f" CHECK {'pass' if ok else 'FAIL'}: {text} {detail}")
def head(title):
print("\n" + "=" * 110)
print(title)
print("=" * 110)
# ----------------------------------------------------------------------------------------------------------------
# 1. The lattice operator
# ----------------------------------------------------------------------------------------------------------------
def idx(r, comp, n):
"""Index of component comp at cell r of an n1 x n2 x n3 periodic lattice (a wheel if a face, a band if an edge)."""
return comp + 3 * vid(r, n)
def vid(r, n):
n1, n2, n3 = n
return ((r[0] % n1) * n2 + (r[1] % n2)) * n3 + (r[2] % n3)
def build(n):
"""S: band stretches from wheel angles. Dv: divergence at the vertices of what the bands carry.
Gr: the wheel angles of a pure gauge turn (a potential on the cells).
Band (r, a) lies on the edge from vertex r to r + e_a. Four wheels touch it: the faces normal to b and to c
(a, b, c cyclic) that share the edge. Its stretch is the signed sum of their angles (the circulation round the edge):
s_a(r) = [u_c(r) - u_c(r - e_b)] - [u_b(r) - u_b(r - e_c)].
The potential energy is (1/2) sum s^2, so the torque on the wheels is -S^T s (Newton's third law does the rest)."""
n1, n2, n3 = n
nc = n1 * n2 * n3
S = np.zeros((3 * nc, 3 * nc))
Dv = np.zeros((nc, 3 * nc))
Gr = np.zeros((3 * nc, nc))
for i in range(n1):
for j in range(n2):
for k in range(n3):
r = np.array([i, j, k])
for a in range(3):
b, c = (a + 1) % 3, (a + 2) % 3
row = idx(r, a, n)
S[row, idx(r, c, n)] += 1.0
S[row, idx(r - E3[b], c, n)] -= 1.0
S[row, idx(r, b, n)] -= 1.0
S[row, idx(r - E3[c], b, n)] += 1.0
Dv[vid(r, n), idx(r, a, n)] += 1.0
Dv[vid(r, n), idx(r - E3[a], a, n)] -= 1.0
Gr[idx(r, a, n), vid(r, n)] += 1.0
Gr[idx(r, a, n), vid(r - E3[a], n)] -= 1.0
return S, Dv, Gr
def analytic_spectrum(n):
n1, n2, n3 = n
vals = []
for m1 in range(n1):
for m2 in range(n2):
for m3 in range(n3):
lam = 4 * (math.sin(math.pi * m1 / n1) ** 2 + math.sin(math.pi * m2 / n2) ** 2 + math.sin(math.pi * m3 / n3) ** 2)
vals += [0.0, lam, lam] if (m1 or m2 or m3) else [0.0, 0.0, 0.0]
return np.sort(np.array(vals))
def section1():
head("1. The lattice operator: wheels on the faces of a cubic cell, a band on each edge")
print(" Equation of motion [M, after FitzGerald 1885 and MacCullagh 1839]: I d2u/dt2 = -kappa S^T S u.")
print(" Claim [D]: omega^2 = (4 c^2/d^2) sum_j sin^2(k_j d/2), twice at every k (two polarizations, never split);")
print(" one zero mode at every k (a gauge turn), three at k = 0: cells + 2 zero modes in all.")
for n in ((3, 4, 5), (5, 5, 5), (6, 6, 6)):
S, Dv, Gr = build(n)
M = S.T @ S
w = np.linalg.eigvalsh(M)
an = analytic_spectrum(n)
nc = n[0] * n[1] * n[2]
nzero = int((np.abs(w) < 1e-9).sum())
print(f" lattice {n}: {3 * nc} wheels; largest |eigenvalue - law| = {np.abs(w - an).max():.2e}; zero modes {nzero} (cells + 2 = {nc + 2}); "
f"top of the band {w.max():.6f} (law {an.max():.6f})")
check(np.abs(w - an).max() < 1e-9, f"{n}: the whole spectrum is the law's, each nonzero value twice")
check(nzero == nc + 2, f"{n}: zero modes number cells + 2")
check(np.abs(Dv @ S).max() == 0.0, f"{n}: no wheel motion puts charge on a vertex (div of the stretches is zero, exactly)")
check(np.abs(S @ Gr).max() == 0.0, f"{n}: a gauge turn stretches no band (exactly)")
if n == (6, 6, 6):
keep = (S, Dv, M)
print("\n FitzGerald's board: an 8 x 8 x 1 lattice. The wheels with axes normal to the board should obey")
print(" I d2phi/dt2 = kappa (sum of the four neighbours - 4 phi) and not feel the other wheels.")
n = (8, 8, 1)
S, Dv, Gr = build(n)
M = S.T @ S
zz = [idx((i, j, 0), 2, n) for i in range(8) for j in range(8)]
rest = [q for q in range(M.shape[0]) if q not in zz]
L2 = np.zeros((64, 64))
for i in range(8):
for j in range(8):
p = i * 8 + j
L2[p, p] += 4
for di, dj in ((1, 0), (-1, 0), (0, 1), (0, -1)):
L2[p, ((i + di) % 8) * 8 + (j + dj) % 8] -= 1
check(np.abs(M[np.ix_(zz, zz)] - L2).max() == 0.0, "the board's wheels obey the five-point law exactly")
check(np.abs(M[np.ix_(zz, rest)]).max() == 0.0, "and are not coupled to the in-plane wheels")
print("\n A slipped band [FitzGerald, Larmor; D]: slip one band by one notch on the 6 x 6 x 6 lattice and let the wheels settle.")
S, Dv, M = keep
n = (6, 6, 6)
nc = 216
Mp = np.linalg.pinv(M, hermitian=True)
Pi = np.eye(3 * nc) - S @ Mp @ S.T # what is left of a slip when the wheels have settled
o = np.array([0, 0, 0])
DA = np.zeros(3 * nc)
DA[idx(o, 0, n)] = 1.0 # path A: the one band from the origin to x
DB = np.zeros(3 * nc) # path B: three bands, origin -> y -> x + y -> x
DB[idx(o, 1, n)] = 1.0
DB[idx(o + E3[1], 0, n)] = 1.0
DB[idx(o + E3[0], 1, n)] = -1.0
relA, relB = Pi @ DA, Pi @ DB
q = Dv @ relA
ends = sorted(np.round(q, 12))
print(f" charge on the vertices after settling: {q[vid(o, n)]:+.6f} at the tail, {q[vid(o + E3[0], n)]:+.6f} at the head, "
f"largest elsewhere {np.abs(np.delete(q, [vid(o, n), vid(o + E3[0], n)])).max():.1e}")
check(abs(ends[0] + 1) < 1e-10 and abs(ends[-1] - 1) < 1e-10 and np.abs(ends[1:-1]).max() < 1e-10,
"a slipped band is a pair of opposite charges at its two ends, and nothing else")
on_edge = relA[idx(o, 0, n)]
law = (1 - 1 / nc) / 3 + 1 / nc
print(f" stretch left on the slipped band itself: {on_edge:.9f}; law (1/3)(1 - 1/cells) + 1/cells = {law:.9f}")
check(abs(on_edge - law) < 1e-10, "the settled stretch on the band is the lattice Coulomb value")
check(abs(0.5 * relA @ relA - 0.5 * law) < 1e-10, "the pair's energy is half of that (e^2/(6 eps0 d) on an endless lattice)",
f"({0.5 * relA @ relA:.9f})")
check(np.abs(relA - relB).max() < 1e-10, "the same two ends reached by another path of slipped bands give the same field: the string is invisible",
f"(largest difference {np.abs(relA - relB).max():.1e})")
check(np.abs(DB - DA + S[:, idx(o, 2, n)]).max() == 0.0, "the two paths differ by one notch of one wheel, exactly")
# ----------------------------------------------------------------------------------------------------------------
# 2. The grain law at long waves
# ----------------------------------------------------------------------------------------------------------------
def section2():
head("2. The grain at long waves [D]: n - 1 = (kd)^2 S4/24 (phase), n_g - 1 = (kd)^2 S4/8 (packets: a delay)")
print(" S4 = n_x^4 + n_y^4 + n_z^4 for the direction of travel: 1 along a cube axis, 1/2 a face diagonal, 1/3 a cube diagonal.")
print(" Both are computed directly (40 digits), not by subtracting from 1.")
mp.mp.dps = 40
dirs = (("cube axis", (1, 0, 0)), ("face diagonal", (1, 1, 0)), ("cube diagonal", (1, 1, 1)), ("general (1,2,3)", (1, 2, 3)))
print(" " + f"{'direction':<18}{'S4':<9}{'kd':<7}{'n - 1':<14}{'law':<14}{'rel. diff':<12}{'n_g - 1':<14}{'law':<14}{'rel. diff':<12}")
worst_ratio = 0.0
for name, v in dirs:
norm = mp.sqrt(sum(x * x for x in v))
nv = [mp.mpf(x) / norm for x in v]
S4 = sum(x**4 for x in nv)
S6 = sum(x**6 for x in nv)
rel = {}
for kd in ("0.3", "0.1", "0.03", "0.01"):
k = mp.mpf(kd)
kv = [k * x for x in nv]
w = 2 * mp.sqrt(sum(mp.sin(kc / 2) ** 2 for kc in kv))
n1 = (k - w) / w
vg = mp.sqrt(sum(mp.sin(kc) ** 2 for kc in kv)) / w
ng1 = (1 - vg) / vg
l1, l2 = k * k * S4 / 24, k * k * S4 / 8
rel[kd] = (float(n1 / l1 - 1), float(ng1 / l2 - 1))
print(" " + f"{name:<18}{float(S4):<9.5f}{kd:<7}{float(n1):<14.6e}{float(l1):<14.6e}{rel[kd][0]:<+12.3e}"
f"{float(ng1):<14.6e}{float(l2):<14.6e}{rel[kd][1]:<+12.3e}")
# next order for the phase index: n - 1 = k^2 S4/24 + k^4 (S4^2/384 - S6/720)
coef = float((S4 / 16 - S6 / (30 * S4)))
got = rel["0.01"][0] / 1e-4
worst_ratio = max(worst_ratio, abs(got / coef - 1))
check(abs(rel["0.1"][0] / rel["0.01"][0] / 100 - 1) < 0.02 and abs(rel["0.1"][1] / rel["0.01"][1] / 100 - 1) < 0.02,
f"{name}: what is left of each falls as (kd)^2")
check(abs(got / coef - 1) < 1e-3, f"{name}: the next term of n - 1 is (kd)^4 (S4^2/384 - S6/720)", f"({got:.6f} against {coef:.6f})")
print(" Sky average of S4 is 3/5. The delay is three times larger along a cube axis than along a cube diagonal.")
# ----------------------------------------------------------------------------------------------------------------
# 3. Chain runs in time
# ----------------------------------------------------------------------------------------------------------------
def chain_run(q0, wp2, wh2, dt, T, N=8192, sigma=200.0, x0=2000.0):
"""One-way packet on a chain of wheels (H, whole sites) and bands (E, half sites), leapfrog in time.
wp2 > 0 puts a held charge on every band: d2P/dt2 = wp2 E - wh2 P [S, Lorentz], J = dP/dt.
The start is an exact one-way solution of the stepped equations, built mode by mode.
Returns the speed of the centroid of E^2, the spectrum's mean group speed under the leapfrog's own law,
and under the law for continuous time."""
m = np.arange(N // 2 + 1)
q = 2 * np.pi * m / N
A = np.exp(-0.5 * ((q - q0) * sigma) ** 2)
A[0] = 0.0
A[-1] = 0.0
s = 2 * np.sin(q / 2)
if wp2 > 0:
b = wh2 + wp2 + s * s
W2 = 2 * s * s * wh2 / (b + np.sqrt(b * b - 4 * s * s * wh2)) # lower branch, written without a subtraction
chi = wp2 / (wh2 - W2)
deps = 2 * np.sqrt(W2) * wp2 / (wh2 - W2) ** 2
else:
W2 = s * s
chi = np.zeros_like(q)
deps = np.zeros_like(q)
W = np.sqrt(W2)
arg = np.clip(W * dt / 2, 0.0, 1.0)
wnum = 2 * np.arcsin(arg) / dt
sel = A > 1e-30
ratioH = np.ones_like(q)
ratioH[sel] = s[sel] / W[sel]
half = np.exp(1j * wnum * dt / 2)
def synth(spec, offset):
F = np.zeros(N, dtype=complex)
F[: N // 2 + 1] = spec * np.exp(1j * q * (offset - x0))
return (np.fft.ifft(F) * N).real
E = synth(A, 0.5) # at time 0, on the bands (x = j + 1/2)
H = synth(A * ratioH * half, 0.0) # at time -dt/2, on the wheels (x = j)
P = synth(A * chi, 0.5) # at time 0
J = synth(A * (-1j) * W * chi * half, 0.5) # at time -dt/2
vg = np.zeros_like(q)
vg[sel] = np.sin(q[sel]) / (W[sel] * (1 + chi[sel]) + W2[sel] * deps[sel] / 2)
vnum = np.zeros_like(q)
vnum[sel] = vg[sel] / np.sqrt(np.maximum(1 - arg[sel] ** 2, 1e-300))
wgt = A * A
v_num = float((wgt * vnum).sum() / wgt.sum())
v_cont = float((wgt * vg).sum() / wgt.sum())
xs = np.arange(N) + 0.5
def centroid(F):
w2 = F * F
return float((xs * w2).sum() / w2.sum())
c0 = centroid(E)
nsteps = int(round(T / dt))
held = wp2 > 0
for _ in range(nsteps):
H -= dt * (E - np.roll(E, 1))
if held:
J += dt * (wp2 * E - wh2 * P)
P += dt * J
E -= dt * (np.roll(H, -1) - H) + dt * J
else:
E -= dt * (np.roll(H, -1) - H)
c1 = centroid(E)
return (c1 - c0) / (nsteps * dt), v_num, v_cont, c0
def section3():
head("3. Chain runs in time: does a packet of every colour travel at one speed?")
print(" A row of wheels joined by bands (the 1D cut of the lattice). Leapfrog in time, step dt in units d/c.")
print(" Law for continuous time [D]: v = c cos(kd/2). The leapfrog's own law [D]: v = c cos(kd/2)/sqrt(1 - (c dt/d)^2 sin^2(kd/2)).")
print(" Packet: Gaussian, 200 cells wide, 8192 cells, run for 1000 d/c. Speed = shift of the centroid of E^2 over the time.")
t0 = time.time()
print("\n 3a. The bare chain (the ether alone), dt = 0.02")
print(" " + f"{'kd':<7}{'measured v/c':<16}{'leapfrog law':<16}{'difference':<13}{'cos(kd/2)':<14}{'measured - cos(kd/2)':<22}{'1 - v/c':<12}")
got = {}
for q0 in (0.05, 0.1, 0.3, 1.0, 2.0, 3.0):
v, vn, vc, c0 = chain_run(q0, 0.0, 0.0, 0.02, 1000.0)
got[q0] = (v, vn, vc)
print(" " + f"{q0:<7}{v:<16.9f}{vn:<16.9f}{v - vn:<+13.2e}{math.cos(q0 / 2):<14.9f}{v - math.cos(q0 / 2):<+22.2e}{1 - v:<12.3e}")
check(abs(v - vn) < 1e-6, f"kd = {q0}: the run's speed is the leapfrog law's")
check(abs(v - math.cos(q0 / 2)) < 3e-4, f"kd = {q0}: and within the step's error of c cos(kd/2)")
print(" Reading: at kd = 0.05 the packet is slower than c by 3 parts in 10^4; the slowing goes as (kd)^2/8 and is gone at long waves.")
check(abs((1 - got[0.05][0]) / (0.05**2 / 8) - 1) < 0.02 and abs((1 - got[0.1][0]) / (0.1**2 / 8) - 1) < 0.02,
"the slowing at kd = 0.05 and 0.1 is (kd)^2/8 to 2%",
f"({(1 - got[0.05][0]) / (0.05**2 / 8):.4f}, {(1 - got[0.1][0]) / (0.1**2 / 8):.4f} of it)")
print("\n 3b. The step's own error: halve dt at kd = 2")
v1, vn1, vc1, _ = chain_run(2.0, 0.0, 0.0, 0.02, 1000.0)
v2, vn2, vc2, _ = chain_run(2.0, 0.0, 0.0, 0.01, 1000.0)
e1, e2 = v1 - vc1, v2 - vc2
print(f" run minus the continuous-time law: {e1:+.3e} (dt = 0.02), {e2:+.3e} (dt = 0.01); ratio {e1 / e2:.3f}")
check(abs(e1 / e2 - 4) < 0.05, "the step's error falls four times when the step is halved")
print(" The 'magic step' c dt = d: the leapfrog then carries every wavelength at exactly c. That is the scheme's artefact,")
print(" not the lattice's physics, so runs of this model must keep c dt/d small (or correct for it).")
for q0 in (2.0, 3.0):
v, vn, vc, _ = chain_run(q0, 0.0, 0.0, 1.0, 1000.0)
print(f" kd = {q0}, dt = 1: measured v/c = {v:.9f} (continuous-time law {math.cos(q0 / 2):.6f})")
check(abs(v - 1) < 1e-7, f"kd = {q0}: at the magic step the packet moves at c")
print("\n 3c. For contrast: the same chain with a held charge on every band (the relay, f = 1/4)")
print(" Each charge is held to its own place with the tune w_h = 0.2 c/d; w_p^2 = 3 w_h^2, so the slow-wave speed is c/2.")
print(" Law [S, Lorentz; D on the chain]: 4 sin^2(kd/2) = w^2 eps(w), eps = 1 + w_p^2/(w_h^2 - w^2); v = sin(kd)/(w eps + w^2 eps'/2).")
wh = 0.2
wh2, wp2 = wh * wh, 3 * wh * wh
print(" " + f"{'w/w_h':<8}{'kd':<10}{'measured v/c':<16}{'leapfrog law':<16}{'difference':<13}{'v/(c/2)':<12}{'bare chain at the same w: v/c':<30}")
rel = {}
for x in (0.1, 0.3, 0.6, 0.9):
W = x * wh
s = W * math.sqrt(1 + wp2 / (wh2 - W * W))
q0 = 2 * math.asin(s / 2)
v, vn, vc, _ = chain_run(q0, wp2, wh2, 0.02, 1000.0)
bare = math.cos(math.asin(W / 2)) # the bare chain's packet speed at the same frequency
rel[x] = v / 0.5
print(" " + f"{x:<8}{q0:<10.5f}{v:<16.9f}{vn:<16.9f}{v - vn:<+13.2e}{v / 0.5:<12.6f}{bare:<30.6f}")
check(abs(v - vn) < 1e-6, f"w/w_h = {x}: the run's speed is the law's")
print(f" Reading: near its tune the relay's packet falls to {rel[0.9]:.3f} of its slow-wave speed, while the bare chain at the")
print(" same frequencies stays within 0.5% of c. A hold to a place is a tune, and a tune is colour.")
check(rel[0.9] < 0.1 and rel[0.1] > 0.98, "the relay's speed depends on colour far below the grain; the bare chain's does not")
print(f" (section 3 took {time.time() - t0:.0f} s)")
# ----------------------------------------------------------------------------------------------------------------
# 4. Kelvin's gyrostat
# ----------------------------------------------------------------------------------------------------------------
def gimbal_path(A, h, w, amp, beta0, about="z", nper=8, npts=2048):
"""The gimbal's angle while the frame is turned to and fro by a given small twist, amp cos(w t).
The gimbal's axis is x'. At beta = 0 the spin lies along y'. z is the axis the gyrostat serves.
Exact equations [S, Lagrange], with h the wheel's spin momentum (constant, exactly) and A its moment about a diameter:
twist about z : A beta'' = +h theta' cos(beta) - A theta'^2 sin(beta) cos(beta)
twist about y': A beta'' = -h phi' sin(beta) + A phi'^2 sin(beta) cos(beta)
(in general A beta'' = h (W.m) - A (W.n)(W.m): W the frame's turning rate, n the spin's axis, m = dn/dbeta).
The deviation from beta0 is what is integrated, so that a drift of 1e-9 rad is not lost in rounding.
The start has the gimbal's rate in step with the twist, so that nothing drifts at first order
(a slow steady rate of third order is left by the sudden start: section 4e).
Returns the times, the deviation beta - beta0, and the gimbal's rate."""
z = about == "z"
def rhs(t, y):
b = beta0 + y[0]
rate = -amp * w * math.sin(w * t)
sc = math.sin(b) * math.cos(b)
if z:
return [y[1], (h * rate * math.cos(b) - A * rate * rate * sc) / A]
return [y[1], (-h * rate * math.sin(b) + A * rate * rate * sc) / A]
start = h * amp * (math.cos(beta0) if z else -math.sin(beta0)) / A
per = 2 * math.pi / w
ts = np.linspace(0.0, nper * per, nper * npts + 1)
sol = integrate.solve_ivp(rhs, (0.0, ts[-1]), [0.0, start], method="DOP853", t_eval=ts, rtol=1e-12, atol=1e-18)
return ts, sol.y[0], sol.y[1]
def in_step(ts, f, w, quarter=False):
"""Twice the mean of f(t) cos(w t) (or sin, if quarter) over whole periods, by the trapezoid rule.
With whole periods the rule is exact for the oscillating parts, and a steadily growing part contributes nothing to the
cos projection, as it should (the left-endpoint mean used in run 1 gave it -dt/2 times its slope)."""
g = f * (np.sin(w * ts) if quarter else np.cos(w * ts))
return 2 * (g[:-1] + g[1:]).sum() / (2 * (len(ts) - 1))
def gyro_response(A, If, h, w, th0, beta0, nper=8, npts=2048, full=False):
"""A flywheel in one gimbal on a frame turned about z by a given theta(t) = th0 cos(w t).
If: the frame's moment. The couple the frame needs [S, Lagrange]:
couple = (A cos^2(beta) + If) theta'' - 2 A theta' beta' sin(beta) cos(beta) + h beta' cos(beta)
Returns the couple's parts in step with theta and a quarter-period out of step, per unit th0
(or, if full, the times, the gimbal's deviation and the couple)."""
ts, dl, bd = gimbal_path(A, h, w, th0, beta0, "z", nper, npts)
b = beta0 + dl
thd = -th0 * w * np.sin(w * ts)
thdd = -th0 * w * w * np.cos(w * ts)
tau = (A * np.cos(b) ** 2 + If) * thdd - 2 * A * thd * bd * np.sin(b) * np.cos(b) + h * bd * np.cos(b)
if full:
return ts, dl, tau
return in_step(ts, tau, w) / th0, in_step(ts, tau, w, quarter=True) / th0
def section4():
head("4. Kelvin's gyrostat: can spin be the spring? (my own derivation; trial 21 has not been read)")
print(" A flywheel in one gimbal, on a frame that is turned through a small angle theta about an axis square to the spin.")
print(" Small angles [D]: gimbal rate = (h/A) theta; couple = [h^2/A - w^2 (A + If)] theta. A spring h^2/A and an inertia A + If.")
print(" So the couple changes sign at w_n = h/sqrt(A (A + If)): above it the gyrostat is a mass, not a spring.")
A, If, h, th0 = 1.0, 0.5, 2.0, 1e-5 # a hoop has C = 2A; unit spin rate gives h = 2
wn = h / math.sqrt(A * (A + If))
print(f" Units: A = 1, If = 0.5, h = 2 (a hoop at unit spin rate): spring h^2/A = {h * h / A:.3f}, w_n = {wn:.6f}.")
print(" " + f"{'w':<10}{'couple/theta, exact':<22}{'small-angle law':<20}{'difference':<14}{'out of step':<12}")
for w in (0.2, 0.8, 1.5, wn, 2.5):
a, b = gyro_response(A, If, h, w, th0, 0.0)
law = h * h / A - w * w * (A + If)
print(" " + f"{w:<10.6f}{a:<+22.10f}{law:<+20.10f}{a - law:<+14.2e}{b:<+12.2e}")
check(abs(a - law) < 1e-7 and abs(b) < 1e-7, f"w = {w:.4f}: the exact couple is the spring-and-inertia law's, with no loss")
print("\n 4b. A turned gimbal [D]: about a gimbal angle b0 the spring is (h^2/A) cos^2(b0) and the inertia A cos^2(b0) + If.")
print(" Run 1 failed this check at w = 0.2: a difference of -3.15e-06 against a tolerance of 1e-6, at a twist of 1e-5.")
print(" The cause is real. What is left over is second order in the twist and grows with the length of the run, because the")
print(" twist slowly turns the gimbal (4e). So here: the law at a smaller twist, then the order of what is left, then its size")
print(" against what the drift predicts: the law's slope in b0, -2 sin(b0) cos(b0) (h^2/A - w^2 A), times the drift's mean over")
print(" the run weighted by 2 cos^2(w t), which is C (T^2/12 + 1/(16 w^2)), C = twist^2 sin(b0) cos(b0) (h^2/A^2 - w^2).")
b0 = 0.5
sc = math.sin(b0) * math.cos(b0)
print(" " + f"{'w':<6}{'law':<16}{'exact - law, twist 1e-6':<26}{'twist 1e-5':<14}{'twist 1e-4':<14}{'ratios':<20}{'predicted at 1e-5':<18}")
for w in (0.2, 0.8):
law = h * h * math.cos(b0) ** 2 / A - w * w * (A * math.cos(b0) ** 2 + If)
diff = {}
for t0 in (1e-6, 1e-5, 1e-4):
a, b = gyro_response(A, If, h, w, t0, b0)
diff[t0] = a - law
T = 8 * 2 * math.pi / w
Cd = 1e-10 * sc * (h * h / (A * A) - w * w) # the drift's C at a twist of 1e-5
pred = -2 * sc * (h * h / A - w * w * A) * Cd * (T * T / 12 + 1 / (16 * w * w))
r1, r2 = diff[1e-5] / diff[1e-6], diff[1e-4] / diff[1e-5]
print(" " + f"{w:<6}{law:<+16.10f}{diff[1e-6]:<+26.3e}{diff[1e-5]:<+14.3e}{diff[1e-4]:<+14.3e}{f'{r1:.2f}, {r2:.2f}':<20}{pred:<+18.3e}")
check(abs(diff[1e-6]) < 1e-7, f"w = {w}: at a twist of 1e-6 a turned gimbal weakens the spring by cos^2(b0), to 1e-7")
check(abs(r2 / 100 - 1) < 0.02, f"w = {w}: what is left is second order in the twist (100 times larger for a twist 10 times larger)")
check(abs(diff[1e-5] / pred - 1) < 0.05, f"w = {w}: and at a twist of 1e-5 it is what the gimbal's drift predicts, to 5%",
f"({diff[1e-5] / pred:.4f} of it)")
print("\n 4c. A held twist [D]: the gimbal turns steadily at (h/A) theta0, and the couple is (h^2/A) theta0 cos(gimbal angle).")
print(" So the spring holds a steady twist only for a time of order A/(h theta0): it fades, reverses, and averages to zero.")
th0, tr = 0.01, 1.0
def theta_dot(t):
u = t / tr
return th0 * (30 * u**2 - 60 * u**3 + 30 * u**4) / tr if t < tr else 0.0
def rhs(t, y):
bb, bd = y
thd = theta_dot(t)
return [bd, (h * thd * math.cos(bb) - A * thd * thd * math.sin(bb) * math.cos(bb)) / A]
turn = 2 * math.pi * A / (h * th0)
sol = integrate.solve_ivp(rhs, (0.0, tr + 1.2 * turn), [0.0, 0.0], method="DOP853", dense_output=True, rtol=1e-12, atol=1e-16, max_step=tr / 20)
def couple(t): # after the ramp theta is steady, so only the last term is left
bb, bd = sol.sol(t)
return h * bd * math.cos(bb)
t_zero = optimize.brentq(couple, tr, tr + 0.4 * turn)
law_zero = tr / 2 + math.pi * A / (2 * h * th0)
print(f" theta0 = {th0}, ramp over {tr}: couple just after the ramp {couple(tr) / th0:.6f} per unit twist (spring {h * h / A:.6f});")
print(f" first zero of the couple at t = {t_zero:.4f} (law tr/2 + pi A/(2 h theta0) = {law_zero:.4f}); "
f"at half a gimbal turn the couple is {couple(tr / 2 + turn / 2) / th0:+.6f} per unit twist.")
check(abs(couple(tr) / th0 / (h * h / A) - 1) < 1e-3, "just after the twist is applied the couple is the spring's")
check(abs(t_zero / law_zero - 1) < 1e-3, "the couple of a held twist falls to zero after a quarter turn of the gimbal")
bd_end = sol.sol(tr)[1]
turn_exact = 2 * math.pi / bd_end
ts = np.linspace(tr, tr + turn_exact, 20001)
mean = np.mean([couple(t) for t in ts[:-1]])
print(f" mean couple over one whole gimbal turn: {mean / (h * h * th0 / A):+.2e} of the spring's value")
check(abs(mean / (h * h * th0 / A)) < 1e-6, "the mean couple of a held twist over a gimbal turn is zero")
print("\n 4d. Sizes [D]. Spin momentum h = C x spin rate; rim speed v = radius x spin rate.")
print(" " + f"{'wheel':<8}{'C':<10}{'A':<10}{'spring h^2/A':<16}{'w_n at If = 0 (in spin rates)':<32}")
for name, C_, A_ in (("disc", 0.5, 0.25), ("hoop", 1.0, 0.5)): # in units m r^2
print(" " + f"{name:<8}{C_:<10}{A_:<10}{C_ * C_ / A_:<6.3f}m v^2 {C_ / A_:<32.3f}")
print(" Wave speed if the spinners' own mass is the medium's inertia (Kelvin's reading: the medium moves bodily) [D]:")
print(" c_w^2 = (couple per radian per volume)/(4 x density); the 4 is because the turn of the medium is half the curl.")
rows = (("one hoop per cell, serving one axis", 2.0, 1), ("one disc per cell, serving one axis", 1.0, 1),
("three hoops per cell, one per axis", 2.0, 3), ("six hoops per cell, a counter-spinning pair per axis", 4.0, 6),
("six discs per cell, a pair per axis", 2.0, 6))
for name, spring, nwheel in rows:
cw = math.sqrt(spring / (4 * nwheel))
print(f" {name:<54} c_w = {cw:.4f} v ({cw * 0.5:.4f} c at rim speed c/2)")
check(abs(math.sqrt(2.0 / 4) * 0.5 - 0.35355) < 1e-5, "the best case (one hoop, one axis) at rim speed c/2 gives 0.354 c", "(the figure the brief quotes for trial 21)")
print(" In every case the wave is slower than the rim. With rim speed c/2 this reading cannot reach c.")
print(" In the wheel reading of this outline the gyrostat only replaces the band; the wheels supply the inertia,")
print(" and the speed is then set by the gearing. The pole at w_n and the fading of a held twist remain.")
print("\n 4e. Light's slow push on the gimbal [D; post hoc: found by following up run 1's failed check in 4b]")
print(" To second order in the twist, the gimbal's mean angle B under a to-and-fro twist of size a about a fixed axis obeys")
print(" A B'' = (1/4) (h^2/A - A w^2) a^2 sin(2 (B + chi)),")
print(" chi being the angle of the twist's axis from z, in the plane the spin axis can move in (chi = 0: about z, the axis")
print(" served; chi = 90 degrees: about y', the spin's own axis at B = 0). Each term: h^2/A is the gyrostat's spring, A w^2 the")
print(" wheel's own inertia about a diameter, a^2/2 the mean-square twist. In words: below w = h/A the spin axis is drawn toward")
print(" the twist's axis, where the gyrostat no longer resists that twist. So under a twist about z the working position B = 0")
print(" is a point of unstable balance; under a twist about y' it is stable. The two pushes are equal and opposite.")
npts = 2048
print(" (i) From rest at b0 = 0.5, twist 1e-5 about z: at whole periods the drift is (C/4) t^2, to second order in the twist.")
print(" " + f"{'w':<6}{'periods':<9}{'drift, exact (rad)':<22}{'(C/4) t^2':<18}{'ratio - 1':<12}")
for w in (0.2, 0.8):
ts, dl, _ = gyro_response(A, If, h, w, 1e-5, b0, full=True)
Cd = 1e-10 * sc * (h * h / (A * A) - w * w)
for nq in (2, 4, 8):
t = ts[nq * npts]
lawd = Cd * t * t / 4
print(" " + f"{w:<6}{nq:<9}{dl[nq * npts]:<22.9e}{lawd:<18.9e}{dl[nq * npts] / lawd - 1:<+12.2e}")
check(abs(dl[nq * npts] / lawd - 1) < 1e-4, f"w = {w}, {nq} periods: the gimbal's drift is (C/4) t^2")
amp2, w2 = 0.01, 0.8
gam = amp2 * math.sqrt((h * h / (A * A) - w2 * w2) / 2)
tilt = 1e-3
v0 = 2 * amp2**3 * h / (3 * A * w2 * w2) * (h * h / (2 * A * A) - w2 * w2)
print(f" (ii) Small tilts under a twist of {amp2} at w = {w2}. Rate g = twist x sqrt((h^2/A^2 - w^2)/2) = {gam:.6f}.")
print(" Two gimbals are started 2e-3 rad apart, at +1e-3 and -1e-3. Under a twist about z their separation should grow as")
print(" cosh(g t). Under a twist about y' the equation is odd in the gimbal's angle, so the second gimbal mirrors the first")
print(" exactly and one is run: its tilt should swing as cos(g t).")
print(" The test run before this one (run 2a, kept) followed one gimbal under the twist about z and failed its cosh check:")
print(" the tilt outgrew cosh(g t) by 10% after 5 periods and 22% after 25. The cause [D, by hand, after that test]: the")
print(" twist is switched on at its extreme, and that leaves the gimbal with a slow steady rate, third order in the twist")
print(" and the same whatever the tilt:")
print(f" v0 = (2 twist^3 h/(3 A w^2)) (h^2/(2 A^2) - w^2) = {v0:.4e} rad per unit time.")
print(" It is a seed set by the sudden start, not a steady push: with the gimbal at B = 0 the equation is unchanged when the")
print(" gimbal's angle and the twist both change sign, so a steady twist has no mean push there at any order. The seed")
print(" cancels in the separation of the two gimbals; their mean should follow (v0/g) sinh(g t).")
tz, dzp, _ = gimbal_path(A, h, w2, amp2, +tilt, "z", nper=25)
_, dzm, _ = gimbal_path(A, h, w2, amp2, -tilt, "z", nper=25)
_, dy, _ = gimbal_path(A, h, w2, amp2, +tilt, "y", nper=25)
print(" " + f"{'periods':<9}{'time':<10}{'about z: separation/start':<27}{'cosh(g t)':<11}{'about z: mean (rad)':<21}{'(v0/g) sinh(g t)':<18}"
f"{'about y: tilt/start':<21}{'cos(g t)':<10}")
okz = okm = oky = True
for nq in (5, 10, 15, 20, 25):
j = nq * npts
t = tz[j]
sep = (2 * tilt + dzp[j] - dzm[j]) / (2 * tilt)
mean = (dzp[j] + dzm[j]) / 2
mlaw = v0 / gam * math.sinh(gam * t)
ry = (tilt + dy[j]) / tilt
okz = okz and abs(sep / math.cosh(gam * t) - 1) < 0.01
okm = okm and abs(mean / mlaw - 1) < 0.02
oky = oky and abs(ry - math.cos(gam * t)) < 0.02
print(" " + f"{nq:<9}{t:<10.3f}{sep:<27.5f}{math.cosh(gam * t):<11.5f}{mean:<21.6e}{mlaw:<18.6e}{ry:<+21.5f}{math.cos(gam * t):<+10.5f}")
check(okz, "under a twist about the axis served, two gimbals started close together separate as cosh(g t), to 1%")
check(okm, "and their mean follows the start-up term (v0/g) sinh(g t), to 2%")
check(oky, "under a twist about the spin's own axis a small tilt swings as cos(g t), to 0.02 of the start: equal and opposite")
print(" Consequences [D]. A steady twist along one line (light polarized along one line) turns the gimbals that serve it away,")
print(" and their spring for that light fades. Any small tilt or slow rate is a seed, and it grows at the rate g. Twists of")
print(" equal mean square about z and y', with no fixed phase between them, push equally both ways: by hand (not run) their")
print(" cross terms average to zero, so light that is even in direction and unpolarized does not drive the drift at this")
print(" order. A twist whose axis itself turns (circular polarization) has a further term that I have not worked out.")
print(" This is one gyrostat under a given twist, not a medium.")
# ----------------------------------------------------------------------------------------------------------------
# 5. A dipole on one band
# ----------------------------------------------------------------------------------------------------------------
def self_field_static(N):
k = 2 * np.pi * np.arange(N) / N
sx = 4 * np.sin(k / 2) ** 2
K2 = sx[:, None, None] + sx[None, :, None] + sx[None, None, :]
rho = np.zeros((N, N, N))
rho[0, 0, 0] = -1.0 # the bound charges of a unit dipole on the band from the origin to x
rho[1, 0, 0] = +1.0
rk = np.fft.fftn(rho)
K2[0, 0, 0] = 1.0
Vk = rk / K2
Vk[0, 0, 0] = 0.0
V = np.fft.ifftn(Vk).real
return -(V[1, 0, 0] - V[0, 0, 0])
def lattice_sums(N, kappas):
"""Sums over the modes k != 0 of a periodic lattice of N cells a side, each divided by N^3. K_j^2 = 4 sin^2(k_j/2).
Returns G_N = the sum of 1/K^2, and for each kappa the pair
S_N = the sum of (1 - Kx^2/K^2)/(K^2 + kappa^2) (the band's own field: only the two transverse modes at each k answer),
R_N = the sum of 1/(K^2 + kappa^2) (the scalar sum, without its k = 0 mode)."""
k = 2 * np.pi * np.arange(N) / N
sx = 4 * np.sin(k / 2) ** 2
K2 = sx[:, None, None] + sx[None, :, None] + sx[None, None, :]
Kx2 = np.broadcast_to(sx[:, None, None], K2.shape)
K2[0, 0, 0] = np.inf
g = float((1.0 / K2).sum() / N**3)
out = []
for kap in kappas:
out.append((float(((1 - Kx2 / K2) / (K2 + kap * kap)).sum() / N**3), float((1.0 / (K2 + kap * kap)).sum() / N**3)))
return g, out
def bessel_green(kap=0.0):
"""Endless lattice: G(kappa) = (1/2) int_0^inf exp(-kappa^2 t/2) [exp(-t) I0(t)]^3 dt, with t = u^2."""
f = lambda u: 2 * u * math.exp(-0.5 * kap * kap * u * u) * special.ive(0, u * u) ** 3
a, ea = integrate.quad(f, 0, 1, limit=400, epsabs=1e-13, epsrel=1e-13)
b, eb = integrate.quad(f, 1, np.inf, limit=800, epsabs=1e-13, epsrel=1e-13)
return 0.5 * (a + b), 0.5 * (ea + eb)
def ive0(x):
"""exp(-x) I0(x). scipy's routine returns nan above about x = 1e12 (met in test run 2a). Beyond x = 1e4 the standard
asymptotic series [S] is used: (2 pi x)^(-1/2) (1 + y + (9/2) y^2 + (75/2) y^3), y = 1/(8x); the next term is below 1e-16 there."""
if x < 1e4:
return float(special.ive(0, x))
y = 1.0 / (8.0 * x)
return (1.0 + y * (1.0 + 4.5 * y * (1.0 + (25.0 / 3.0) * y))) / math.sqrt(2.0 * math.pi * x)
def green_drop(kap):
"""G(0) - G(kappa) for the endless lattice, computed directly and not as a difference of two integrals:
int_0^inf u (1 - exp(-kappa^2 u^2/2)) [exp(-u^2) I0(u^2)]^3 du."""
f = lambda u: u * (-math.expm1(-0.5 * kap * kap * u * u)) * ive0(u * u) ** 3
edges = (0.0, 1.0, 1.0 / kap, 10.0 / kap, np.inf)
return sum(integrate.quad(f, lo, hi, limit=400, epsabs=1e-16, epsrel=1e-12)[0] for lo, hi in zip(edges[:-1], edges[1:]))
def section5():
head("5. A dipole on one band: matter's local field on the lattice")
print(" A dipole p on a band is charges -p/d and +p/d on the band's two vertices. Its own field back on that band [D]:")
print(" E_self = -(p/(3 eps0 d^3)) (1 - 1/cells): Lorentz's 1/3, exactly, from the cube's symmetry alone.")
print(" " + f"{'cells per side':<16}{'E_self (units p/(eps0 d^3))':<30}{'law':<16}{'difference':<12}")
for N in (4, 8, 16, 32):
e = self_field_static(N)
law = -(1 - 1 / N**3) / 3
print(" " + f"{N:<16}{e:<+30.12f}{law:<+16.12f}{e - law:<+12.1e}")
check(abs(e - law) < 1e-12, f"{N} cells per side: the band's own field is -(1/3)(1 - 1/cells)")
print(" Consequence [D]: a band's charge answering the whole field on it (bare polarizability a_b) gives, with every band filled,")
print(" eps_r = 1 + a_b/(eps0 d^3). Written with the polarizability a of one such charge alone on the lattice,")
print(" 1/a = 1/a_b + 1/(3 eps0 d^3), this is (1 + 2y)/(1 - y), y = a/(3 eps0 d^3): Clausius and Mossotti's law, exactly.")
for y in (0.01, 0.2, 0.6):
ab = 3 * y / (1 - y) # a_b/(eps0 d^3)
lhs, rhs = 1 + ab, (1 + 2 * y) / (1 - y)
check(abs(lhs - rhs) < 1e-14, f"y = {y}: 1 + a_b/(eps0 d^3) equals (1 + 2y)/(1 - y)", f"({lhs:.6f})")
print("\n The lattice Green function at the origin, G(0) (Watson's integral over 2):")
mp.mp.dps = 40
gam = mp.sqrt(6) / (96 * mp.pi**3) * mp.gamma(mp.mpf(1) / 24) * mp.gamma(mp.mpf(5) / 24) * mp.gamma(mp.mpf(7) / 24) * mp.gamma(mp.mpf(11) / 24)
kk = (2 - mp.sqrt(3)) * (mp.sqrt(3) - mp.sqrt(2))
wat = 4 / mp.pi**2 * (18 + 12 * mp.sqrt(2) - 10 * mp.sqrt(3) - 7 * mp.sqrt(6)) * mp.ellipk(kk**2) ** 2
g_b, err_b = bessel_green(0.0)
print(f" by the gamma-function form (from memory): W = {mp.nstr(gam, 20)} ; by Watson's elliptic form (from memory): W = {mp.nstr(wat, 20)}")
print(f" by my own integral (Bessel form, numerical): G(0) = {g_b:.12f} (quoted error {err_b:.1e}) ; W/2 = {mp.nstr(gam / 2, 14)}")
check(abs(gam - wat) < mp.mpf(10) ** -30, "the two closed forms recalled from memory agree to 30 digits")
check(abs(g_b - float(gam / 2)) < 1e-9, "and my numerical integral agrees with them: G(0) = 0.2527310098")
G0 = float(gam / 2)
kappas = (0.1, 0.2)
sums = {}
for N in (40, 80, 160):
sums[N] = lattice_sums(N, kappas)
ex1 = 2 * sums[80][0] - sums[40][0]
ex2 = 2 * sums[160][0] - sums[80][0]
print(f" by sums over the modes of a periodic lattice: {sums[40][0]:.8f} (40), {sums[80][0]:.8f} (80), {sums[160][0]:.8f} (160); "
f"with the 1/N term removed: {ex1:.8f}, {ex2:.8f}")
check(abs(ex2 - G0) < 2e-6, "the mode sums converge to the same G(0)")
print("\n The moving part of the band's own field, at small frequency w [D]:")
print(" E_self = (p/(eps0 d^3)) [ -1/3 + (2/3) G(0) (w d/c)^2 + i (w d/c)^3/(6 pi) + ... ].")
print(" The last term is p w^3/(6 pi eps0 c^3): the field that takes from the charge exactly what Larmor's formula says it radiates.")
print(" Check at imaginary frequency w = i kappa (no poles): S(kappa) = (2/3) G(kappa) = (2/3) G(0) - kappa/(6 pi) + ... ;")
print(" S = the mean over the modes of (1 - Kx^2/K^2)/(K^2 + kappa^2); G(kappa) = the endless lattice's scalar Green function.")
print(" Run 1 compared a periodic lattice's S, which has no k = 0 mode, with (2/3) G(kappa), which includes that mode's")
print(" neighbourhood. It failed three checks by exactly the missing term, (2/3)/(kappa^2 N^3). Corrected here:")
print(" by the cube's symmetry Kx^2/K^2 averages to 1/3 at each K^2, so S = (2/3) R exactly, R = the scalar sum without k = 0;")
print(" and R + 1/(kappa^2 N^3) tends to G(kappa) as fast as exp(-kappa N).")
c1 = {}
Nbig = 160
target = -1 / (6 * math.pi)
for i, kap in enumerate(kappas):
s_lat, r_lat = sums[Nbig][1][i]
k0 = (2.0 / 3) / (kap * kap * Nbig**3)
g_k, _ = bessel_green(kap)
c1[kap] = (s_lat + k0 - 2 * G0 / 3) / kap
print(f" kappa = {kap}: S ({Nbig} per side) {s_lat:.10f}; the k = 0 term {k0:.10f}; their sum {s_lat + k0:.10f}; "
f"(2/3) G(kappa) {2 * g_k / 3:.10f}; [sum - (2/3)G(0)]/kappa = {c1[kap]:+.7f}")
check(abs(s_lat - 2 * r_lat / 3) < 1e-13, f"kappa = {kap}: S is (2/3) of the scalar sum, to rounding", f"({s_lat - 2 * r_lat / 3:+.1e})")
check(abs(s_lat + k0 - 2 * g_k / 3) < 1e-8, f"kappa = {kap}: with the k = 0 term, the sum is (2/3) of the endless lattice's Green function",
f"({s_lat + k0 - 2 * g_k / 3:+.1e})")
slope = 2 * c1[0.1] - c1[0.2]
print(f" extrapolated to kappa = 0 from these two: {slope:+.6f}; -1/(6 pi) = {target:+.6f}")
check(abs(slope / target - 1) < 5e-3, "the linear term is -kappa/(6 pi), to 0.5% from kappa = 0.1 and 0.2")
print(" The same from the endless lattice at smaller kappa, the drop computed directly (no subtraction):")
print(" G(0) - G(kappa) = int_0^inf u (1 - exp(-kappa^2 u^2/2)) [exp(-u^2) I0(u^2)]^3 du.")
print(" (Test run 2a got 'nan' here: scipy's exp(-x) I0(x) fails above about x = 1e12. Beyond x = 1e4 its asymptotic series is used.)")
join = ive0(1e4) / float(special.ive(0, 1e4)) - 1
check(abs(join) < 1e-13, "the series for exp(-x) I0(x) meets scipy's value at x = 1e4", f"({join:+.1e})")
cc = {}
for kap in (0.04, 0.02, 0.01):
cc[kap] = -(2.0 / 3) * green_drop(kap) / kap
print(f" kappa = {kap}: -(2/3) [G(0) - G(kappa)]/kappa = {cc[kap]:+.9f}")
ex_a, ex_b = 2 * cc[0.02] - cc[0.04], 2 * cc[0.01] - cc[0.02]
print(f" with the next term removed: {ex_a:+.9f} (from 0.04 and 0.02), {ex_b:+.9f} (from 0.02 and 0.01); -1/(6 pi) = {target:+.9f}")
check(abs(green_drop(0.1) - (G0 - bessel_green(0.1)[0])) < 1e-9, "the direct drop agrees with the difference of the two integrals at kappa = 0.1")
check(abs(ex_b / target - 1) < 1e-4, "the linear term is -kappa/(6 pi) to 1 part in 10^4: Larmor's radiation term arises by itself",
f"({ex_b / target - 1:+.1e})")
print(f" The w^2 term is an inertia: a charge q on a band gains the mass (2/3) G(0) q^2/(eps0 d c^2) = {2 * G0 / 3:.6f} q^2/(eps0 d c^2),")
print(f" which is 4/3 of its field energy G(0) q^2/(2 eps0 d) over c^2: the old electromagnetic mass, with its old 4/3.")
return G0
# ----------------------------------------------------------------------------------------------------------------
# 6. Numbers
# ----------------------------------------------------------------------------------------------------------------
def W_lat(q):
"""Light's law on the lattice in units c = d = 1: W(q) = 2 sqrt(sum_j sin^2(q_j/2)), for an array of wave vectors."""
return 2.0 * np.sqrt((np.sin(q / 2.0) ** 2).sum(axis=-1))
def emit_ratio(p, k, m):
"""(E(p) - E(p - k))/W(k) for a body that shares the lattice's law, E = sqrt(m^2 + W^2). The numerator is formed without
subtracting nearly equal numbers: W(p)^2 - W(p - k)^2 = 4 sum_j sin(p_j - k_j/2) sin(k_j/2)."""
num = 4.0 * (np.sin(p - k / 2.0) * np.sin(k / 2.0)).sum(axis=-1)
return num / ((np.sqrt(m * m + W_lat(p) ** 2) + np.sqrt(m * m + W_lat(p - k) ** 2)) * W_lat(k))
def section6(G0):
head("6. Numbers: what the measurements allow for the cell size d, and what the lattice costs")
c, hbar, e, eps0, G = K.c, K.hbar, K.e, K.epsilon_0, K.G
me_eV = K.m_e * c * c / e
alpha = K.fine_structure
pc = K.parsec
hbarc = hbar * c / e # eV m
H0 = 67.4e3 / (1e6 * pc) # [I] as trial 23's lock and my T1 scripts used it
Om = 0.3153 # [I] the same
print(f" [S] CODATA via scipy {scipy.__version__}: c = {c}, hbar = {hbar:.9e}, e = {e:.9e}, eps0 = {eps0:.10e}, G = {G:.5e},")
print(f" m_e c^2 = {me_eV:.4f} eV, 1/alpha = {1 / alpha:.6f}, hbar c = {hbarc:.6e} eV m, parsec = {pc:.6e} m")
print(f" [I] flat cosmology H0 = 67.4 km/s/Mpc, Omega_m = {Om} (as trial 23's lock and my T1 scripts used them)")
def Tn(n, z):
return integrate.quad(lambda t: (1 + t) ** n / (H0 * math.sqrt(Om * (1 + t) ** 3 + 1 - Om)), 0, z, epsabs=0, epsrel=1e-12)[0]
for z in (0.903, 0.900):
print(f" z = {z}: T0 = {Tn(0, z):.4e} s, T1 = {Tn(1, z):.4e} s, T2 = {Tn(2, z):.4e} s")
T2a, T2b = Tn(2, 0.903), Tn(2, 0.900)
which = "0.903" if abs(T2a / 6.6835e17 - 1) < abs(T2b / 6.6835e17 - 1) else "0.900"
T2 = T2b # Abdo's own choice: the 1-sigma lower limit on the redshift
print(f" My T1 report's T2 = 6.6835e17 s is the z = {which} value. Below I use z = 0.900 (Abdo et al.: 'The 1-sigma lower limit on the")
print(f" redshift (z = 0.900) is used for all our limits'): T2 = {T2:.4e} s.")
check(min(abs(T2a / 6.6835e17 - 1), abs(T2b / 6.6835e17 - 1)) < 1e-4, "T2 reproduces the value in my T1 report at one of the two redshifts")
print("\n 6a. The grain's delay against GRB 090510 [I: Abdo et al. 2009, Table 2, read at source]")
print(" Delay of a photon of energy E against a soft one [D]: dt = (S4/8) (E d/(hbar c))^2 T2. So d < (hbar c/E) sqrt(8 dt/(S4 T2)).")
print(" The same number as a quadratic 'quantum-gravity' energy [S, Jacob and Piran's convention]: E_QG2 = (hbar c/d) sqrt(12/S4).")
print(" " + f"{'limit':<52}{'d below, cube axis':<21}{'face diagonal':<16}{'cube diagonal':<16}{'E_QG2 (GeV)':<13}")
rows = (("(a) 0.859 s, a delay; 28.0 GeV", 0.859, 28.0e9), ("(e) 10 ms, either sign; 28.0 GeV (Abdo's energy)", 0.010, 28.0e9),
("(e) 10 ms, either sign; 31 GeV (the trial's energy)", 0.010, 31.0e9))
dval = {}
for lab, dtl, E in rows:
ds = [(hbarc / E) * math.sqrt(8 * dtl / (S4 * T2)) for S4 in (1.0, 0.5, 1.0 / 3)]
dval[lab[:3] + str(int(E / 1e9))] = ds
print(" " + f"{lab:<52}{ds[0]:<21.3e}{ds[1]:<16.3e}{ds[2]:<16.3e}{E * math.sqrt(1.5 * T2 / dtl) / 1e9:<13.3e}")
print(" The lattice's orientation on the sky is not known. A cell larger than the cube-diagonal column is excluded whatever")
print(" the orientation; a cell smaller than the cube-axis column passes whatever the orientation.")
d_a, d_e = dval["(a)28"][2], dval["(e)28"][2]
dA = 6.374e-13 # [A] Aspden's lattice spacing, as the brief gives it
print(f" Excluded whatever the orientation: d > {d_a:.2e} m by (a), Abdo's 'most conservative limit'; d > {d_e:.2e} m by (e), their")
print(f" 'least conservative limit'. Passing whatever the orientation: d < {dval['(a)28'][0]:.2e} m by (a); d < {dval['(e)28'][0]:.2e} m by (e).")
print(f" Against Aspden's spacing {dA:.3e} m [A]: finer by at least {dA / d_a:.2e} (a) or {dA / d_e:.2e} (e).")
print(" Published, from memory and not checked: Vasileiou et al. 2013 give E_QG2 > 1.3e11 GeV (95%), between rows (a) and (e).")
print("\n 6b. The mode must exist [I: the 1.42 PeV photon, LHAASO, as T1 and the locks used it; source not re-read by me]")
Eg = 1.42e15
print(f" Top of the band along a cube axis is 2 hbar c/d: d < {2 * hbarc / Eg:.3e} m. Far weaker than 6a.")
print(f" Aspden's spacing [A]: band top {2 * hbarc / dA / 1e6:.4f} MeV along an axis, {2 * math.sqrt(3) * hbarc / dA / 1e6:.4f} MeV at the zone corner;")
print(f" so a wheel-and-band lattice at Aspden's spacing cannot carry the {Eg / 1e15} PeV photon: short by {Eg / (2 * hbarc / dA):.2e} along an axis.")
print("\n 6c. No light given off by fast electrons in the vacuum (holds only if matter's own limit is light's slow-wave speed) [D]")
print(" Photon w = c k (1 - eta k^2), eta = d^2 S4/24; electron ordinary. In units hbar = c = 1, energy and momentum balance for")
print(" e -> e + photon (momenta p -> p - k, k) when eta = m^2/(2 k^2 p (p - k)); the least such eta is 27 m^2/(8 p^4), at k = 2p/3. So")
print(" d_th = 9 hbar c (m_e c^2)/(E_e^2 sqrt(S4)), reached first for a photon taking 2/3 of the electron's momentum.")
for lab, Ee in (("1.1 PeV electrons (inferred for the Crab; as T1 used)", 1.1e15), ("40 TeV electrons (H.E.S.S.; as T1 used)", 40e12)):
dth = [9 * hbarc * me_eV / (Ee * Ee * math.sqrt(S4)) for S4 in (1.0, 0.5, 1.0 / 3)]
print(f" {lab:<56} d below {dth[0]:.3e} m (axis), {dth[1]:.3e} (face diagonal), {dth[2]:.3e} (cube diagonal)")
if Ee == 1.1e15:
d_ch = dth
# exact check with the lattice's own dispersion along an axis, 60 digits
mp.mp.dps = 60
def fmax(Ee, d):
m, E = mp.mpf(me_eV), mp.mpf(Ee)
P = mp.sqrt(E * E - m * m)
ed = mp.mpf(hbarc) / mp.mpf(d)
best = None
for i in range(1501):
kap = P * (mp.mpf(1) / 2 + mp.mpf(3) / 10 * i / 1500)
f = E - mp.sqrt((P - kap) ** 2 + m * m) - 2 * ed * mp.sin(kap / (2 * ed))
best = f if best is None or f > best else best
return best
lo, hi = fmax(1.1e15, d_ch[0] * (1 - 1e-4)), fmax(1.1e15, d_ch[0] * (1 + 1e-4))
print(f" Exact balance of energy and momentum on the lattice (cube axis, 1.1 PeV): largest surplus {mp.nstr(lo, 4)} eV just below d_th, "
f"{mp.nstr(hi, 4)} eV just above.")
check(lo < 0 < hi, "the closed form for d_th is the exact threshold to 1 part in 10^4")
for f in (0.25, 0.0):
Eh = (1.1e15**2 / me_eV) * math.sqrt(4 * (1 - f) / 27)
print(f" The same kinematics for a relay with a tune, f = {f}: tune above {Eh:.3e} eV.")
if f == 0.25:
check(abs(Eh / 7.89e23 - 1) < 2e-3, "it reproduces my T1 report's 7.89e23 eV for the relay at f = 0.25")
kth = (2 / 3) * 1.1e15 / hbarc
print(f" At threshold k d = {kth * d_ch[0]:.2e}: the long-wave law applies.")
print("\n 6d. Evenness of the frame [S: Rayleigh; D]")
print(" If the bands' stiffness differs from cell to cell at random by a fraction delta, light scatters: mu = k^4 delta^2 d^3/(6 pi).")
L = 1.4e3 * pc
kg = Eg / hbarc
print(f" The {Eg / 1e15} PeV photon crossed 1.4 kpc = {L:.3e} m [I, as T1 used]: delta < sqrt(6 pi/(k^4 d^3 L)).")
lP = math.sqrt(hbar * G / c**3)
for lab, d in (("d at (e)'s cube-diagonal value", d_e), ("d at the axis bound of (e), 31 GeV", dval["(e)31"][0]), ("d at the Cherenkov bound (cube diagonal)", d_ch[2]), ("d = the Planck length", lP)):
print(f" {lab:<44} d = {d:.3e} m: delta < {math.sqrt(6 * math.pi / (kg**4 * d**3 * L)):.2e}")
d1 = (6 * math.pi / (kg**4 * L)) ** (1 / 3)
print(f" delta of order 1 (no order at all) is allowed only for d < {d1:.2e} m (my T1 report: 4.2e-36 m for a gas-like level).")
print("\n 6e. Other scales")
print(f" Planck length {lP:.4e} m [S]: the grain's delay for the 31 GeV photon would be {(1 / 8) * (31e9 * lP / hbarc) ** 2 * T2:.2e} s along an axis.")
lam = 1064e-9 # [I] Herrmann et al. 2009: 'Two Nd:YAG lasers at lambda = 1064 nm' (read at source)
klab = 2 * math.pi / lam
print(f" Laboratory isotropy [I: Herrmann et al. 2009, 'an anisotropy of the speed of light of dc/c ~ 1 x 10^-17', 1064 nm]:")
print(f" axis against cube diagonal the phase speeds differ by (kd)^2/36, so d < {math.sqrt(36e-17) / klab:.2e} m. Far weaker than 6a.")
for lab, d in (("(e), cube diagonal", d_e), ("Cherenkov bound, cube diagonal", d_ch[2])):
print(f" At d = {d:.2e} m ({lab}) the grain at 1064 nm is n - 1 = {(klab * d) ** 2 / 24:.1e} along an axis.")
print("\n 6f. If a gyrostat is the spring (Variant G): its pole [D; bounds as in T1, with f = 0]")
print(" n^2 = 1/(1 - (E/E_n)^2): delay (3/2)(E/E_n)^2 T2, and nothing propagates above E_n. w_n is at most twice the spin rate.")
print(" " + f"{'bound from':<52}{'E_n above (eV)':<16}{'spin rate above (rad/s)':<25}{'radius below at rim speed c/2 (m)':<34}")
En = {}
for lab, dtl, E in rows:
En[lab] = E * math.sqrt(1.5 * T2 / dtl)
En["no vacuum Cherenkov light, 1.1 PeV electrons"] = (1.1e15**2 / me_eV) * math.sqrt(4 / 27)
for lab, v in En.items():
wn = v * e / hbar
print(" " + f"{lab:<52}{v:<16.3e}{wn / 2:<25.3e}{c / wn:<34.3e}")
wA = 511e3 * e / hbar
print(f" Aspden's rhythm, 511 keV [A]: {wA:.3e} rad/s. As the spin rate it puts the pole at or below 1.022 MeV: short of the weakest bound")
print(f" above by {min(En.values()) / 1.022e6:.2e}. Light above 1.022 MeV would not travel at all.")
print(" Doug's rim speed c/2 is not excluded by this: it needs spinners smaller than the last column.")
print(" Fading of a held field (section 4c): gimbal angle = w_n x (time integral of E)/E_rad, E_rad = the field that stands for one radian.")
BL = 5e-10 * 1e3 * pc # from memory: a 5 microgauss Galactic field crossed over 1 kpc
print(f" A cell crossed by the Galaxy's field (5 microgauss over 1 kpc, from memory) sees int E dt = B L = {BL:.2e} V s/m.")
Eplanck = (c**4 / G) / math.sqrt(4 * math.pi * eps0 * hbar * c)
for lab, v in En.items():
print(f" {lab:<52} E_rad above {v * e / hbar * BL:.1e} V/m for the gimbals to turn less than a radian")
print(f" (the Planck field is {Eplanck:.2e} V/m)")
print(" Light's slow push (section 4e). Rough and post hoc; the inputs are from memory; no check is attached.")
print(" Far below w_n a small tilt of a gimbal grows by cosh(w_n F/E_rad), F = (the rms field of that part of steady light which is")
print(" uneven in direction or polarization) x (the time it keeps its direction).")
u_cmb = 4 * K.Stefan_Boltzmann / c * 2.7255**4
E_cmb = math.sqrt(u_cmb / eps0)
F_cmb = E_cmb * math.sqrt(1e-5) * 4.35e17
u_gal = 0.5 * e * 1e6
E_gal = math.sqrt(u_gal / eps0)
F_gal = E_gal * math.sqrt(0.3) * 30e3 * pc / 6e5
print(f" The microwave background today: {u_cmb:.3e} J/m^3, rms field {E_cmb:.4f} V/m; its quadrupole is about 1e-5 of the intensity;")
print(f" over the age of the universe, 4.35e17 s: F about {F_cmb:.1e} V s/m (it was brighter earlier, so this is the low end).")
print(f" Starlight inside a galaxy: about 0.5 eV/cm^3, rms field {E_gal:.3f} V/m, uneven by about 0.3; a cell crossing 30 kpc at 600 km/s")
print(f" is inside for {30e3 * pc / 6e5:.1e} s: F about {F_gal:.1e} V s/m.")
print(f" Both are about 1e14 V s/m, {1e14 / BL:.0f} times the held field's figure above. For the tilt not to grow, E_rad above about 1e14 V s/m x w_n:")
print(" " + "; ".join(f"{v * e / hbar * 1e14:.0e} V/m" for v in En.values()) + " for the four rows.")
print(" A cost of Variant G, not a bound: this is one gyrostat under a given twist, not a medium.")
print("\n 6g. Aspden's lattice as held charges [A: spacing, quon energy, rhythm, from the brief's M1; D]")
Nq = 1 / dA**3
mq = 20.84e3 * e / c**2
wp = math.sqrt(Nq * e * e / (eps0 * mq))
share = (wp * hbar / e / 511e3) ** 2
print(f" N = 1/d^3 = {Nq:.3e} /m^3; quon mass {mq:.3e} kg; plasma energy hbar w_p = {wp * hbar / e / 1e3:.1f} keV; held at 511 keV its share")
print(f" of the vacuum's response would be (w_p/w_h)^2 = {share:.4f}, with a pole at 511 keV.")
for lab, hmax in (("timing, limit (e): share < 4.825e-20 (my T1 report)", 4.825e-20), ("absorption sweep: share < 3.0e-39 (my T1 report)", 3.0e-39)):
print(f" {lab:<56} -> its charge as light sees it must be below {math.sqrt(hmax / share):.1e} e")
print(" (trial 11's bound, as the brief gives it: 1.5e-16.) So Aspden's quons cannot be ordinary charges of the carrier.")
print("\n 6h. The lattice's own numbers [D]")
print(f" One notch of charge e through one face: band energy e^2/(2 eps0 d) against hbar c/d: 2 pi alpha = {2 * math.pi * alpha:.5f}. One pure number, put in.")
print(f" Field at which a band is stretched by a whole notch: e/(eps0 d^2) = {e / eps0:.4e}/d^2 V/m: "
f"{e / eps0 / d_e**2:.1e} V/m at d = {d_e:.2e} m.")
print(f" Field energy of one point charge e on the lattice: G(0) e^2/(2 eps0 d) = {G0 * e / (2 * eps0):.4e}/d eV: "
f"{G0 * e / (2 * eps0) / d_e:.2e} eV at d = {d_e:.2e} m (the electron is 5.11e5 eV).")
zm = []
for Nz in (100, 200):
k = 2 * math.pi * (np.arange(Nz) + 0.5) / Nz
sx = np.sin(k / 2) ** 2
zm.append(float((2 * np.sqrt(sx[:, None, None] + sx[None, :, None] + sx[None, None, :])).mean()))
print(f" Zero-point energy if the wheels and bands are quantized: (hbar c/d^4) x mean of omega d/c over the zone = {zm[1]:.5f} hbar c/d^4 "
f"(grid 100: {zm[0]:.5f}).")
rho_c = 3 * H0**2 / (8 * math.pi * G)
rhoP = c**5 / (hbar * G**2)
for lab, d in (("(e), cube diagonal", d_e), ("Cherenkov bound, cube diagonal", d_ch[2]), ("Planck length", lP)):
rho = zm[1] * hbar / (c * d**4)
print(f" at d = {d:.2e} m ({lab}): {rho:.2e} kg/m^3 = {rho / rho_c:.1e} critical = {rho / rhoP:.1e} Planck densities")
print(f" (critical density {rho_c:.3e} kg/m^3; Planck density {rhoP:.3e} kg/m^3)")
print("\n 6i. The speed at every colour [D]: by what fraction a packet is slower than c, along a cube axis (the slowest direction)")
print(" Exact on the lattice: n_g - 1 = 1/cos(kd/2) - 1 = 2 sin^2(kd/4)/cos(kd/2), computed in that form (no subtraction from 1).")
kpc_s = 1e3 * pc / c
colours = (("radio, 100 MHz", K.h * 1e8 / e), ("laser light, 1064 nm", K.h * c / (1064e-9 * e)), ("X-rays, 10 keV", 1e4),
("gamma rays, 511 keV", 511e3), ("GRB 090510's photon, 28.0 GeV", 28.0e9), ("LHAASO's photon, 1.42 PeV", Eg))
worst = {}
for lab, d in (("the largest cell that passes limit (e) whatever the lattice's orientation", dval["(e)28"][0]),
("the largest cell that passes 6c's condition whatever the orientation", d_ch[0])):
print(f" d = {d:.3e} m ({lab}); top of the band 2 hbar c/d = {2 * hbarc / d:.3e} eV")
print(" " + f"{'colour':<34}{'energy (eV)':<14}{'k d':<12}{'n_g - 1':<12}{'seconds lost per kiloparsec':<28}")
for name, E in colours:
kd = E * d / hbarc
ng1 = 2 * math.sin(kd / 4) ** 2 / math.cos(kd / 2)
worst[d] = ng1
print(" " + f"{name:<34}{E:<14.4e}{kd:<12.3e}{ng1:<12.3e}{ng1 * kpc_s:<28.3e}")
kd = 28.0e9 * dval["(e)28"][0] / hbarc
dt_e = 2 * math.sin(kd / 4) ** 2 / math.cos(kd / 2) * T2
check(abs(dt_e / 0.010 - 1) < 1e-9, "at the first cell size the 28.0 GeV photon of GRB 090510 loses limit (e)'s 10 ms, as it should",
f"({dt_e * 1e3:.9f} ms)")
w1, w2 = worst[dval["(e)28"][0]], worst[d_ch[0]]
print(f" Reading: from radio to the PeV gamma rays every colour travels at c to within {w1:.0e} at the first cell size, and to within")
print(f" {w2:.0e} at the second. What is left is a delay that grows as the square of the energy; it shows first at the highest energies.")
print("\n 6j. If a body shares the lattice's own law [M; D]: no light is given off in the vacuum, at any energy")
print(" 6c took the electron's law as the ordinary one, E^2 = (m c^2)^2 + (p c)^2, with no grain in it. The other reading [M]: a body")
print(" is itself a wave on the wheels and bands, with a rest energy: E(p)^2 = (m c^2)^2 + (hbar c/d)^2 W(p d/hbar)^2, where")
print(" W(q) = 2 sqrt(sum_j sin^2(q_j/2)) is light's own law (hbar w = (hbar c/d) W(k d)). To give off a photon k the body needs")
print(" E(p) - E(p - k) = hbar w(k). W is periodic, so a kick taken up by the lattice is included.")
print(" Lemma [D]: W(a + b) <= W(a) + W(b). (W/2 is the length of the vector with parts sin(q_j/2), and")
print(" sin((a + b)/2) = sin(a/2) cos(b/2) + cos(a/2) sin(b/2), where no cosine is larger than 1.) Then, in units hbar = c = d = 1")
print(" and for any rest energy m > 0: E(p) - E(p - k) = (W(p)^2 - W(p - k)^2)/(E(p) + E(p - k)) < W(p) - W(p - k) <= W(k)")
print(" (and if W(p) <= W(p - k) the left side is not even positive). The balance is never met, whatever the energy, the")
print(" direction or the cell size.")
rng = np.random.default_rng(20261123)
Ns = 1_000_000
za = rng.uniform(-math.pi, math.pi, (Ns, 3))
zb = rng.uniform(-math.pi, math.pi, (Ns, 3))
lem = float((W_lat(za + zb) - W_lat(za) - W_lat(zb)).max())
tl = 10 ** rng.uniform(-3, 0, (Ns, 1))
sl = 10 ** rng.uniform(-3, 0, (Ns, 1))
n1 = rng.normal(size=(Ns, 3))
n1 /= np.linalg.norm(n1, axis=1, keepdims=True)
n2 = n1 + 0.01 * rng.normal(size=(Ns, 3))
n2 /= np.linalg.norm(n2, axis=1, keepdims=True)
la, lb = tl * n1, sl * n2
lem2 = float(((W_lat(la + lb) - W_lat(la) - W_lat(lb)) / (W_lat(la) + W_lat(lb))).max())
print(f" A million random pairs (a, b) over the whole zone: the largest W(a + b) - W(a) - W(b) is {lem:.4f}.")
check(lem <= 0, "the lemma holds on every pair of the zone sample")
print(" A million pairs of long waves nearly in line (lengths 0.001 to 1, within about a degree of each other), where the two")
print(f" sides are closest: the largest (W(a + b) - W(a) - W(b))/(W(a) + W(b)) is {lem2:.2e}.")
check(lem2 <= 0, "the lemma holds on every pair of the long-wave sample")
print(" The ratio (E(p) - E(p - k))/(hbar w(k)) must reach 1 for light to be given off. Largest values found (m in units hbar c/d):")
print(" " + f"{'m':<9}{'zone sample':<15}{'long-wave sample':<19}{'search from the best 12':<26}{'(sqrt(m^2 + 12) - m)/(2 sqrt 3)':<34}")
for mm in (1.0, 0.1, 0.01, 0.001):
r1 = emit_ratio(za, zb, mm)
r2 = float(emit_ratio(la, lb, mm).max())
top = -1.0
for i in np.argsort(r1)[-12:]:
res = optimize.minimize(lambda x: -float(emit_ratio(x[:3], x[3:], mm)), np.concatenate([za[i], zb[i]]), method="Nelder-Mead",
options=dict(xatol=1e-10, fatol=1e-15, maxiter=20000, maxfev=20000))
top = max(top, -res.fun)
closed = (math.sqrt(mm * mm + 12) - mm) / (2 * math.sqrt(3))
print(" " + f"{mm:<9}{float(r1.max()):<15.9f}{r2:<19.12f}{top:<26.12f}{closed:<34.12f}")
check(max(float(r1.max()), r2, top) <= closed + 1e-12 and abs(top - closed) < 1e-9 and closed < 1,
f"m = {mm}: no value above the closed form, the search ends on it, and it is below 1")
print(" The largest value is reached at the zone corner (p = k = (pi, pi, pi)/d: the body stops and the photon takes everything), and")
print(" all along a ridge on the cube diagonal, where tan(p d/2) tan((p - k) d/2) = m/sqrt(m^2 + 12). That it is the largest is a")
print(" finding of the search, not a proof; the proof above needs only that the ratio is below 1.")
mp.mp.dps = 40
A3 = 2 * mp.sqrt(3)
worst_r = mp.mpf(0)
for mm in (mp.mpf(1), mp.mpf("0.01")):
M = mp.sqrt(mm * mm + 12)
for tt in (mp.mpf(1), mp.mpf(2), mp.mpf(10)):
pp, qq = 2 * mp.atan(tt), 2 * mp.atan(mm / (M * tt))
R = (mp.sqrt(mm * mm + (A3 * mp.sin(pp / 2)) ** 2) - mp.sqrt(mm * mm + (A3 * mp.sin(qq / 2)) ** 2)) / (A3 * mp.sin((pp - qq) / 2))
worst_r = max(worst_r, abs(R - (M - mm) / A3))
check(worst_r < mp.mpf(10) ** -30, "on that ridge the ratio equals the closed form to 30 digits (six points; m = 1 and 0.01)",
f"(largest difference {mp.nstr(worst_r, 2)})")
mp.mp.dps = 60
def surplus(Ee, d, shared, lo, hi, n=1500):
"""Largest E(p) - E(p - k) - hbar w(k) along a cube axis, over photon momenta from lo to hi times the body's; in eV."""
m, E = mp.mpf(me_eV), mp.mpf(Ee)
ed = mp.mpf(hbarc) / mp.mpf(d)
P = 2 * ed * mp.asin(mp.sqrt(E * E - m * m) / (2 * ed)) if shared else mp.sqrt(E * E - m * m)
best = None
for i in range(n + 1):
kap = P * (mp.mpf(lo) + (mp.mpf(hi) - mp.mpf(lo)) * i / n)
rest = mp.sqrt(m * m + (2 * ed * mp.sin((P - kap) / (2 * ed))) ** 2) if shared else mp.sqrt((P - kap) ** 2 + m * m)
f = E - rest - 2 * ed * mp.sin(kap / (2 * ed))
best = f if best is None or f > best else best
return best
print(" The 1.1 PeV electron of 6c along a cube axis, in 60-digit arithmetic: the largest surplus E(p) - E(p - k) - hbar w(k), in eV.")
print(" " + f"{'cell size d (m)':<18}{'ordinary law, photon 0.5 to 0.8 of p':<39}{'lattice law, the same photons':<32}{'lattice law, photon 0.001 to 0.999 of p':<40}")
so, ss = [], []
for fac in (1 + 1e-4, 10.0, 1000.0):
d = d_ch[0] * fac
o = surplus(1.1e15, d, False, "0.5", "0.8")
s1 = surplus(1.1e15, d, True, "0.5", "0.8")
s2 = surplus(1.1e15, d, True, "0.001", "0.999", n=998)
so.append(o)
ss += [s1, s2]
print(" " + f"{d:<18.3e}{mp.nstr(o, 4):<39}{mp.nstr(s1, 4):<32}{mp.nstr(s2, 4):<40}")
check(all(x > 0 for x in so), "with the ordinary law the electron can give off light at all three cell sizes (the first is 6c's threshold)")
check(all(x < 0 for x in ss), "with the lattice's law the surplus is negative at every photon momentum tried, at all three cell sizes")
print(" Reading: 6c's bound on the cell size applies only if matter's law is the ordinary one while light's has the grain. If bodies")
print(" are waves on the same wheels and bands, that bound falls away, and the timing bounds of 6a are the ones that stand.")
print(" What matter must share in either reading [S; Coleman and Glashow 1999, from memory]: if an electron's limiting speed were")
print(" higher than light's long-wave speed by a fraction delta, it would give off light above m c^2/sqrt(2 delta): 1.1 PeV electrons")
print(f" need delta < {0.5 * (me_eV / 1.1e15) ** 2:.2e} (40 TeV electrons: {0.5 * (me_eV / 40e12) ** 2:.1e}). If it were lower, a photon above m c^2 sqrt(2/delta) would")
print(f" break into a pair: the {Eg / 1e15} PeV photon needs delta < {2 * (me_eV / Eg) ** 2:.2e}. The model does not explain that match unless matter")
print(" is built from the same wheels and bands.")
def main():
hd = subprocess.run(["git", "rev-parse", "HEAD"], capture_output=True, text=True).stdout.strip()
print("Checks of the outline's algebra: the wheel-and-band ether. The proposer's own checks; NOT a trial; nothing pre-registered.")
print("Run 2. Run 1 had four failed checks of 75; its script and output are kept (outline_checks_run1.py.txt,")
print("outline_checks_out_run1_4fails.txt). A test run of sections 4 to 6 after the first fixes (run 2a, also kept) had two")
print("failed checks of 44. What changed each time is listed at the top of the script and where it applies below.")
print("A first complete run 2 passed all 94 checks but printed one phrase of Abdo et al. against the wrong limit (6a);")
print("the wording was corrected and the script rerun: 94 of 94 again, and no number changed. Then one part, 6j (a body that")
print("shares the lattice's own law), was added with nine checks of its own, and this is that run. The two runs before it")
print("are kept too (..._before_wording_fix, ..._before_6j).")
print(f"git HEAD: {hd} ; python {sys.version.split()[0]} ; numpy {np.__version__} ; scipy {scipy.__version__} ; mpmath {mp.__version__}")
t0 = time.time()
section1()
section2()
section3()
section4()
G0 = section5()
section6(G0)
print(f"\nChecks: {checks[0]} of {checks[1]} pass. ({time.time() - t0:.0f} s)")
if __name__ == "__main__":
main()