Does light charge the quons? › Files cited on the page › check_trial23_fable/
dipole_lattice_dispersion_run1.py
#!/usr/bin/env python3
"""How light's speed changes with (k d)^2 on a simple cubic lattice of point dipoles (a 'relay of dipoles').
29th reviewer, task T1 (trial 23), comparison stage: post hoc, the reviewer's own derivation and code.
It answers the author's first place to look: "The spacing bound is for one dispersion law, beta = 1/24,
not for a relay of dipoles."
Physics, term by term (Gaussian units inside the bare space the dipoles sit in; d = 1):
* each lattice site holds a charge on a spring, far below its resonance: a fixed polarizability alpha;
* a wave p_j = p exp(i q.r_j) runs over the sites. Each dipole is driven by the retarded fields of ALL
the others: Lam(q, k) = sum over j != 0 of G(r_j) exp(i q.r_j), G = the field of an oscillating dipole,
k = omega / (speed of light in the bare space);
* the wave exists when 1/alpha = e.Lam.e (e = the direction of the dipoles, across q). That is the
dispersion law. In the limit k d -> 0 it is Clausius-Mossotti (the Lorentz local field);
* the first correction is B (k d)^2. B is computed here and compared with Draine and Goodman's
published form b1 + m^2 b2 + m^2 b3 S (coefficients quoted from memory).
The lattice sum is done in Fourier space with Gaussian-smeared dipoles (width sigma << d):
field of all dipoles at site 0 = (4 pi/d^3) sum_g (k^2 - ((q+g).e)^2)/(|q+g|^2 - k^2) exp(-|q+g|^2 sigma^2)
minus the smeared dipole's own field at its centre (closed form), then divided by the form factor
exp(-k^2 sigma^2) that a smeared source has for a distant point. The result must not depend on sigma.
Run: OMP_NUM_THREADS=1 ~/aspden-review-venv/bin/python3 dipole_lattice_dispersion.py > dipole_lattice_dispersion_out.txt 2> dipole_lattice_dispersion_err.txt
"""
import math
import subprocess
import sys
import numpy as np
import scipy
from scipy.optimize import brentq
from scipy.special import erfi
NCHK = [0, 0]
def check(name, ok, detail=""):
NCHK[0] += 1
NCHK[1] += 1 if ok else 0
print(" CHECK %s: %s %s" % ("pass" if ok else "FAIL", name, detail))
def head(s):
print()
print("=" * 100)
print(s)
print("=" * 100)
_GRID = {}
def grid(nmax):
if nmax not in _GRID:
r = np.arange(-nmax, nmax + 1)
gx, gy, gz = np.meshgrid(r, r, r, indexing="ij")
_GRID[nmax] = 2 * math.pi * np.stack([gx.ravel(), gy.ravel(), gz.ravel()], axis=1).astype(float)
return _GRID[nmax]
def lam_ee(m, k, a_hat, e_hat, sigma=0.10):
"""Re of e.Lam.e for a wave q = m k a_hat, dipoles along e_hat (d = 1). Needs m > 1 and k small."""
nmax = int(math.ceil(math.sqrt(40.0) / (2 * math.pi * sigma))) + 1
Q = grid(nmax) + m * k * np.asarray(a_hat)[None, :]
Q2 = np.einsum("ij,ij->i", Q, Q)
Qe = Q @ np.asarray(e_hat)
tot = 4 * math.pi * np.sum((k * k - Qe**2) / (Q2 - k * k) * np.exp(-Q2 * sigma**2))
self_re = -1.0 / (6 * math.sqrt(math.pi) * sigma**3) + (4 * k * k / (3 * math.pi)) * (
math.sqrt(math.pi) / (2 * sigma) - 0.5 * math.pi * k * math.exp(-(k * sigma) ** 2) * erfi(k * sigma))
return math.exp((k * sigma) ** 2) * (tot - self_re)
def cm(m2):
"""d^3 / alpha for Clausius-Mossotti (Gaussian): (4 pi/3)(m^2 + 2)/(m^2 - 1)."""
return (4 * math.pi / 3) * (m2 + 2) / (m2 - 1)
def B_of(m2, k, a_hat, e_hat, sigma=0.10):
return (lam_ee(math.sqrt(m2), k, a_hat, e_hat, sigma) - cm(m2)) / k**2
def extrap(fun, ks=(0.2, 0.1, 0.05)):
"""Richardson: the value at k -> 0 of a function with error terms k^2, k^4."""
v = [fun(k) for k in ks]
r1 = (4 * v[1] - v[0]) / 3
r2 = (4 * v[2] - v[1]) / 3
return (16 * r2 - r1) / 15
s2, s3, s6 = math.sqrt(2), math.sqrt(3), math.sqrt(6)
CASES = (
("[100], dipoles along [010]", (1, 0, 0), (0, 1, 0)),
("[110], dipoles along [001]", (1 / s2, 1 / s2, 0), (0, 0, 1)),
("[110], dipoles along [1-10]", (1 / s2, 1 / s2, 0), (1 / s2, -1 / s2, 0)),
("[111], dipoles along [1-10]", (1 / s3, 1 / s3, 1 / s3), (1 / s2, -1 / s2, 0)),
("[111], dipoles along [11-2]", (1 / s3, 1 / s3, 1 / s3), (1 / s6, 1 / s6, -2 / s6)),
)
def S_of(a, e):
return sum((a[i] * e[i]) ** 2 for i in range(3))
if __name__ == "__main__":
try:
headc = subprocess.run(["git", "rev-parse", "HEAD"], capture_output=True, text=True, check=True).stdout.strip()
except Exception as ex: # pragma: no cover
headc = "unknown (%s)" % ex
print("The (k d)^2 law of a simple cubic lattice of point dipoles. 29th reviewer, post hoc, own derivation.")
print("git HEAD: %s ; python %s ; numpy %s ; scipy %s" % (headc, sys.version.split()[0], np.__version__, scipy.__version__))
head("1. Code checks: the static limit is Clausius-Mossotti; the result does not depend on the smearing width")
worst = 0.0
for m2 in (2.0, 4.0, 1 / 0.085):
for lab, a, e in CASES:
v = lam_ee(math.sqrt(m2), 1e-4, a, e)
worst = max(worst, abs(v / cm(m2) - 1))
check("k d = 1e-4: e.Lam.e equals (4 pi/3)(m^2+2)/(m^2-1) for every case", worst < 1e-6, "(worst relative difference %.1e)" % worst)
worst = 0.0
for m2 in (4.0, 1 / 0.085):
for lab, a, e in CASES:
v1 = lam_ee(math.sqrt(m2), 0.1, a, e, sigma=0.10)
v2 = lam_ee(math.sqrt(m2), 0.1, a, e, sigma=0.07)
v3 = lam_ee(math.sqrt(m2), 0.1, a, e, sigma=0.13)
worst = max(worst, abs(v1 - v2), abs(v1 - v3))
check("k d = 0.1: the same sum with smearing widths 0.07 d, 0.10 d, 0.13 d", worst < 1e-8, "(largest difference %.1e of about 8)" % worst)
head("2. The coefficient B of (k d)^2 in d^3/alpha = Clausius-Mossotti + B (k d)^2, by direction and polarization")
b1, b2, b3 = -1.8915316, 0.1648469, -1.7700004
print(" Draine and Goodman 1993 (ApJ 405, 685), FROM MEMORY: B = b1 + m^2 b2 + m^2 b3 S, b1 = %.7f, b2 = %.7f, b3 = %.7f," % (b1, b2, b3))
print(" S = sum_j (a_j e_j)^2 (a = direction of travel, e = direction of the dipoles).")
print(" %-30s %-8s %-6s %-14s %-14s %-10s" % ("case", "m^2", "S", "B computed", "B (D&G form)", "difference"))
worstB = 0.0
Btab = {}
for m2 in (1.5, 2.0, 4.0, 1 / 0.085):
for lab, a, e in CASES:
Bc = extrap(lambda k: B_of(m2, k, a, e))
S = S_of(a, e)
Bdg = b1 + m2 * b2 + m2 * b3 * S
worstB = max(worstB, abs(Bc - Bdg))
Btab[(m2, lab)] = Bc
print(" %-30s %-8.4f %-6.3f %-14.6f %-14.6f %-+10.1e" % (lab, m2, S, Bc, Bdg, Bc - Bdg))
check("my lattice sum reproduces Draine and Goodman's form with the coefficients as remembered", worstB < 2e-4,
"(largest difference %.1e)" % worstB)
# fit b1, b2, b3 from my own numbers
rows, rhs = [], []
for (m2, lab), Bc in Btab.items():
a, e = [(aa, ee) for (ll, aa, ee) in CASES if ll == lab][0]
rows.append([1.0, m2, m2 * S_of(a, e)])
rhs.append(Bc)
sol, res, rk, sv = np.linalg.lstsq(np.array(rows), np.array(rhs), rcond=None)
print(" Least-squares fit of my own numbers: b1 = %.6f, b2 = %.6f, b3 = %.6f (residual %.1e)" % (sol[0], sol[1], sol[2], math.sqrt(float(res[0]) / len(rhs)) if len(res) else 0.0))
head("3. What it means for a relay: dipoles of fixed strength holding the share 1 - f of the vacuum's permittivity")
print(" Bare space has permittivity f eps0, so light in it runs at c/sqrt(f) and k_bare = sqrt(f) omega/c. The dipoles' strength is")
print(" fixed by n = 1 at long waves (Clausius-Mossotti with m0^2 = 1/f). For each omega solve 1/alpha = e.Lam.e for q; n = q c/omega.")
print(" Below, k d = omega d/c (the vacuum's wavenumber times the spacing).")
print(" %-8s %-30s %-16s %-16s %-18s" % ("f", "case", "n - 1 over (kd)^2", "n_g - 1 over (kd)^2", "against +1/24 (the record)"))
coef = {}
for f in (0.25, 0.085):
m0sq = 1 / f
target = cm(m0sq)
for lab, a, e in CASES:
def cn(kd):
kb = math.sqrt(f) * kd
g = lambda m: lam_ee(m, kb, a, e) - target
m0 = math.sqrt(m0sq)
lo, hi = m0 * 0.9, m0 * 1.1
msol = brentq(g, lo, hi, xtol=1e-15, rtol=1e-15)
return (msol * math.sqrt(f) - 1) / kd**2
c_n = extrap(cn, ks=(0.4, 0.2, 0.1))
coef[(f, lab)] = c_n
print(" %-8.3f %-30s %-+16.5f %-+16.5f %-+18.2f" % (f, lab, c_n, 3 * c_n, c_n * 24))
# the same from the B coefficient, as a cross-check of the algebra used in compare_trial23.py
worst = 0.0
for f in (0.25, 0.085):
m0sq = 1 / f
Y0 = (m0sq - 1) / (m0sq + 2)
for lab, a, e in CASES:
B = b1 + m0sq * b2 + m0sq * b3 * S_of(a, e)
pred = 0.5 * f * 3 / (1 - Y0) ** 2 * Y0 * (3 * Y0 / (4 * math.pi)) * B * f
worst = max(worst, abs(pred - coef[(f, lab)]))
check("the closed form used in compare_trial23.py (section 10) agrees with the direct solution", worst < 2e-4, "(largest difference %.1e)" % worst)
head("4. Consequences, with trial 23's own numbers")
hbarc = 1.9732698045930252e-07 # eV m
T2 = 6.6835e17 # s, Int (1+z)^2 dz/H to z = 0.903 (compare_trial23_out.txt section 6)
k28 = 28e9 / hbarc
print(" (i) Sign. Along a cube axis at f = 1/4 the fine-grain term makes high-energy light FASTER (n - 1 < 0): an advance.")
print(" Abdo's limit (a) bounds a delay only. Limits (e) (10 ms, either sign) and (f) (19 ms, advance) apply.")
for f in (0.25, 0.085):
for lab, a, e in CASES:
c_n = coef[(f, lab)]
if abs(c_n) < 1e-9:
continue
d_e = math.sqrt(0.010 / (3 * abs(c_n) * T2)) / k28
if c_n > 0:
d_a = "%.2e m" % (math.sqrt(0.859 / (3 * abs(c_n) * T2)) / k28)
else:
d_a = "does not apply"
print(" f = %.3f %-30s spacing below %.2e m by limit (e) ; by limit (a): %s" % (f, lab, d_e, d_a))
print(" The record's law (n - 1 = +(kd)^2/24): %.2e m by (e), %.2e m by (a), same weighting."
% (math.sqrt(0.010 / (0.125 * T2)) / k28, math.sqrt(0.859 / (0.125 * T2)) / k28))
print(" (ii) Direction. The speed differs between directions and, along [110], between the two polarizations:")
for f in (0.25, 0.085):
dn = coef[(f, "[110], dipoles along [001]")] - coef[(f, "[110], dipoles along [1-10]")]
an = coef[(f, "[100], dipoles along [010]")] - coef[(f, "[111], dipoles along [1-10]")]
print(" f = %.3f: n([110], dipoles [001]) - n([110], dipoles [1-10]) = %+.4f (kd)^2 ; n([100]) - n([111]) = %+.4f (kd)^2" % (f, dn, an))
print(" So a cubic lattice of dipoles makes space doubly refracting at order (k d)^2, except along the cube's 3-fold and 4-fold axes.")
print(" The retardance over a path L is dn (k d)^2 k L. Path and photon for a retardance of 1 radian (dn coefficient for f = 1/4):")
dn = abs(coef[(0.25, "[110], dipoles along [001]")] - coef[(0.25, "[110], dipoles along [1-10]")])
pc = 3.0856775814913673e16
for lab, E, L in (("the Crab, 300 keV, 2 kpc (polarization measured; inputs from memory)", 300e3, 2000 * pc),
("a burst at z about 1, 300 keV, 1e26 m (polarization claimed for some; from memory)", 300e3, 1e26),
("the Crab, 5 keV, 2 kpc (X-ray polarimetry; from memory)", 5e3, 2000 * pc)):
k = E / hbarc
dmax = math.sqrt(1 / (dn * k * L)) / k
print(" %-86s d = %.1e m" % (lab + ":", dmax))
print(" These are NOT bounds yet: light polarized along one of the lattice's two axes for its direction passes unchanged, so a")
print(" single polarized source proves little. A bound needs several sources, or a polarization angle known at the source.")
print(" (iii) Size. The grain term against the resonance term (h2/2)(E/E2)^2 of the level, at xi = E2 d/(hbar c):")
for f in (0.25,):
c_ax = coef[(f, "[100], dipoles along [010]")]
c_dg = coef[(f, "[110], dipoles along [1-10]")]
for xi, lab in ((0.2304, "the classical edge"), (4.09, "the (e) hold at the 3.0e-27 m bound")):
print(" f = %.2f, xi = %.4f (%s): grain/resonance = %+.4f along [100], %+.3f along [110] in-plane"
% (f, xi, lab, c_ax * xi**2 / ((1 - f) / 2), c_dg * xi**2 / ((1 - f) / 2)))
print()
print("Checks: %d of %d pass." % (NCHK[1], NCHK[0]))