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

a1_wave_law.py

In the investigation at sim/light_ether_review/check_m8_fable/a1_wave_law.py · last changed in commit 18dc38d, 23 November 2026 · 5,864 bytes · the folder as a zip


#!/usr/bin/env python3
"""A1 (blind): wave law of the wheel-and-band lattice, built from the lattice itself.

Lattice: cells of size d. A wheel (angle phi) on every face, a band (stretch s) on every edge.
s = S phi + slip, where (S phi)_edge = signed sum of the four wheel angles round the edge (a curl).
I phi'' = -kappa S^T s.  Units: d = 1, kappa = I = 1, so c = d sqrt(kappa/I) = 1.
"""
import subprocess, sys
import numpy as np

print("git HEAD:", subprocess.run(["git", "rev-parse", "HEAD"], capture_output=True, text=True).stdout.strip())
print("numpy", np.__version__)

def build_S(N):
    """Face->edge curl on an N^3 periodic cubic lattice.
    Faces: (a, i, j, k) with normal a, located at cell corner (i,j,k) + half-offsets in the two other axes.
    Edges: (a, i, j, k) along a, located at (i,j,k) + half-offset along a.
    An edge along a at corner (i,j,k) is ringed by four faces: the two faces normal to b that lie at
    (i,j,k) and (i,j,k)-e_c, and the two faces normal to c at (i,j,k) and (i,j,k)-e_b, where (a,b,c) cyclic.
    (S phi)_a = [phi_c(r) - phi_c(r - e_b)] - [phi_b(r) - phi_b(r - e_c)]   (discrete curl, no 1/d)."""
    nF = 3 * N**3
    idx = lambda a, i, j, k: ((a * N + i % N) * N + j % N) * N + k % N
    S = np.zeros((nF, nF))
    for a in range(3):
        b, c = (a + 1) % 3, (a + 2) % 3
        for i in range(N):
            for j in range(N):
                for k in range(N):
                    r = [i, j, k]
                    e = idx(a, i, j, k)
                    rb = r.copy(); rb[b] -= 1
                    rc = r.copy(); rc[c] -= 1
                    S[e, idx(c, *r)] += 1
                    S[e, idx(c, *rb)] -= 1
                    S[e, idx(b, *r)] -= 1
                    S[e, idx(b, *rc)] += 1
    return S

N = 4
S = build_S(N)
A = S.T @ S
w = np.linalg.eigvalsh(A)
print(f"\nN={N}: S^T S is {A.shape}, symmetric: {np.allclose(A, A.T)}, min eig {w.min():.3e}")
nzero = np.sum(np.abs(w) < 1e-9)
print(f"zero modes of S^T S: {nzero} of {A.shape[0]} (expected N^3 = {N**3} cell scalars, less 1 constant, plus 3 uniform-H modes... see text)")
# Fourier prediction: omega^2 = W(kd)^2 = 4 sum_j sin^2(k_j d/2), twice per k (transverse), plus 0 once per k.
ks = 2 * np.pi * np.arange(N) / N
pred = []
for kx in ks:
    for ky in ks:
        for kz in ks:
            W2 = 4 * (np.sin(kx / 2)**2 + np.sin(ky / 2)**2 + np.sin(kz / 2)**2)
            pred += [W2, W2, 0.0]
pred = np.sort(pred)
print("eigenvalues match Fourier formula (2 transverse + 1 zero per k):", np.allclose(np.sort(w), pred, atol=1e-9))

