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

blind_trial23_addendum.py

In the investigation at sim/matter_light/check_trial23_fable/blind_trial23_addendum.py · last changed in commit 18036a6, 23 November 2026 · 18,140 bytes · the folder as a zip


"""Blind part of task T1 (trial 23), second script: checks of my own derivations and three additions.

Written after blind_trial23.py and before opening the lock's sections 5 to 7, the trial's script, output,
post hoc checks, results paper, section 12 of the charging-quons page or file 2 of the review pack.

  A1  the Fresnel count: exact integrals, a Monte Carlo of the matched beam, the path at which N_F = 100
  A2  level 1's resonance swept by the cosmological redshift (the Gunn-Peterson test applied to Aspden's lattice)
  A3  the Landau-Zener rate behind A2, integrated numerically, and the splitting from the lock's own n^2(E)
  A4  level 2: self-consistency lengths, the local-field shift, a gas-like level, the rows at the lock's bounds

Run:  ~/aspden-review-venv/bin/python3 blind_trial23_addendum.py > blind_trial23_addendum_out.txt 2> blind_trial23_addendum_err.txt
"""
import math
import subprocess

import numpy as np
from scipy import constants as C
from scipy.integrate import quad, solve_ivp
from scipy.optimize import brentq

c = C.c
e = C.e
eps0 = C.epsilon_0
hbar = C.hbar
kB = C.k
alpha_fs = C.fine_structure
a0 = C.physical_constants["Bohr radius"][0]
me = C.m_e
G = C.G
eV = C.eV
hbarc_eVm = hbar * c / eV
ME_eV = me * c**2 / eV
pc = C.parsec
lP = math.sqrt(hbar * G / c**3)
H0 = 67.4e3 / (1e6 * pc)
Om = 0.3153
rho_crit = 3 * H0**2 / (8 * math.pi * G)
u_crit = rho_crit * c**2


def head(s):
    print()
    print("=" * 100)
    print(s)
    print("=" * 100)


