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

check_closed_forms.py

In the investigation at sim/charge_wave/check_reflection_fable/check_closed_forms.py · last changed in commit 87fc6d0, 12 November 2026 · 10,352 bytes · the folder as a zip


"""check_closed_forms.py - the seventh reviewer's own checks of trial 5's D1, D2, D3 (closed forms, where the quon rests,
register) and of the paper's table at Aspden's quon radius. Own code; nothing copied from reflection_grid.py.

Units: quon spacing d = 1, quon charge 1, Coulomb 1/r; K_T in units of 4 pi (the continuum's pull), k = 1 unless said.
Run: ~/aspden-review-venv/bin/python3 check_closed_forms.py > check_closed_forms_out.txt
"""
import itertools, math
import numpy as np
from fable_tools import theta3, theta4

B_ASP = 0.036135562
print("Seventh reviewer: closed forms and rest positions (own code)\n")

# ------------------------------------------------------------------ A. D2 for Gaussians: direct sum vs theta closed form
print("A. K_T on a finer quon, Gaussians: direct lattice sum (1/3) sum_{m != 0} exp(-2 pi^2 (NS)^2 |m|^2) vs (theta3^3 - 1)/3")
M = 12
mm = np.array(list(itertools.product(range(-M, M + 1), repeat=3)), float)
m2 = np.einsum("ni,ni->n", mm, mm)
m2 = m2[m2 > 0]
worst = 0.0
for NS in (0.1, 0.2, 0.3, 0.3217, 0.4, 0.5, 0.6):
    direct = np.sum(np.exp(-2 * math.pi ** 2 * NS ** 2 * m2)) / 3
    x = math.exp(-2 * math.pi ** 2 * NS ** 2)
    closed = (theta3(x) ** 3 - 1) / 3
    between_direct = np.sum(np.exp(-2 * math.pi ** 2 * NS ** 2 * m2) * np.cos(math.pi * mm[np.einsum('ni,ni->n', mm, mm) > 0].sum(1))) / 3
    between_closed = (theta4(x) ** 3 - 1) / 3
    worst = max(worst, abs(direct - closed), abs(between_direct - between_closed))
    print(f"   N*S = {NS:6.4f}: on {direct:+.12f} vs {closed:+.12f}; between {between_direct:+.12f} vs {between_closed:+.12f}")
print(f"   worst difference {worst:.1e}")
# N*S* by bisection, with my own theta3
lo, hi = 0.2, 0.5
for _ in range(100):
    mid = 0.5 * (lo + hi)
    if (theta3(math.exp(-2 * math.pi ** 2 * mid ** 2)) ** 3 - 1) / 3 > 1 / 3:
        lo = mid
    else:
        hi = mid
NSS = 0.5 * (lo + hi)
x = math.exp(-2 * math.pi ** 2 * NSS ** 2)
print(f"   N*S* for K_T = 1/3: {NSS:.8f} (trial: 0.32169013); theta3(x) = {theta3(x):.8f} = 2^(1/3) = {2**(1/3):.8f}; x = {x:.6f}")
print(f"   between finer quons at N*S*: {(theta4(x)**3 - 1)/3:+.6f} (trial: -0.197595); partner alone ((2 pi (NS*)^2)^-1.5 - 1)/3 = "
      f"{((2*math.pi*NSS**2)**-1.5 - 1)/3:+.6f} (trial: +0.302430)")
print(f"   narrow limit of 'between': theta4 -> 0, so K_T -> -1/3 (Earnshaw). At N*S = 0.05: {(theta4(math.exp(-2*math.pi**2*0.05**2))**3 - 1)/3:+.6f}\n")

# ------------------------------------------------------------------ B. D1 for a uniform ball: where is the global minimum of E(u)?
print("B. D1, uniform ball of radius a (finer quons Gaussian s2 N = 0.05 as in R1; N = 4): E(u) - E(0) over a fine wedge of a finer cell.")
print("   The paper: 'For a quon whose charge fills a ball it holds [rests on a finer quon] while the hold there is positive'.")
print("   Test: for each a*N, the global minimum of E(u) on the wedge (i,j,l)/(32N), 0<=i<=j<=l<=16, and K_T(0) = (1/3) sum F_ball F2.")
N1 = 4
s2N = 0.05
CUT = 41.4
Mb = int(math.ceil(math.sqrt(CUT / (2 * math.pi ** 2 * s2N ** 2)))) + 1
mb = np.array(list(itertools.product(range(-Mb, Mb + 1), repeat=3)), float)
mb2 = np.einsum("ni,ni->n", mb, mb)
mb, mb2 = mb[mb2 > 0], mb2[mb2 > 0]
wedge = np.array([(i, j, l) for i in range(17) for j in range(i, 17) for l in range(j, 17)], float)
nz = np.any(wedge != 0, axis=1)
phase = np.cos(2 * np.pi * (wedge @ mb.T) / 32)              # (nw, nm)

