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

check_trial13.py

In the investigation at sim/models_AB/check_trial13_fable/check_trial13.py · last changed in commit 23f12f7, 16 November 2026 · 14,623 bytes · the folder as a zip


"""Fourteenth independent review: reproduction of trial 13 (the held quon, relativistically) by other methods.

Methods (none shared with sim/models_AB/relativistic_hold.py, which uses finite differences, a tridiagonal eigensolver and banded resolvent solves):
  1. Sine (particle-in-a-box, Colbert-Miller) DVR in momentum space: dense symmetric matrices, every eigenpair, spectral derivatives.
     Sums over dipole states are done explicitly (and also by a dense solve), the spread two ways, and the Thomas-Reiche-Kuhn-type
     sum rule for the relativistic kinetic energy is checked.
  2. Closed forms in the ultra-relativistic limit: the Airy zero (mpmath), the virial theorem for <r^2>, and the exact identity
     sum |z_n|^2/dE_n = 1/(2K) for any kinetic energy with a harmonic hold (a uniform field only shifts the hold's centre).
  3. Shooting (DOP853 + brentq) for the l = 0 and l = 1 ultra-relativistic eigenvalues.
  4. The light test beyond the quadratic approximation: the exact group index from the full Sellmeier sum.
Run: ~/aspden-review-venv/bin/python3 check_trial13.py
"""
import numpy as np, scipy, mpmath as mp
from scipy import constants as Kc
from scipy.linalg import eigh, solve
from scipy.optimize import brentq
from scipy.integrate import solve_ivp

c, e, eps0 = Kc.c, Kc.e, Kc.epsilon_0
HC = Kc.hbar * c / e
LY = 9.4607304725808e15
D_SP = 6.37403e-13
N_D = 1 / D_SP ** 3
M0 = 20839.2
E0_CELL = 412.6658 * Kc.m_e * c ** 2 / e
U_MAX = 0.00551496 * D_SP
E_G, L_EFF = 28e9, 21.2e9 * LY
out = []
def say(s=""):
    print(s); out.append(s)
say(f"scipy {scipy.__version__}; hbar c = {HC:.7e} eV m; N_D = {N_D:.4e} m^-3; E0,cell = {E0_CELL:.4e} eV; u_max = {U_MAX:.5e} m")

# ---------------- sine DVR ----------------
def sine_dvr(N, L, A):
    i = np.arange(1, N + 1)
    x = i * L / (N + 1)
    I, J = np.meshgrid(i, i, indexing="ij")
    pref = A * np.pi ** 2 / (2 * L ** 2)
    with np.errstate(divide="ignore", invalid="ignore"):
        T = pref * (-1.0) ** (I - J) * (1 / np.sin(np.pi * (I - J) / (2 * (N + 1))) ** 2 - 1 / np.sin(np.pi * (I + J) / (2 * (N + 1))) ** 2)
    T[np.arange(N), np.arange(N)] = pref * ((2 * (N + 1) ** 2 + 1) / 3 - 1 / np.sin(np.pi * i / (N + 1)) ** 2)
    U = np.sqrt(2 / (N + 1)) * np.sin(np.outer(i, i) * np.pi / (N + 1))   # DVR <-> sine basis
    return x, T, U

# self-test of the DVR kinetic matrix: its eigenvalues must be A (j pi / L)^2
_x, _T, _U = sine_dvr(60, 3.0, 1.7)
_ev = np.sort(np.linalg.eigvalsh(_T)); _ex = 1.7 * (np.arange(1, 61) * np.pi / 3.0) ** 2
say(f"DVR self-test: kinetic eigenvalues vs A (j pi/L)^2, max rel. dev. {np.max(np.abs(_ev / _ex - 1)):.1e}")