def main():
    commit = subprocess.run(["git", "rev-parse", "HEAD"], capture_output=True, text=True).stdout.strip()
    print("blind_trial23_addendum.py  (29th reviewer, blind part of T1, second script)")
    print("git rev-parse HEAD:", commit)

    # ------------------------------------------------------------------------------------------------
    head("A1. The Fresnel count")
    # ------------------------------------------------------------------------------------------------
    print("Point source S, point detector D, a distance L apart; scalar point scatterers, single scattering.")
    print("In prolate spheroidal coordinates (r1 + r2 = L u, r1 - r2 = L v):  d^3r/(r1 r2) = (L/2) du dv dphi, so")
    print("  mean of sum E_s/E_0 = N (k^2 alpha/(4 pi eps0)) L exp(-ikL) int d^3r exp(ik(r1+r2))/(r1 r2) = i k L N alpha/(2 eps0)")
    print("  EXACTLY (no paraxial step): every shell of equal extra path gives the same amount with a turning phase.")
    print("  The spheroid of extra path lam/2 has semi-axes (L + lam/2)/2 and sqrt(lam L + lam^2/4)/2; volume -> pi lam L^2/6.")
    lam, L = 589.3e-9, 1.0
    A = (L + lam / 2) / 2
    B2 = (L * lam + lam**2 / 4) / 4
    print("  check at lam = 589.3 nm, L = 1 m: exact volume %.9e m^3 ; pi lam L^2/6 = %.9e m^3 ; largest radius %.6e m ; sqrt(lam L)/2 = %.6e m"
          % (4 / 3 * math.pi * A * B2, math.pi * lam * L**2 / 6, math.sqrt(B2), math.sqrt(lam * L) / 2))
    val = quad(lambda u: math.log((u + 1) / (u - 1)) / u, 1, 2)[0] + quad(lambda u: math.log((u + 1) / (u - 1)) / u, 2, np.inf)[0]
    print("  variance integral: int_1^inf ln((u+1)/(u-1)) du/u = %.10f ; pi^2/4 = %.10f -> int d^3r/(r1 r2)^2 = pi^3/L  %s"
          % (val, math.pi**2 / 4, "CHECK pass" if abs(val / (math.pi**2 / 4) - 1) < 1e-8 else "CHECK FAIL"))
    print()
    print("  Matched beam (Gaussian mode sent and the same mode received): each molecule adds a pure phase")
    print("  (k alpha/(2 eps0)) |u(r)|^2/(pi w0^2/2); no random phasor. Relative variance = (1/(N L^2)) int dz/(pi w(z)^2).")
    print("  Confocal beam (Rayleigh range L/2): = pi/(2 N lam L^2) = (pi^2/12)/N_F, so s = 0.9069/sqrt(N_F).")
    print("  Any beam: at most pi/(N lam L^2) (tight focus), less for a wider beam.")
    # Monte Carlo of the matched confocal beam, in units lam = 1
    rng = np.random.default_rng(20261122)
    lamu, Lu = 1.0, 2000.0
    zR = Lu / 2
    w0 = math.sqrt(lamu * zR / math.pi)
    Rcyl = 6 * w0 * math.sqrt(2)          # w at the ends is w0 sqrt(2)
    vol = math.pi * Rcyl**2 * Lu
    print("  Monte Carlo (lam = 1, L = %g, confocal, molecules Poisson in a cylinder of radius %.1f):" % (Lu, Rcyl))
    print("  %10s %12s %14s %14s %14s %14s" % ("N_F", "molecules", "mean/expected", "rms/mean (MC)", "0.9069/sqrt(N_F)", "ratio"))
    ok = True
    for NF in (0.03, 0.3, 3.0, 30.0, 300.0):
        N = 6 * NF / (math.pi * lamu * Lu**2)
        ntrial = 40000 if NF < 10 else 8000
        tot = np.empty(ntrial)
        for i in range(ntrial):
            m = rng.poisson(N * vol)
            z = rng.uniform(-Lu / 2, Lu / 2, m)
            r2 = Rcyl**2 * rng.uniform(0, 1, m)
            w2 = w0**2 * (1 + (z / zR) ** 2)
            tot[i] = np.sum((w0**2 / w2) * np.exp(-2 * r2 / w2)) / (math.pi * w0**2 / 2)
        expected = N * Lu                 # in units of k alpha/(2 eps0)
        mean, rms = tot.mean(), tot.std()
        pred = 0.9069 / math.sqrt(NF)
        good = abs(mean / expected - 1) < 5 * pred / math.sqrt(ntrial) + 1e-3 and abs(rms / mean / pred - 1) < 0.05
        ok = ok and good
        print("  %10.3g %12.3f %14.5f %14.5f %14.5f %14.4f" % (NF, N * vol, mean / expected, rms / mean, pred, rms / mean / pred))
    print("  -> %s: the mean is right even at N_F = 0.03; only the scatter grows, as 0.907/sqrt(N_F)." % ("CHECK pass" if ok else "CHECK FAIL"))
    print()
    print("  Path at which N_F reaches 100 (lam = 589.3 nm): L = sqrt(600/(pi N lam))")
    lam = 589.3e-9
    for name, N in (("air 1e-10 Pa, 20 C", 1e-10 / (kB * 293.15)), ("H atoms 1e6 /m^3", 1e6), ("H atoms 1e5 /m^3", 1e5), ("H atoms 0.25 /m^3", 0.25)):
        print("    %-20s N = %.4e /m^3 : L = %.4e m   (N_F = 1 at %.4e m)" % (name, N, math.sqrt(600 / (math.pi * N * lam)),
                                                                          math.sqrt(6 / (math.pi * N * lam))))
    print("  The molecules move. A gas at speed v refills the first Fresnel zone in sqrt(lam L)/(2 v); a reading averaged over a")
    print("  time T has about T/that many independent fillings. H atoms at 100 K (v ~ 1.6 km/s), L = 1 m: refilled every %.2e s."
          % (math.sqrt(lam * 1.0) / 2 / 1.6e3))

    # ------------------------------------------------------------------------------------------------
    head("A2. Level 1's resonance swept by the redshift (my addition; not in the lock's sections 1 to 4)")
    # ------------------------------------------------------------------------------------------------
    E1 = 511e3
    w1 = E1 * eV / hbar

    def Hz(z):
        return H0 * math.sqrt(Om * (1 + z) ** 3 + 1 - Om)

    print("The lock's n^2 has a pole at E1 = 511 keV in the lattice's frame. A photon from redshift z_s seen at E_obs with")
    print("511/(1+z_s) keV < E_obs < 511 keV was above the pole when it left and below it when it arrived. Its energy crossed")
    print("the pole at 1 + z_r = 511 keV/E_obs. Two ways to say what happens there, with one answer:")
    print("  (i)  each held charge takes light out of the beam with integrated cross-section e^2 f/(4 eps0 m c) (the sum rule),")
    print("       so the optical depth of the sweep is tau = (pi/2) w_p^2/(w1 H) = (pi/2) h1 w1/H(z_r)  [Gunn and Peterson's];")
    print("  (ii) in a perfectly even, loss-free level the photon follows its branch of the dispersion curve; the upper branch")
    print("       ends at E1/sqrt(1-h1) with zero group speed. The chance of jumping the gap is exp(-2 pi g^2/rate), with")
    print("       2g = w1 sqrt(h1) the splitting and rate = H w1: the same exp(-(pi/2) h1 w1/H). Checked in A3.")
    print("w1 = %.5e rad/s ; H0 = %.5e /s ; w1/H0 = %.5e" % (w1, H0, w1 / H0))
    h1_grb = 4.8249e-20
    print("%8s %12s %14s %16s %16s" % ("z_r", "E_obs (keV)", "H(z_r) (/s)", "tau at h1=4.82e-20", "h1 for tau = 1"))
    for zr in (0.0, 0.1, 0.3, 0.5, 0.903):
        tau = 0.5 * math.pi * h1_grb * w1 / Hz(zr)
        print("%8.3f %12.2f %14.5e %16.4e %16.4e" % (zr, 511 / (1 + zr), Hz(zr), tau, 2 * Hz(zr) / (math.pi * w1)))
    h1_gp = 2 * Hz(0.903) / (math.pi * w1)
    h1_gp0 = 2 * Hz(0.0) / (math.pi * w1)
    print("GRB 090510 (z = 0.903): the band %.1f to 511 keV would be dark unless h1 < about %.2e (%.2e for photons that crossed nearby)."
          % (511 / 1.903, h1_gp, h1_gp0))
    print("Abdo et al. fit one smooth spectrum (Band function plus power law) through GBM's 8 keV to 40 MeV and the LAT")
    print("(sources/grb090510.txt lines 200-206, 515-516; GBM BGO band 0.260 to 5 MeV, line 489): that band is not dark.")
    for hfull, lab in ((0.5, "E_p = 361 keV"), (1.0, "E_p = 511 keV")):
        print("    coupling kappa = sqrt(h1/h1_full) < %.3e (%s) from tau < 1 at z_r = 0.903; %.3e at z_r = 0"
              % (math.sqrt(h1_gp / hfull), lab, math.sqrt(h1_gp0 / hfull)))
    print("    beside: GRB timing (e) gives kappa < 2.2e-10 to 3.1e-10; trial 11's bound as the brief quotes it is 1.5e-16,")
    print("    which as a share is kappa^2 h1_full = %.3e to %.3e, already far below the timing bound 4.8e-20."
          % (0.5 * 1.5e-16**2, 1.0 * 1.5e-16**2))
    print("Conditions: the level is present along the path, at rest with the local matter (so the redshift is seen in its frame),")
    print("and its rhythm is 511 keV everywhere. Losses or a broad line do not change tau (it is the integral over the line).")
    print("Curiosity, not physics: Bragg reflection off the lattice needs lam < 2d, E > hc/(2d) = m_e c^2/(72 alpha) = %.2f keV"
          % (ME_eV / (72 * alpha_fs) / 1e3))
    print("    (d = 72 pi r_e = %.4e m); 511 keV x 1.903 = %.2f keV. The match with this burst's 1 + z is a coincidence."
          % (72 * math.pi * C.physical_constants["classical electron radius"][0], 511 * 1.903))

    # ------------------------------------------------------------------------------------------------
    head("A3. Checks of A2")
    # ------------------------------------------------------------------------------------------------
    print("Splitting at the crossing from the lock's own formula: solve (ck)^2 = w^2 n^2(w) at ck = w1, n^2 = 1 - h1 + h1/(1 - w^2/w1^2).")
    print("%10s %16s %16s %14s" % ("h1", "(w+ - w-)/w1", "sqrt(h1)", "ratio"))
    for h1 in (1e-2, 1e-4, 1e-6, 1e-8):
        # (1-h1) x^4 ... with X = (w/w1)^2 : X (1 - h1 + h1/(1-X)) = 1  ->  (1-h1) X^2 - 2 X + 1 = 0 ... solved directly
        f = lambda X: X * (1 - h1 + h1 / (1 - X)) - 1
        s = math.sqrt(h1)
        Xm = brentq(f, 1 - 3 * s, 1 - 1e-3 * s)
        Xp = brentq(f, 1 + 1e-3 * s, 1 + 3 * s)
        split = math.sqrt(Xp) - math.sqrt(Xm)
        print("%10.1e %16.8e %16.8e %14.6f" % (h1, split, s, split / s))
    print("Landau-Zener by direct integration: i a' = -(rate) t a + g b ; i b' = g a  (a: the photon; b: the level's oscillation).")
    print("Start in the photon-like normal mode at -T, end by projecting on the photon-like normal mode at +T (T = 60/sqrt(rate)).")
    print("%10s %20s %20s %12s" % ("g^2/rate", "photon left (numeric)", "exp(-2 pi g^2/rate)", "ratio"))
    okLZ = True
    for ratio in (0.05, 0.2, 0.5, 1.0, 2.0):
        g, rate = math.sqrt(ratio), 1.0
        T = 60.0

        def photon_like(t):
            w, v = np.linalg.eigh(np.array([[-rate * t, g], [g, 0.0]]))
            return v[:, int(np.argmax(np.abs(v[0, :])))]

        def rhs(t, y):
            a = y[0] + 1j * y[1]
            b = y[2] + 1j * y[3]
            da = -1j * (-rate * t * a + g * b)
            db = -1j * (g * a)
            return [da.real, da.imag, db.real, db.imag]
        v0 = photon_like(-T)
        sol = solve_ivp(rhs, (-T, T), [v0[0], 0.0, v0[1], 0.0], rtol=1e-11, atol=1e-13, method="DOP853")
        psi = np.array([sol.y[0, -1] + 1j * sol.y[1, -1], sol.y[2, -1] + 1j * sol.y[3, -1]])
        pa = abs(np.dot(photon_like(T), psi)) ** 2
        pred = math.exp(-2 * math.pi * ratio)
        okLZ = okLZ and abs(pa / pred - 1) < 0.02
        print("%10.2f %20.6e %20.6e %12.5f" % (ratio, pa, pred, pa / pred))
    print("-> %s" % ("CHECK pass (within 2%)" if okLZ else "CHECK FAIL"))
    print("With g = w1 sqrt(h1)/2 and rate = H w1 the exponent is (pi/2) h1 w1/H: the same as the optical depth in (i).")
    # the standard Gunn-Peterson number as a check of the formula
    nH, fosc = 1.9e-7 * 1e6 * 7.0**3, 0.4162
    wLya = 2 * math.pi * c / 121.567e-9
    Hz6 = H0 * math.sqrt(Om * 7.0**3 + 1 - Om)
    tauGP = 0.5 * math.pi * (nH * e**2 * fosc / (eps0 * me)) / (wLya * Hz6)
    print("Check on the known case: neutral hydrogen at the mean density at z = 6 (n_H = 1.9e-7 cm^-3 (1+z)^3, from memory),")
    print("Lyman alpha f = 0.4162: tau = %.3e. The textbook value is about 4e5 to 5e5 (from memory)." % tauGP)

    # ------------------------------------------------------------------------------------------------
    head("A4. Level 2: more on what the share demands")
    # ------------------------------------------------------------------------------------------------
    h2 = 0.75
    print("Lengths in units of the spacing a, with xi = E2 a/(hbar c), charge e, h2 = 0.75:")
    print("  zero-point reach      x_zp/a      = sqrt(h2 xi/(8 pi alpha))   = 1 at xi = %.4f" % (8 * math.pi * alpha_fs / h2))
    print("  Compton wavelength    (hbar/mc)/a = h2 xi^2/(4 pi alpha)       = 1 at xi = %.4f" % math.sqrt(4 * math.pi * alpha_fs / h2))
    print("  rest energy/hold      m c^2/E2    = 4 pi alpha/(h2 xi^3)       = 1 at xi = %.4f, 10 at xi = %.4f"
          % ((4 * math.pi * alpha_fs / h2) ** (1 / 3), (4 * math.pi * alpha_fs / (10 * h2)) ** (1 / 3)))
    print("  classical radius      r_q/a       = h2 xi^2/(4 pi)             = %.2e at xi = 0.23" % (h2 * 0.23**2 / (4 * math.pi)))
    print("  neighbours' Coulomb energy/hold   = alpha/xi                   = %.3f at xi = 0.23" % (alpha_fs / 0.23))
    print("  So the picture 'a charge on a spring at each site' holds together only for xi below about 0.23 to 0.35:")
    print("  the level must be several times finer than the reduced wavelength of its own hold, as ordinary matter is (xi ~ 0.02).")
    print("  A larger charge moves the edge: xi < (4 pi alpha_q/(10 h2))^(1/3) = %.3f at alpha_q = 1, the most a weakly coupled charge allows."
          % ((4 * math.pi / (10 * h2)) ** (1 / 3)))
    print()
    print("Local field. Against bare space (permittivity f eps0) the level's susceptibility is (1-f)/f = %.1f (f = 0.25), %.1f (f = 0.085):"
          % (3.0, 0.915 / 0.085))
    print("  not thin. With the Lorentz local field the one-pole form survives, E2 being the lattice's own resonance, and each")
    print("  charge's own hold is higher: E_hold = E2 sqrt(1 + h2/(3f)) = %.3f E2 (f = 0.25), %.3f E2 (f = 0.085)."
          % (math.sqrt(1 + 0.75 / 0.75), math.sqrt(1 + 0.915 / 0.255)))
    print()
    print("The rows at the lock's own pairs of bounds (hold with the spacing bound of the same limit), charge e, h2 = 0.75:")
    print("%-34s %10s %8s %11s %11s %11s %10s %10s %11s %11s" % ("pair", "E2 (eV)", "xi", "N (/m^3)", "m (kg)", "m c^2 (eV)",
                                                                 "mc2/E2", "x_zp/a", "q for 10x", "its alpha_q"))
    pairs = [("(a): 2.62e19 eV, a = 2.3e-26 m", 2.6196e19, 2.3e-26), ("(e): 2.69e20 eV, a = 3.0e-27 m", 2.6881e20, 3.0e-27),
             ("(e) hold, a = 1.7e-28 m", 2.6881e20, 1.7e-28),
             ("R-iii 1.15e21 eV, a = 3.0e-27 m", 1.1528e21, 3.0e-27), ("R-iii 9.04e23 eV, a = 3.0e-27 m", 9.0380e23, 3.0e-27)]
    for lab, E2, a in pairs:
        xi = E2 * a / hbarc_eVm
        mc2 = E2 * 4 * math.pi * alpha_fs / (h2 * xi**3)
        q2 = 10 * h2 * xi**3 / (4 * math.pi * alpha_fs)
        print("%-34s %10.3e %8.3f %11.3e %11.3e %11.3e %10.3e %10.3f %11.3e %11.3e"
              % (lab, E2, xi, a**-3, mc2 * eV / c**2, mc2, mc2 / E2, math.sqrt(h2 * xi / (8 * math.pi * alpha_fs)),
                 math.sqrt(q2), q2 * alpha_fs))
    print()
    print("Costs at the edge of the classical picture (xi = 0.2304, m c^2 = 10 E2), against the same costs at the spacing bound:")
    print("%-26s %11s %11s %11s %13s %13s %13s %13s" % ("hold", "a (m)", "N (/m^3)", "m (kg)", "rest/crit", "zero-pt/crit",
                                                       "rest/Planck", "R_grav (m)"))
    for lab, E2 in (("(a) 2.62e19 eV", 2.6196e19), ("(e) 2.69e20 eV", 2.6881e20), ("R-iii 1.15e21 eV", 1.1528e21),
                    ("R-iii 9.04e23 eV", 9.0380e23)):
        for xi in (0.2304,):
            a = xi * hbarc_eVm / E2
            N = a**-3
            m = E2 * 4 * math.pi * alpha_fs / (h2 * xi**3) * eV / c**2
            rho = N * m
            uzp = 1.5 * E2 * eV * N
            Rg = math.sqrt(3 * c**2 / (8 * math.pi * G * rho))
            print("%-26s %11.3e %11.3e %11.3e %13.3e %13.3e %13.3e %13.3e"
                  % (lab, a, N, m, rho / rho_crit, uzp / u_crit, rho / (c**5 / (hbar * G**2)), Rg))
    print("  R_grav: a ball of the level larger than this lies inside its own Schwarzschild radius, if gravity acts on it at all.")
    print("  So gravity must be blind to the level to one part in the 'rest/crit' column: the cosmological-constant problem,")
    print("  10^4 to 10^5 times worse than for the ordinary field's zero-point energy cut off at the same energy.")
    print()
    print("A level like a gas (charges at random, S = 1) scatters as k^4 h2^2/(6 pi N). For light to cross:")
    for lab, E, Lp in (("31 GeV over GRB 090510's path", 31e9, 9.728e25), ("1.42 PeV over 1.4 kpc", 1.42e15, 1.4e3 * pc),
                       ("1.1 PeV over 1887 pc", 1.1e15, 1887 * pc)):
        k = E / hbarc_eVm
        Nmin = k**4 * h2**2 * Lp / (6 * math.pi)
        print("    %-30s N > %.3e /m^3, a < %.3e m = %.3f Planck lengths" % (lab, Nmin, Nmin ** (-1 / 3), Nmin ** (-1 / 3) / lP))
    print("  So a gas-like dense level is excluded at every spacing above the Planck length: the level must be ordered.")
    print("  How even: S < 6 pi/(k^4 h2^2 L a^3) at the PeV photon's wavenumber:")
    k = 1.42e15 / hbarc_eVm
    for a in (3.0e-27, 1.7e-28, 1e-29, 1e-30):
        print("    a = %.2e m : S < %.3e" % (a, 6 * math.pi / (k**4 * h2**2 * 1.4e3 * pc * a**3)))
    print()
    print("end of blind_trial23_addendum.py")


if __name__ == "__main__":
    main()