def F_ball(x):
    return 3 * (np.sin(x) - x * np.cos(x)) / x ** 3

print("     a*N     y_f      K_T(0)      min E(u)-E(0), u != 0   at (i,j,l)/32   E(face centre)   E(cube centre)  u=0 global min?")
first_fail = None
for aN in [0.30, 0.40, 0.45, 0.4924, 0.50, 0.5059, 0.52, 0.54, 0.55, 0.56, 0.57, 0.58, 0.59, 0.60, 0.61, 0.615, 0.62, 0.63, 0.65, 0.70, 0.80]:
    coef = F_ball(2 * np.pi * np.sqrt(mb2) * aN) * np.exp(-2 * math.pi ** 2 * s2N ** 2 * mb2)
    KT0 = coef.sum() / 3
    dE = (coef / mb2) @ (1 - phase.T) / (math.pi * N1 ** 2)
    t = np.argmin(np.where(nz, dE, np.inf))
    face = dE[np.where((wedge == (0, 16, 16)).all(1))[0][0]]
    centre = dE[-1]
    glob = dE[t] > 0
    if not glob and KT0 > 0 and first_fail is None:
        first_fail = aN
    yf = 4 * math.pi / 3 * aN ** 3
    print(f"     {aN:.4f}  {yf:.4f}  {KT0:+.5f}   {dE[t]:+.6e}         {tuple(int(v) for v in wedge[t])!s:14s}  {face:+.5e}     {centre:+.5e}    {glob}")
print(f"   First a*N (of those scanned) with K_T(0) > 0 but the global minimum NOT at u = 0: {first_fail}")
print("   (If this is below the point formula's zero at a*N = 0.6204, the paper's sentence is overstated: the quon rests on a finer")
print("    quon only while u = 0 is the lowest energy, which ends before the hold there turns negative.)\n")

# bisection for the a*N where E(face centre) - E(0) crosses zero, and where K_T(0) crosses zero
def face_dE(aN):
    coef = F_ball(2 * np.pi * np.sqrt(mb2) * aN) * np.exp(-2 * math.pi ** 2 * s2N ** 2 * mb2)
    ph = np.cos(2 * np.pi * (mb @ np.array([0, 16, 16])) / 32)
    return np.sum(coef / mb2 * (1 - ph)) / (math.pi * N1 ** 2)

def KT0(aN):
    coef = F_ball(2 * np.pi * np.sqrt(mb2) * aN) * np.exp(-2 * math.pi ** 2 * s2N ** 2 * mb2)
    return coef.sum() / 3

lo, hi = 0.50, 0.62
for _ in range(60):
    mid = 0.5 * (lo + hi)
    if face_dE(mid) > 0:
        lo = mid
    else:
        hi = mid
a_face = 0.5 * (lo + hi)
lo, hi = 0.55, 0.70
for _ in range(60):
    mid = 0.5 * (lo + hi)
    if KT0(mid) > 0:
        lo = mid
    else:
        hi = mid
a_kt = 0.5 * (lo + hi)
print(f"   E(face centre) = E(0) at a*N = {a_face:.5f} (y_f = {4*math.pi/3*a_face**3:.4f}, K_T(0) = {KT0(a_face):+.5f}); K_T(0) = 0 at a*N = {a_kt:.5f}"
      f" (point formula: {(3/(4*math.pi))**(1/3):.5f})")
print(f"   At Aspden's radius the face-centre crossing is N = {a_face/B_ASP:.2f} finer; the hold's zero is N = {a_kt/B_ASP:.2f}.\n")

