Does light charge the quons? › Files cited on the page › the trials
reflection_grid_review7_check.py
"""reflection_grid_review7_check.py - this seat's check of the seventh reviewer's findings F1, F2 and F4 on trial 5
(post hoc to trial 5's lock; not a trial; written after the review, 12 November 2026). Code of this seat's own for F1 and
F4; F2 uses trial 5's own force-constant matrices (reflection_grid.py, functions taken unchanged).
F1 Where does a uniform-ball quon rest in an even finer grid held rigid and in register, and how strongly is it held there?
Point finer quons; a real-space Ewald route with no Fourier sum over the finer grid's reciprocal vectors. In finer units
(v = N u, alpha = a N, finer spacing 1):
E(u) - E(0) = -(k/N^2) [e(v) - e(0)],
e(v) = Phi_sc(v) + sum over the finer quons p inside the ball (|p - v| < alpha) of [(3 alpha^2 - rho^2)/(2 alpha^3) - 1/rho],
where Phi_sc is the zero-mean Ewald potential of a unit simple cubic lattice of unit point charges (by reciprocity, the
finer grid's potential at the quon) and the bracket replaces a point quon's 1/rho by the ball's own potential inside it.
The hold tensor at rest, in units of 4 pi n q^2: K_ij = -(k/4 pi) d2e/dv_i dv_j (k = 1). The trace rule predicts
trace(K)/3 = (n_in/y_f - 1)/3, y_f = (4 pi/3) alpha^3, n_in the finer quons inside the ball.
F4 Register at a ratio p/q in lowest terms: direct counting of the finer quons inside every quon's ball, with a patch of
the finer grid around every quon.
F2 The hold when the springs (trial 5's stand-in for whatever keeps the grid's shape) let the finer grid deform under
light's force: N = 2, the static response at Gamma, x = (Phi + S)^+ q E, dipole p = sum q_i x_i, K = E/(4 pi p).
Run: ~/aspden-review-venv/bin/python3 reflection_grid_review7_check.py > reflection_grid_review7_check_out.txt
"""
import ast, itertools, math, time
import numpy as np
from scipy.optimize import minimize, brentq
from scipy.special import erf, erfc
T0 = time.time()
ETA = 2.5
SQPI = math.sqrt(math.pi)
B_ASPDEN = 0.036135562
SC_MIN = 0.0927
PBOX = np.array(list(itertools.product(range(-5, 7), repeat=3)), float) # finer quons within 5 of any v in [0, 1/2]^3
MREC = np.array([m for m in itertools.product(range(-5, 6), repeat=3) if any(m)], float)
M2 = np.einsum("ni,ni->n", MREC, MREC)
CREC = np.exp(-math.pi**2 * M2 / ETA**2) / (math.pi * M2)
def e_val(V, alpha):
"""e(v) for rows of V (in [0, 1/2]^3 or near it)."""
V = np.atleast_2d(V)
out = np.empty(len(V))
for c0 in range(0, len(V), 400):
Vc = V[c0:c0 + 400]
D = Vc[:, None, :] - PBOX[None, :, :]
rho = np.linalg.norm(D, axis=2)
ins = rho < alpha
rs = np.where(rho < 1e-12, 1.0, rho)
outside = np.where(ins, 0.0, erfc(ETA * rho) / rs)
g_in = np.where(rho < 1e-12, 2 * ETA / SQPI, erf(ETA * rho) / rs)
inside = np.where(ins, (3 * alpha**2 - rho**2) / (2 * alpha**3) - g_in, 0.0)
out[c0:c0 + 400] = outside.sum(1) + inside.sum(1) + np.cos(2 * np.pi * Vc @ MREC.T) @ CREC - math.pi / ETA**2
return out
def e_grad_hess(v, alpha):
"""Gradient and Hessian of e at one point v."""
D = v[None, :] - PBOX
rho = np.linalg.norm(D, axis=1)
ctr = rho < 1e-9 # a finer quon at the ball's centre: -erf(eta r)/r + ball, regular
r = np.where(ctr, 1.0, rho)
A = erfc(ETA * r)
A1 = -2 * ETA / SQPI * np.exp(-(ETA * r) ** 2)
A2 = 4 * ETA**3 * r / SQPI * np.exp(-(ETA * r) ** 2)
f1 = A1 / r - A / r**2 # erfc(eta r)/r
f2 = A2 / r - 2 * A1 / r**2 + 2 * A / r**3
ins = rho < alpha # inside: ball - 1/r + erfc(eta r)/r
f1 = f1 + np.where(ins, -r / alpha**3 + 1 / r**2, 0.0)
f2 = f2 + np.where(ins, -1 / alpha**3 - 2 / r**3, 0.0)
f1[ctr] = 0.0
f2[ctr] = 0.0
nv = D / r[:, None]
g = (f1[:, None] * nv).sum(0)
H = np.einsum("n,ni,nj->ij", f2 - f1 / r, nv, nv) + np.sum(f1 / r) * np.eye(3)
if ctr.any():
H += (4 * ETA**3 / (3 * SQPI) - 1 / alpha**3) * np.eye(3)
ph = 2 * np.pi * (MREC @ v)
g += -2 * np.pi * (CREC * np.sin(ph)) @ MREC
H += -(2 * np.pi) ** 2 * np.einsum("n,ni,nj->ij", CREC * np.cos(ph), MREC, MREC)
return g, H
def n_inside(v, alpha):
return int(np.sum(np.linalg.norm(v[None, :] - PBOX, axis=1) < alpha))
WEDGE = np.array([(i, j, l) for i in range(25) for j in range(i, 25) for l in range(j, 25)], float) / 48
def rest(alpha):
"""Global maximum of e (minimum of E) over a finer cell: a scan of the wedge (i,j,l)/48, then a local refinement."""
ev = e_val(WEDGE, alpha)
best = None
for st in WEDGE[np.argsort(-ev)[:6]]:
res = minimize(lambda x: -e_val(x, alpha)[0], st, jac=lambda x: -e_grad_hess(x, alpha)[0],
method="L-BFGS-B", bounds=[(0, 0.5)] * 3, options=dict(ftol=1e-15, gtol=1e-11))
if best is None or -res.fun > best[1]:
best = (res.x, -res.fun)
v = np.sort(np.abs(best[0]))
v = np.where(np.abs(v) < 1e-5, 0.0, np.where(np.abs(v - 0.5) < 1e-5, 0.5, v))
return v, e_val(v, alpha)[0]
def name(v):
tags = {(0, 0, 0): "on a finer quon", (0, 0, 0.5): "edge midpoint", (0, 0.5, 0.5): "face centre", (0.5, 0.5, 0.5): "cube centre"}
return tags.get(tuple(float(x) for x in v), "(%.4f, %.4f, %.4f)" % tuple(v))
print("Check of the seventh reviewer's F1, F2 and F4 on trial 5 (this seat; post hoc to trial 5's lock; not a trial)")
# ------------------------------------------------------------------ checks of the route itself
print("\nA. The route. (i) Phi_sc's Madelung constant: lim e(v) - 3/(2 alpha) at v = 0, against -2.837297479 (simple cubic")
print(" lattice in a uniform background); (ii) gradient and Hessian against finite differences of e; (iii) the hold on a")
print(" finer quon against (1/y_f - 1)/3 (D2's Thomson formula on a finer cell).")
mad = e_val(np.zeros(3), 0.45)[0] - 3 / (2 * 0.45)
print(f" (i) Madelung constant {mad:.9f}")
worst_g = worst_h = 0.0
for alpha, v in ((0.6, np.array([0.11, 0.23, 0.37])), (0.9, np.array([0.31, 0.42, 0.05])), (1.3, np.array([0.2, 0.2, 0.45]))):
g, H = e_grad_hess(v, alpha)
hh = 1e-5
for a in range(3):
dv = np.zeros(3)
dv[a] = hh
fd = (e_val(v + dv, alpha)[0] - e_val(v - dv, alpha)[0]) / (2 * hh)
worst_g = max(worst_g, abs(fd - g[a]))
gp, _ = e_grad_hess(v + dv, alpha)
gm, _ = e_grad_hess(v - dv, alpha)
worst_h = max(worst_h, np.max(np.abs((gp - gm) / (2 * hh) - H[:, a])))
print(f" (ii) largest gradient error {worst_g:.1e}, largest Hessian error {worst_h:.1e}")
worst_k = 0.0
for alpha in (0.3, 0.45, 0.4924, 0.55, 0.6):
_, H = e_grad_hess(np.zeros(3), alpha)
K = -H / (4 * np.pi)
yf = 4 * np.pi / 3 * alpha**3
worst_k = max(worst_k, np.max(np.abs(K - (1 / yf - 1) / 3 * np.eye(3))))
print(f" (iii) largest |K - (1/y_f - 1)/3 I| at u = 0 for a*N = 0.3 to 0.6: {worst_k:.1e}")
# ------------------------------------------------------------------ F1: the rest position against the ball's size
print("\nB. F1: where the quon rests (global minimum of E over a finer cell) and the hold tensor there (k = 1, point finer quons)")
print(" a*N y_f K_T(0) rest position E(rest)-E(0) n in trace/3 (n/y_f-1)/3 eigenvalues of K at rest")
print(" (units k/N^2)")
e0cache = {}
for alpha in np.round(np.arange(0.40, 1.605, 0.01), 3):
v, ev = rest(alpha)
e0 = e_val(np.zeros(3), alpha)[0]
_, H = e_grad_hess(v, alpha)
K = -H / (4 * np.pi)
lam = np.linalg.eigvalsh(K)
yf = 4 * np.pi / 3 * alpha**3
_, H0 = e_grad_hess(np.zeros(3), alpha)
nin = n_inside(v, alpha)
print(f" {alpha:4.2f} {yf:6.3f} {-np.trace(H0)/(12*np.pi):+.4f} {name(v):22s} {-(ev - e0):+.4e} {nin:3d} "
f"{np.trace(K)/3:+.4f} {(nin/yf - 1)/3:+.4f} {lam[0]:+.4f} {lam[1]:+.4f} {lam[2]:+.4f}", flush=True)
# ------------------------------------------------------------------ F1: the crossing and the barrier
print("\nC. F1: the ball's size at which the edge midpoint becomes lower than the finer quon (point finer quons)")
edge = np.array([0.0, 0.0, 0.5])
fcross = lambda al: e_val(edge, al)[0] - e_val(np.zeros(3), al)[0]
ac = brentq(fcross, 0.52, 0.62, xtol=1e-12)
print(f" a*N = {ac:.5f} (y_f = {4*np.pi/3*ac**3:.4f}; the hold on the finer quon there {(1/(4*np.pi/3*ac**3) - 1)/3:+.4f});"
f" at Aspden's radius N = {ac / B_ASPDEN:.3f}")
ts = np.linspace(0, 0.5, 501)
pts = np.column_stack([np.zeros_like(ts), np.zeros_like(ts), ts])
for alpha in (0.58, 0.60):
dE = -(e_val(pts, alpha) - e_val(np.zeros(3), alpha)[0])
print(f" a*N = {alpha:.2f}: E - E(0) along the edge (units k/N^2): highest {dE.max():+.4e} at t = {ts[np.argmax(dE)]:.3f},"
f" at the midpoint {dE[-1]:+.4e}")
# ------------------------------------------------------------------ F1 at Aspden's radius
print("\nD. F1 at Aspden's radius b/d = 0.036135562 (alpha = b N): rest position, finer quons held, hold tensor there")
print(" N a*N rest position n in trace/3 eigenvalues of K share 1/(1+trace/3) sc stable (lowest eig >= 0.0927)")
for N in list(range(12, 46)) + [50, 60]:
alpha = B_ASPDEN * N
v, ev = rest(alpha)
_, H = e_grad_hess(v, alpha)
K = -H / (4 * np.pi)
lam = np.linalg.eigvalsh(K)
kt = np.trace(K) / 3
print(f" {N:3d} {alpha:.4f} {name(v):22s} {n_inside(v, alpha):3d} {kt:+.4f} {lam[0]:+.4f} {lam[1]:+.4f} {lam[2]:+.4f}"
f" {1/(1+kt):.3f} {lam[0] >= SC_MIN}", flush=True)
# ------------------------------------------------------------------ F4: register at p/q
print("\nE. F4: register at a ratio p/q (quon a uniform ball, finer quons points, k = 1), by direct counting around every quon")
print(" For quon R (integer position), its offset in finer units is v = (p/q) R mod 1; its hold's trace/3 is (n_in/y_f - 1)/3;")
print(" it is at rest by symmetry if 2v is whole (a centre of inversion of the finer grid).")
print(" Also the net force on each quon from the finer grid, from the gradient of e at its offset (zero below 1e-9: at rest).")
print(" p/q a quons on a finer quon with a finer quon inside at a centre of inversion at rest mean trace/3 "
"hold of N = p in register (1/y_f(p) - 1)/3")
for p, qd, a in [(3, 2, 0.1), (5, 2, 0.1), (7, 3, 0.05), (27, 2, B_ASPDEN), (41, 3, B_ASPDEN), (55, 4, B_ASPDEN), (14, 1, B_ASPDEN)]:
Nr = p / qd
yf = 4 * np.pi / 3 * (a * Nr) ** 3
vals, on, withq, inv, still = [], 0, 0, 0, 0
for R in itertools.product(range(qd), repeat=3):
R = np.array(R, float)
c = np.round(R * Nr)
F = np.array(list(itertools.product(*[range(int(ci) - 3, int(ci) + 4) for ci in c])), float)
d = np.linalg.norm(F / Nr - R, axis=1)
nin = int(np.sum(d < a))
vals.append((nin / yf - 1) / 3)
on += int(np.any(d < 1e-12))
withq += int(nin > 0)
vv = (R * Nr) % 1.0
inv += int(np.all(np.abs(2 * vv - np.round(2 * vv)) < 1e-9))
still += int(np.linalg.norm(e_grad_hess(vv, a * Nr)[0]) < 1e-9)
npts = sum(1 for m in itertools.product(range(-3, 4), repeat=3) if math.sqrt(sum(x * x for x in m)) < a * p) \
if a * p < 3 else None
yfp = 4 * np.pi / 3 * (a * p) ** 3
print(f" {p}/{qd:<3d} {a:.6f} {qd**3:4d} {on:4d} {withq:4d} {inv:4d} "
f"{still:4d} {np.mean(vals):+.6f} {(npts / yfp - 1) / 3:+.6f} (n = {npts}) {(1 / yfp - 1) / 3:+.6f}")
# ------------------------------------------------------------------ F2: the hold with a deformable grid (trial 5's matrices)
print("\nF. F2: the hold when the springs let the finer grid deform (N = 2, trial 5's Phi and springs, Ewald eta = 2.6)")
src = open("reflection_grid.py", encoding="utf-8").read()
WANT_F = {"ser_coef", "AB", "T_gauss", "phi_build", "spring_bonds", "phi_springs", "grid", "stack", "theta", "KT_on"}
WANT_A = {"TWO_PI", "RL", "GL", "RL0", "NSER"}
body = []
for node in ast.parse(src).body:
if isinstance(node, (ast.Import, ast.ImportFrom)):
body.append(node)
elif isinstance(node, ast.FunctionDef) and node.name in WANT_F:
body.append(node)
elif isinstance(node, ast.Assign) and any(isinstance(t, ast.Name) and t.id in WANT_A for t in node.targets):
body.append(node)
T5 = {}
exec(compile(ast.Module(body=body, type_ignores=[]), "reflection_grid.py (functions only)", "exec"), T5)
NSS = brentq(lambda x: T5["KT_on"](x) - 1 / 3, 0.2, 0.5, xtol=1e-14)
pos, qv, sv = T5["stack"](2, NSS)
nch = len(pos)
Tf = lambda r, k, same, S2: T5["T_gauss"](r, k, 2.6, same, math.sqrt(2 * S2))
bonds = T5["spring_bonds"](2)
PG = T5["phi_build"](pos, qv, sv, np.zeros(3), Tf).real
print(f" N*S* = {NSS:.8f}, s1 = {sv[0]:.6f}; {len(bonds)} bonds per cell")
fE = np.zeros(3 * nch)
fE[0::3] = qv # light's force q_i E on every charge, E = 1 along x
B2 = np.zeros((3 * nch, 2)) # the rigid case: the quon and the whole finer grid as two bodies
B2[0, 0] = 1.0
B2[3::3, 1] = 1.0
x2 = np.linalg.lstsq(B2.T @ PG @ B2, B2.T @ fE, rcond=None)[0]
p2 = x2[0] * qv[0] + x2[1] * qv[1:].sum()
print(f" the finer grid held rigid (moving only as a whole): K = {1 / (4 * np.pi * p2):.6f} (expected 1/3)")
print(" kappa K with the grid free to deform share 1/(1+K)")
for kappa in (1000.0, 300.0, 100.0, 30.0, 10.0, 5.0, 3.0, 2.5):
P = PG + T5["phi_springs"](nch, bonds, kappa, np.zeros(3)).real
x = np.linalg.lstsq(P, fE, rcond=1e-12)[0]
p = qv @ x[0::3]
print(f" {kappa:7.1f} {1 / (4 * np.pi * p):+.6f} {1 / (1 + 1 / (4 * np.pi * p)):.4f}")
kpts = {"(%d,%d,%d)/5" % ijk: 2 * np.pi * np.array(ijk, float) / 5
for ijk in [(i, j, l) for i in range(3) for j in range(i, 3) for l in range(j, 3)]}
kpts.update({"X": np.array([np.pi, 0, 0]), "M": np.array([np.pi, np.pi, 0]), "R": np.array([np.pi] * 3),
"(0.3,0.7,1.1)": np.array([0.3, 0.7, 1.1])})
PE = {kn: T5["phi_build"](pos, qv, sv, kv, Tf) for kn, kv in kpts.items()}
def lowest(kappa):
worst, where = np.inf, None
for kn, kv in kpts.items():
P = PE[kn] + T5["phi_springs"](nch, bonds, kappa, kv)
lam = np.linalg.eigvalsh(0.5 * (P + P.conj().T))
if np.allclose(kv, 0):
lam = lam[3:] # the three uniform translations
if lam[0] < worst:
worst, where = lam[0], kn
return worst, where
for kappa in (1.0, 2.0, 2.5, 3.0, 10.0):
w, kn = lowest(kappa)
print(f" kappa = {kappa:5.1f}: lowest eigenvalue over the k-points {w:+.4e} (at {kn})")
kc = brentq(lambda kap: lowest(kap)[0], 1.0, 10.0, xtol=1e-6)
print(f" threshold kappa_c = {kc:.4f} (k-points: the 5 x 5 x 5 grid's ten distinct points, X, M, R and a general point);"
f" the on-site spring stiffness per direction is 6 kappa = {6*kc:.2f}")
lowblk = []
for i in range(2, nch):
lowblk.append(np.linalg.eigvalsh(PG[3*i:3*i+3, 3*i:3*i+3])[0])
print(f" most negative eigenvalue of a non-partner finer quon's own electric block at Gamma: {min(lowblk):+.4f};"
f" the partner's own block: {np.linalg.eigvalsh(PG[3:6, 3:6])}")
print(f"\nrun time {time.time() - T0:.0f} s")