def m1_dvr(K, M=M0, N=1200, Lfac=30.0, nstates_print=0):
    """Spinless Salpeter + harmonic hold, momentum space, sine DVR. Returns a dict."""
    A = 0.5 * K * HC ** 2
    scale = max(A ** (1 / 3), (2 * A * M) ** 0.25)
    L = Lfac * scale
    x, T, U = sine_dvr(N, L, A)
    dx = L / (N + 1)
    W = np.sqrt(x ** 2 + M ** 2)
    H0 = T + np.diag(W)
    H1 = T + np.diag(W + 2 * A / x ** 2)
    w0, v0 = eigh(H0); w1, v1 = eigh(H1)
    E0 = w0[0]; chi0 = v0[:, 0]
    if chi0[np.argmax(np.abs(chi0))] < 0: chi0 = -chi0
    # spectral derivative of chi0 on the grid
    cj = U @ chi0                                          # sine-basis coefficients
    j = np.arange(1, N + 1)
    dchi = (np.sqrt(2 / L) * (j * np.pi / L)) @ (cj[:, None] * np.cos(np.outer(j, x) * np.pi / L))  # chi'(x_i), with chi(x_i) = chi0_i/sqrt(dx)
    chi_grid = chi0 / np.sqrt(dx)
    dchi0 = np.sum(cj * np.sqrt(2 / L) * (j * np.pi / L))   # chi'(0) from the sine series
    r2_a = HC ** 2 * (np.sum(dchi ** 2) + 0.5 * dchi0 ** 2) * dx   # trapezoid quadrature of chi'^2 with its x = 0 end point
    r2_b = HC ** 2 * (E0 - chi0 @ (W * chi0)) / A           # exact in the sine basis: (hbar c)^2 <-d^2/dP^2> = (E0 - <W>)/A
    f = HC / np.sqrt(3) * (dchi - chi_grid / x)             # dipole function on the grid
    F = f * np.sqrt(dx)                                     # as a DVR vector
    ov = v1.T @ F                                           # <n1|f>
    dE = w1 - E0
    X1_sum = np.sum(ov ** 2 / dE); X3_sum = np.sum(ov ** 2 / dE ** 3)
    g1 = solve(H1 - E0 * np.eye(N), F); X1_solve = F @ g1
    S1 = np.sum(ov ** 2 * dE)                               # sum dE |z|^2
    S1_rule = 0.5 * HC ** 2 * (chi0 @ ((1 / W - x ** 2 / (3 * W ** 3)) * chi0))   # (1/2)(hbar c)^2 <d^2 W/dPz^2>
    closure = np.sum(ov ** 2)                               # should be <z^2> = <r^2>/3
    alpha = 2 * e * X1_sum
    share = N_D * alpha / eps0
    delay_quad = 1.5 * (N_D / eps0) * 2 * e * X3_sum * E_G ** 2 * L_EFF / c
    def delay_exact(Eg):
        sE = (N_D / eps0) * 2 * e * np.sum(ov ** 2 * dE / (dE ** 2 - Eg ** 2))
        s0 = (N_D / eps0) * 2 * e * X1_sum
        dsE = (N_D / eps0) * 2 * e * np.sum(ov ** 2 * dE * 2 * Eg / (dE ** 2 - Eg ** 2) ** 2)
        ng_minus = 0.5 * (sE - s0) + 0.5 * Eg * dsE          # n_g(E) - n_g(0)
        return ng_minus * L_EFF / c
    return dict(E0=E0, conf=E0 - M, u=np.sqrt(r2_b / 3), u_b=np.sqrt(r2_a / 3), dE1=dE[0], dE=dE[:6], ov2=ov[:6] ** 2,
                X1=X1_sum, X1_solve=X1_solve, X3=X3_sum, S1=S1, S1_rule=S1_rule, closure=closure, r2=r2_b, r2_quad=r2_a,
                alpha=alpha, share=share, delay=delay_quad, delay_exact=delay_exact(E_G), A=A, scale=scale)

def m2_dvr(K, M=M0, N=1200, Lfac=12.0):
    rs = (2 * HC / K) ** (1 / 3)
    L = Lfac * rs
    x, T, U = sine_dvr(N, L, HC ** 2)
    H = T + np.diag((M + 0.5 * K * x ** 2) ** 2)
    w, v = eigh(H, subset_by_index=[0, 0])
    chi = v[:, 0]
    r2 = chi @ (x ** 2 * chi)
    return dict(E0=np.sqrt(w[0]), conf=np.sqrt(w[0]) - M, u=np.sqrt(r2 / 3), rs=rs)

# ---------------- universal ultra-relativistic constants ----------------
say("\nA. Ultra-relativistic closed forms and shooting (dimensionless: -chi'' + (l(l+1)/x^2 + x) chi = eps chi)")
a1 = float(-mp.airyaizero(1))
say(f"   Airy: eps(1S) = {a1:.9f} (first zero of Ai)")
def shoot(eps, l, xmax=18.0):
    x0 = 1e-3
    if l == 0: y0 = [x0 - eps * x0 ** 2 / 2, 1 - eps * x0]              # chi ~ x - eps x^2/2
    else:      y0 = [x0 ** 2 * (1 - eps * x0 ** 2 / 10), 2 * x0 - 0.4 * eps * x0 ** 3]
    sol = solve_ivp(lambda x, y: [y[1], (l * (l + 1) / x ** 2 + x - eps) * y[0]], (x0, xmax), y0, method="DOP853", rtol=1e-12, atol=1e-14)
    return sol.y[0, -1]