# ------------------------------------------------------------------ C. D3: register at rational ratios, by direct counting (point finer quons)
print("C. D3, register. Ratio of spacings d/delta = p/q in lowest terms, quon a uniform ball, finer quons points, k = 1.")
print("   For each quon offset u on the q^3 distinct offsets, K_T(u) = (sigma_at(u) - 1)/3 with sigma_at the finer charge inside the ball")
print("   divided by the ball's volume (field inside a uniform ball is linear, so each inside point counts fully).")
print("   Claim to test: the average over the q^3 offsets equals the in-register hold for the whole number p, (1/y_f(p) - 1)/3.")
for p, q, a in [(3, 2, 0.1), (5, 2, 0.1), (7, 3, 0.05), (14, 1, B_ASP), (27, 2, B_ASP), (41, 3, B_ASP), (13, 1, B_ASP), (15, 1, B_ASP)]:
    delta = q / p
    qf = -delta ** 3                      # density -1
    vb = 4 * math.pi / 3 * a ** 3
    rng = np.arange(-3, 5)
    fin = delta * np.array(list(itertools.product(rng, rng, rng)), float)
    vals = []
    for off in itertools.product(range(q), repeat=3):
        u = np.array(off, float)          # quon at integer position (i, j, l): offset relative to the finer grid
        d = np.linalg.norm(fin - u, axis=1)
        inside = np.sum(d < a - 1e-12)
        sig = inside * (-qf) / vb
        vals.append((sig - 1) / 3)
    vals = np.array(vals)
    yf_p = 4 * math.pi / 3 * (a * p) ** 3
    print(f"   p/q = {p}/{q} = {p/q:.4f}, a = {a:.6f}: offsets {q**3}, on a finer quon {int(np.sum(vals > -1/3 + 1e-12))}; "
          f"K_T from {vals.min():+.4f} to {vals.max():+.4f}; mean {vals.mean():+.6f}; formula for N = p: {(1/yf_p - 1)/3:+.6f}")
print("   So a ratio p/q gives, on average over the quons, the in-register hold of the whole number p (its numerator), not of p/q;")
print("   and all quons but one in q^3 sit in empty space with Earnshaw's -1/3 each (unstable individually), so the lattice is not")
print("   merely unheld on average: most of its quons are pushed off. Irrational ratio: p -> infinity, mean -> 0 (the trial's R2d).\n")

# ------------------------------------------------------------------ D. The table at Aspden's radius (R2c), my own arithmetic
print("D. R2c at Aspden's radius b/d = 0.036135562 (k = 1, the ball holding only its own finer quon while a*N < 1):")
print("     N    a*N     y_f      K_T       share 1/(1+K_T)   stable sc (K_T >= 0.09269)")
for N in range(2, 29):
    aN = N * B_ASP
    yf = 4 * math.pi / 3 * aN ** 3
    inside_more = aN >= 1.0
    KT = (1 / yf - 1) / 3
    sh = f"{1/(1+KT):.4f}" if KT > 0 else "pushed off"
    print(f"    {N:3d}  {aN:.5f}  {yf:.5f}  {KT:+.5f}   {sh:12s}   {KT >= 0.09269}{'   (ball reaches the 6 neighbours: formula no longer holds)' if inside_more else ''}")
Nstar = (3 / (8 * math.pi)) ** (1 / 3) / B_ASP
print(f"   N* (y_f = 1/2) = {Nstar:.4f}; hold positive for N < {(3/(4*math.pi))**(1/3)/B_ASP:.3f}; first N with a*N >= 1: {math.ceil(1/B_ASP)}\n")

# ------------------------------------------------------------------ E. k > 1 with an even balancing level; the shell; the cube sum
print("E. Derivations restated.")
print("   k > 1: level 2 has -k per cell (each finer quon -k/N^3), an even level 3 of +(k-1) per cell. Net opposite charge averaged")
print("   over the ball: k/(N^3 V_b) - (k-1) = k/y_f - (k-1); the quons' own average is 1; so K_T = (k/y_f - (k-1) - 1)/3 = k (1/y_f - 1)/3. Agreed,")
print("   with the sixth reviewer's F1: the mode (quon + level 2) against level 3 has no hold, so this K_T is for levels 2 and 3 moving together.")
print("   Shell: the finer quon at the centre of a thin shell overlaps none of the quon's charge, sigma_at = 0, K_T = -1/3 (not 'no hold':")
print("   Earnshaw's push-off from the neighbours and the rest of the grid). The paper's note says 'no hold'; the lock says -1/3.")
print("   Direct real-space check of (1/y_f - 1)/3: the Hessian of a point charge q_f inside a uniform ball is -(q_f/a^3) I (linear field),")
print("   giving (1/N^3)/a^3 = (4 pi/3)/y_f, i.e. (1/3)/y_f in units of 4 pi; every finer point outside the ball contributes the traceless")
print("   Coulomb Hessian (3 r r^T - I)/r^3, which sums to zero over each cubic shell of the finer grid (isotropic and traceless). So the")
print("   cube sum is (1/3)/y_f, and the long sideways wave's stiffness is the cube sum less the cube's depolarisation 1/3 (the sixth")
print("   reviewer's identity): (1/y_f - 1)/3. Confirmed by a route that uses no Fourier sum and no overlap integral.")