# Null space of S itself (curl-free face fields): dimension and content.
u, sv, vt = np.linalg.svd(S)
nullS = np.sum(sv < 1e-9)
print(f"null space of S (motions that stretch no band): {nullS} = N^3 - 1 + 3 = {N**3 - 1 + 3}? {nullS == N**3 - 1 + 3}")
# Check: gradient of a cell scalar is in the null space; the checkerboard 'free spin' is one such.
def grad_cells(psi):
    phi = np.zeros(3 * N**3)
    idx = lambda a, i, j, k: ((a * N + i % N) * N + j % N) * N + k % N
    for a in range(3):
        for i in range(N):
            for j in range(N):
                for k in range(N):
                    r = [i, j, k]; rm = r.copy(); rm[a] -= 1   # face at corner r, normal a, separates cell rm (behind) from cell r (ahead)
                    phi[idx(a, *r)] = psi[tuple(np.mod(r, N))] - psi[tuple(np.mod(rm, N))]
    return phi
psi_cb = np.fromfunction(lambda i, j, k: 0.5 * (-1.0)**(i + j + k), (N, N, N))
phi_cb = grad_cells(psi_cb)
print("free spin (checkerboard gradient): every wheel rate magnitude =", set(np.round(np.abs(phi_cb), 12)),
      "; max |S phi| =", f"{np.abs(S @ phi_cb).max():.2e}")
# Uniform field: all x-wheels same rate.
phi_u = np.zeros(3 * N**3); phi_u[:N**3] = 1.0
print("uniform H_x (all x-wheels one rate): max |S phi| =", f"{np.abs(S @ phi_u).max():.2e}")
# div H per cell for the free spin: sum of outward phi over the 6 faces.
def div_cells(phi):
    idx = lambda a, i, j, k: ((a * N + i % N) * N + j % N) * N + k % N
    out = np.zeros((N, N, N))
    for i in range(N):
        for j in range(N):
            for k in range(N):
                r = [i, j, k]
                for a in range(3):
                    rp = r.copy(); rp[a] += 1
                    out[i, j, k] += phi[idx(a, *rp)] - phi[idx(a, *r)]
    return out
dv = div_cells(phi_cb)
print("div(phi') per cell for the free spin: values", sorted(set(np.round(dv.ravel(), 12))), "(nonzero: a staggered magnetic-charge lattice)")
# Conservation: Div(S^T s) = 0 identically?
rng = np.random.default_rng(1)
s = rng.normal(size=3 * N**3)
print("max |div(S^T s)| over random s:", f"{np.abs(div_cells(S.T @ s)).max():.2e}  (div phi' is a constant of motion)")

# Long-wave phase and group delay; band top.
print("\nLong waves. omega = (c/d) W(kd), W = 2 sqrt(sum sin^2(k_j d/2)).")
def omega(k):
    return 2 * np.sqrt(np.sum(np.sin(np.asarray(k) / 2)**2))
for name, n in [("axis [100]", [1, 0, 0]), ("face diag [110]", [1, 1, 0]), ("body diag [111]", [1, 1, 1])]:
    n = np.array(n, float); n /= np.linalg.norm(n)
    F = np.sum(n**4)
    kd = 0.05
    om = omega(kd * n)
    h = 1e-6
    vg = np.array([(omega(kd * n + h * np.eye(3)[a]) - omega(kd * n - h * np.eye(3)[a])) / (2 * h) for a in range(3)])
    print(f"  {name:16s} F=sum n_j^4={F:.4f}  kd={kd}: 1-v_p/c = {1 - om / kd:.4e} (pred (kd)^2 F/24 = {kd**2 * F / 24:.4e});"
          f"  1-|v_g|/c = {1 - np.linalg.norm(vg):.4e} (pred (kd)^2 F/8 = {kd**2 * F / 8:.4e}); angle(v_g,k) = {np.degrees(np.arccos(np.dot(vg, n) / np.linalg.norm(vg))):.4f} deg")
print(f"band top: W_max = 2 sqrt(3) = {2 * np.sqrt(3):.4f} at kd = (pi,pi,pi); along an axis W(pi,0,0) = 2.  f_max = (sqrt3/pi) c/d = {np.sqrt(3) / np.pi:.4f} c/d")
print("polarisations: eigenvalue W^2 is doubly degenerate for every k (S^T S = d^2(|K|^2 - K K^T)): no birefringence at any k.")