e1S = brentq(lambda s: shoot(s, 0), 2.0, 2.6, xtol=1e-12)
e1P = brentq(lambda s: shoot(s, 1), 3.0, 3.7, xtol=1e-12)
e2P = brentq(lambda s: shoot(s, 1), 4.5, 5.2, xtol=1e-12)
say(f"   shooting: eps(1S) = {e1S:.9f} (Airy {a1:.9f}); eps(1P) = {e1P:.9f}; eps(2P) = {e2P:.9f}; eps(1P) - eps(1S) = {e1P - e1S:.7f}")
say(f"   virial (T homogeneous degree 1, V degree 2): <r^2> = 2 E0/(3K), so u = sqrt(2 E0/(9 K)); int chi'^2 dx = eps/3 = {a1/3:.7f}")
say(f"   exact for any kinetic energy with a harmonic hold: sum |z_n|^2/dE_n = 1/(2K); polarizability = e/K; share = N_D e/(K eps0)")

# DVR in scaled units (A = 1, M = 0): check the constants and get the dispersion constant
r = m1_dvr(2 / HC ** 2, M=0.0, N=1600, Lfac=30.0)      # A = 1 eV^3 exactly
say(f"   DVR (A = 1, M = 0, N = 1600): E0 = {r['E0']:.9f}; dE1 = {r['dE1']:.9f}; int chi'^2 = {r['r2']/HC**2:.9f} exact in the basis, {r['r2_quad']/HC**2:.9f} by quadrature (eps/3 = {a1/3:.9f})")
say(f"      sum |z|^2/dE (states) = {r['X1']/HC**2:.9f}, (solve) = {r['X1_solve']/HC**2:.9f}, exact 1/(2K) = {1/(2*2/HC**2)/HC**2:.9f} (in (hbar c)^2/A)")
say(f"      sum dE |z|^2 = {r['S1']/HC**2:.9f} vs (1/2)(hbar c)^2 <2/(3P)> = {r['S1_rule']/HC**2:.9f}; closure sum |z|^2 = {r['closure']/HC**2:.9f} vs <r^2>/3 = {r['r2']/3/HC**2:.9f}")
cX3 = r['X3'] / HC ** 2
say(f"      dispersion constant c_X3 = sum |z|^2/dE^3 in units (hbar c)^2/A^(5/3): {cX3:.7f}; first four dE/A^(1/3): {np.array2string(r['dE'][:4], precision=5)}; their |z|^2 shares of <r^2>/3: {np.array2string(r['ov2'][:4]/(r['r2']/3), precision=4)}")

# ---------------- B. the trial's code checks, by the DVR ----------------
say("\nB. The lock's code checks, redone")
Mh, hw = 1e12, 1e6; Kh = Mh * (hw / HC) ** 2
r = m1_dvr(Kh, M=Mh, N=1200)
u_nr = HC / np.sqrt(2 * Mh * hw)
say(f"   C1 (M = 1e12 eV, hbar w = 1e6 eV): u/u_nr - 1 = {r['u']/u_nr-1:.2e}; dE1/hw - 1 = {r['dE1']/hw-1:.2e}; alpha/(e/K) - 1 = {r['alpha']/(e/Kh)-1:.2e}; sum rule S1/rule - 1 = {r['S1']/r['S1_rule']-1:.1e}")
Ku = 2 * 1e18 / HC ** 2
r = m1_dvr(Ku, M=1e-3, N=1200)
say(f"   C2 (M = 1e-3 eV): E0/(a1 A^(1/3)) - 1 = {r['E0']/(a1*(0.5*Ku*HC**2)**(1/3))-1:.2e}")
say(f"   C4: U15 with s = 1, limit (a): {E_G*np.sqrt(1.5*L_EFF/(c*0.859)):.4e} eV")

# ---------------- C. Q1: the hold N needs ----------------
say("\nC. Q1. K_N from u = u_max")
# closed form (UR): u^2 = (2 a1/9) (A/K) K^(-... ) -> u^2 = (2 a1 /(9 K)) (K (hbar c)^2/2)^(1/3)
KN_cf = ((2 * a1 / 9) * (0.5 * HC ** 2) ** (1 / 3) / U_MAX ** 2) ** 1.5
say(f"   closed form (M -> 0): K_N = {KN_cf:.5e} eV/m^2; E0 = {a1*(0.5*KN_cf*HC**2)**(1/3):.5e} eV")
KN = np.exp(brentq(lambda lk: m1_dvr(np.exp(lk), N=1000)['u'] - U_MAX, np.log(1e34), np.log(1e38), xtol=1e-10))
rN = m1_dvr(KN, N=1600)
say(f"   DVR (M = m0): K_N = {KN:.5e} eV/m^2; E0 - m0c^2 = {rN['conf']:.5e} eV = {rN['conf']/M0:.4e} m0c^2 = {rN['conf']/E0_CELL:.4f} E0,cell; u (basis-exact, quadrature) {rN['u']:.5e}, {rN['u_b']:.5e} m")
say(f"      dE1 = {rN['dE1']:.5e} eV; next dE: {np.array2string(rN['dE'][1:4], precision=4)}; share (states) {rN['share']:.4e}; share exact N_D e/(K eps0) = {N_D*e/(KN*eps0):.4e}")
say(f"      sum rule S1/rule - 1 = {rN['S1']/rN['S1_rule']-1:.1e}; closure/(<r^2>/3) - 1 = {rN['closure']/(rN['r2']/3)-1:.1e}; X1 states/solve - 1 = {rN['X1']/rN['X1_solve']-1:.1e}")
rN2 = m1_dvr(KN, N=2400, Lfac=40.0)
say(f"      convergence (N 1600 -> 2400, L 30 -> 40 scales): conf {rN2['conf']/rN['conf']-1:.1e}, dE1 {rN2['dE1']/rN['dE1']-1:.1e}, X3 {rN2['X3']/rN['X3']-1:.1e}, u {rN2['u']/rN['u']-1:.1e}")
say(f"      trial: K_N = 1.2030e36, conf = 6.6876e7 eV = 3.209e3 m0c^2 = 0.317 E0,cell, dE1 = 2.9274e7 eV, share 5.808e-8")
K2 = np.exp(brentq(lambda lk: m2_dvr(np.exp(lk), N=1000)['u'] - U_MAX, np.log(1e34), np.log(1e38), xtol=1e-10))
r2_ = m2_dvr(K2, N=1600); r2b = m2_dvr(K2, N=2400, Lfac=16.0)
say(f"   M2 (Klein-Gordon, scalar hold): K_N = {K2:.5e} eV/m^2; conf = {r2_['conf']:.5e} eV = {r2_['conf']/M0:.4e} m0c^2 = {r2_['conf']/E0_CELL:.4f} E0,cell (convergence {r2b['conf']/r2_['conf']-1:.1e}); trial 1.4965e36, 5.9970e7 eV, 0.284")
# quartic-oscillator constant for M2
xq, Tq, _ = sine_dvr(1200, 12.0, 1.0); wq = eigh(Tq + np.diag(xq ** 4), eigvals_only=True, subset_by_index=[0, 1])
say(f"   M2 check: first odd eigenvalue of -d^2/dy^2 + y^4 = {wq[0]:.9f} (literature 3.7996730); E0 = sqrt(eps) hbar c (K/2 hbar c)^(1/3) = {np.sqrt(wq[0])*HC*(K2/(2*HC))**(1/3):.5e} eV")

# ---------------- D. Q2: the hold light needs ----------------
say("\nD. Q2. The hold light needs (M1): quadratic delay (the lock's form) and the exact group index")
def K_for(fun, target, lo=1e40, hi=1e52):
    return np.exp(brentq(lambda lk: np.log(fun(np.exp(lk)) / target), np.log(lo), np.log(hi), xtol=1e-9))
Kgap = K_for(lambda K: m1_dvr(K, N=800)['dE1'], 28e9)
say(f"   K for dE1 = 28 GeV: {Kgap:.4e} eV/m^2")
res = {}
for lim, dt in (("(a)", 0.859), ("(e)", 0.010)):
    Kq = K_for(lambda K: m1_dvr(K, N=800)['delay'], dt)
    Kx = K_for(lambda K: m1_dvr(K, N=800)['delay_exact'], dt, lo=1.5 * Kgap)
    rq = m1_dvr(Kq, N=1600); rx = m1_dvr(Kx, N=1600)
    res[lim] = (Kq, rq, Kx, rx)
    say(f"   limit {lim}, quadratic: K = {Kq:.5e}; dE1 = {rq['dE1']:.5e} eV; conf = {rq['conf']:.5e} eV = {rq['conf']/M0:.3e} m0c^2; share {rq['share']:.4e} (exact N_D e/K eps0 {N_D*e/(Kq*eps0):.4e}); u = {rq['u']/D_SP:.4e} d; delay quad {rq['delay']:.4e} s, exact at this K {rq['delay_exact']:.4e} s; E_G/dE1 = {E_G/rq['dE1']:.3f}")
    say(f"   limit {lim}, exact:     K = {Kx:.5e}; dE1 = {rx['dE1']:.5e} eV; conf = {rx['conf']:.5e} eV; u = {rx['u']/D_SP:.4e} d; delay exact {rx['delay_exact']:.4e} s;  dE1 shift {rx['dE1']/rq['dE1']-1:+.3f}, K shift {Kx/Kq-1:+.3f}")
say(f"   trial: (a) K = 1.4256e46, dE1 = 6.6740e10, conf 1.5252e11 = 7.32e6 m0c^2, share 4.901e-18, u 2.419e-6 d; (e) K = 2.0626e47, dE1 = 1.6263e11, conf 3.7163e11")
# UR scaling check: delay ~ K^(-5/3)
Ka, ra = res["(a)"][0], res["(a)"][1]
say(f"   UR scaling: dE1/A^(1/3) = {ra['dE1']/ra['A']**(1/3):.6f} (eps1P - eps1S = {e1P-e1S:.6f}); conf/A^(1/3) = {(ra['conf']+M0)/ra['A']**(1/3):.6f} (a1 = {a1:.6f}); X3 A^(5/3)/(hbar c)^2 = {ra['X3']*ra['A']**(5/3)/HC**2:.6f} (c_X3 {cX3:.6f})")
# closed form for K_light from the UR constants: delay = 1.5 (N_D/eps0) 2 e c_X3 (hbar c)^2 A^(-5/3) E_G^2 L/c
A_a = (1.5 * (N_D / eps0) * 2 * e * cX3 * HC ** 2 * E_G ** 2 * L_EFF / c / 0.859) ** 0.6
say(f"   closed form, limit (a): A = {A_a:.5e} eV^3 -> K = {2*A_a/HC**2:.5e} eV/m^2, dE1 = {(e1P-e1S)*A_a**(1/3):.5e} eV, E0 = {a1*A_a**(1/3):.5e} eV")

# ---------------- E. Q3 and the verdict's numbers ----------------
say("\nE. Q3. The barrier, the inertia ratio, and the hold's drag")
for name, K in (("N's hold", KN), ("light (a), quadratic", res["(a)"][0]), ("light (a), exact", res["(a)"][2]), ("light (e), quadratic", res["(e)"][0])):
    b = 24 * 0.5 * K * ((np.sqrt(2) - 1) * D_SP) ** 2
    say(f"   {name:22s}: K = {K:.4e} -> barrier (nearest sites) {b:.4e} eV = {b/1.4e15:.3e} x 1.4 PeV")
own = (12 * 0.7654 ** 2 + 12 * 1.0824 ** 2) / (24 * 0.41421 ** 2)
say(f"   own-site barrier / nearest-site barrier = {own:.3f}")
Om = Kc.m_e * c ** 2 / Kc.hbar; r_orb = Kc.hbar / (2 * Kc.m_e * c)
Fq = M0 * Om ** 2 * r_orb / c ** 2                   # m0 Omega^2 r in eV/m
E0a = res["(a)"][1]['conf'] + M0
say(f"   eq. 7.5's force m0 Omega^2 r = {Fq:.4e} eV/m; if the held quon's inertia were E0/c^2 the orbit would need {E0a/M0:.3e} times that; the hold would supply it with a lag of {(E0a-M0)*Om**2*r_orb/c**2/Ka:.2e} m")
say(f"   at light's hold (a): (1/2) K u^2 = {0.5*Ka*ra['u']**2:.3e} eV against the pair threshold 2 m0c^2 = {2*M0:.3e} eV (the Klein regime is inside the ground state's own spread)")
say(f"   hold energy per cell / E0,cell at light's hold (a): {ra['conf']/E0_CELL:.1f}")

# ---------------- F. NR comparison: what trial 12's formulas gave at these K ----------------
say("\nF. For reference: the non-relativistic oscillator at the same K (trial 12's formulas)")
for name, K in (("K_N", KN), ("K_light(a)", Ka)):
    hw_nr = HC * np.sqrt(K / M0)
    say(f"   {name}: hbar w = {hw_nr:.3e} eV, NR spread {HC/np.sqrt(2*M0*hw_nr)/D_SP:.3e} d (relativistic {m1_dvr(K, N=800)['u']/D_SP:.3e} d)")

with open(__file__.replace(".py", "_out.txt"), "w") as fh:
    fh.write("\n".join(out) + "\n")