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

evenness_edge.py

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


#!/usr/bin/env python3
"""Trial 23, level 2: the evenness condition against the sound speed, the charge and the hold.

29th reviewer (Fable 5.2, maximum effort), post hoc, own code. Nothing is imported from the trial.
Order of magnitude only: a continuum model of zero-point sound, pushed to sound speeds near c.

What each term stands for
  A photon (wavenumber k) crossing a lattice whose sites can move may hand part of its energy to one quantum of the
  lattice's sound (zero-point Brillouin scattering; only the loss is possible, the sound being in its ground state).
  mu      the chance per metre that it does                                                   [D]
  h2      the share of the vacuum's permittivity the level carries (1 - f)                    [M, the lock]
  LF      ((1/f + 2)/3)^2, the local field at a site (Lorentz), as trial 20 took it          [S, the record's form]
  a       the lattice spacing; M the mass that moves with one site; rho = M/a^3               [M]
  c_s     the speed of the lattice's sound; b = c_s/c                                         [M]
  S(q)    hbar q/(2 M c_s): the zero-point density fluctuation of sound at wavenumber q       [S]
  Trial 20's form (the 23rd reviewer's): mu = (k^4/(6 pi)) h2^2 LF a^3 S, with S = hbar k/(2 M c_s) at c_s = c.
  Then mu L < 1 needs rho > rho0 = hbar k^5 h2^2 LF L/(12 pi c): the same at every spacing.   [D]

The kinematics (mine)                                                                          [D]
  k -> k' + q with c k = c k' + c_s |q|. With r = k'/k, u = 1 - cos(theta):
      (1 - r)^2 (1 - b^2) = 2 r b^2 u.
  The rate into a solid angle goes as k k'^3 S(q) (1 + cos^2 theta) J, where J = 1/|1 + b dq/dk'| comes from the
  energy condition. J = 2 r/((1 - b^2)(1 + r)) (derived here; checked below by a finite difference).
  Summed over angles, relative to trial 20's form at c_s = c:
      rho_needed = rho0 D(b),   D(b) = (3/(8 b^4)) int_{r_min}^{1} [1 + (1 - u)^2] r^2 (1 - r)^2 dr,
      u = (1 - b^2)(1 - r)^2/(2 b^2 r),   r_min = r at u = 2 (straight back).
  Limits: D -> 1.3143/b for slow sound (the angle average of q is 1.3143 k);
          D -> 1/40 as b -> 1 from below (the loss then goes into a narrow forward cone and does NOT vanish).
  My earlier output report_numbers_out.txt, section 2, took r^3 at 90 and 180 degrees as the fall of the whole rate.
  That was wrong: the forward cone, where r is not small, carries the rate. This script replaces that conclusion.
"""
import math
import subprocess
import sys

import numpy as np
from scipy.integrate import quad
from scipy.optimize import brentq

hbar = 1.054571817e-34
c = 299792458.0
eV = 1.602176634e-19
eps0 = 8.8541878128e-12
G = 6.67430e-11            # CODATA 2018, from memory
PC = 3.0856775814913673e16
ALPHA = 1 / 137.035999084   # CODATA 2018, from memory
H0 = 67.4e3 / (1e6 * PC)   # the lock's inputs
OM, ZS = 0.3153, 0.903
hbarc_J = hbar * c
M_PLANCK = math.sqrt(hbar * c / G)
L_PLANCK = math.sqrt(hbar * G / c**3)
RHO_PLANCK = c**5 / (hbar * G**2)

checks = [0, 0]


def check(ok, text, detail=""):
    checks[1] += 1
    checks[0] += bool(ok)
    print(f"   CHECK {'pass' if ok else 'FAIL'}: {text} {detail}")


def r_of(b, u):
    """The photon's surviving fraction k'/k at 1 - cos(theta) = u, sound at b c (b < 1)."""
    A = 1 + b * b * u / (1 - b * b)
    return 1 / (A + math.sqrt(A * A - 1))


def D_closed(b):
    """Needed density over trial 20's rho0 (see the header)."""
    eps = 1 - b * b
    kap = eps / (2 * b * b)
    rmin = r_of(b, 2.0)

    def f(r):
        u = kap * (1 - r) ** 2 / r
        return (1 + (1 - u) ** 2) * r * r * (1 - r) ** 2

    val = quad(f, rmin, 1.0, epsabs=0, epsrel=1e-12, limit=400)[0]
    return 3 * val / (8 * b**4)


def D_direct(b):
    """The same by a different road: integrate over the angle, the Jacobian by a finite difference of the energy condition."""
    def g(r, u):                      # (k' + b q)/k ; the energy condition is g = 1
        return r + b * math.sqrt((1 - r) ** 2 + 2 * r * u)

    def f(u):
        if u <= 0:
            return 0.0
        r = brentq(lambda rr: g(rr, u) - 1, 1e-300, 1.0, xtol=1e-15, rtol=1e-15)
        h = 1e-6 * r
        dg = (g(r + h, u) - g(r - h, u)) / (2 * h)
        q = math.sqrt((1 - r) ** 2 + 2 * r * u)
        return (1 + (1 - u) ** 2) * r**3 * q / abs(dg)

    eps = 1 - b * b
    pts = sorted({min(2.0, eps * s) for s in (0.01, 0.1, 1, 10, 100)} | {1.0})
    edges = [0.0] + [p for p in pts if 0 < p < 2.0] + [2.0]
    val = sum(quad(f, lo, hi, epsabs=0, epsrel=1e-10, limit=400)[0] for lo, hi in zip(edges[:-1], edges[1:]))
    return 3 * val / (8 * b)


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


def rho0(E_eV, L, f):
    """Trial 20's form turned into a mass density: sound at c, S = hbar k/(2 M c)."""
    k = E_eV * eV / hbarc_J
    h2 = 1 - f
    LF = ((1 / f + 2) / 3) ** 2
    return hbar * k**5 * h2**2 * LF * L / (12 * math.pi * c)


def rho_edge(E2_eV, alpha_q, h2=0.75):
    """Mass density of the oscillators at the classical edge m c^2 = 10 E2 (the lock's VB3): 100 h2 E2^4/(4 pi alpha_q c^2 (hbar c)^3)."""
    E2 = E2_eV * eV
    return 100 * h2 * E2**4 / (4 * math.pi * alpha_q * c**2 * hbarc_J**3)


def a_edge(E2_eV, alpha_q, h2=0.75):
    return (4 * math.pi * alpha_q / (10 * h2)) ** (1 / 3) * hbarc_J / (E2_eV * eV)


def main():
    head = subprocess.run(["git", "rev-parse", "HEAD"], capture_output=True, text=True).stdout.strip()
    print("Trial 23, level 2: the evenness condition against the sound speed, the charge and the hold.")
    print("29th reviewer, post hoc, own derivation. Order of magnitude only.")
    print(f"git HEAD: {head} ; python {sys.version.split()[0]} ; numpy {np.__version__}")
    T0 = quad(lambda z: 1 / Hz(z), 0, ZS)[0]
    print(f"T0 = {T0:.4e} s ; Planck mass {M_PLANCK:.4e} kg ; Planck length {L_PLANCK:.3e} m ; Planck density {RHO_PLANCK:.3e} kg/m^3")

    print("\n" + "=" * 100)
    print("1. The needed density against the sound speed: rho_needed = rho0 D(b), b = c_s/c")
    print("=" * 100)
    print("   D = 1 is trial 20's form (S = hbar k/(2 M c), sound at c, no kinematics).")
    print(f"   {'b = c_s/c':<12}{'D(b)':<14}{'by the angle integral':<24}{'slow-sound form 1.3143/b':<26}{'r straight back':<16}")
    worst = 0.0
    Dtab = {}
    for b in (0.0001, 0.001, 0.01, 0.03, 0.1, 0.2, 0.3, 0.5, 0.7, 0.9, 0.99, 0.999, 0.999999):
        d1 = D_closed(b)
        Dtab[b] = d1
        if 0.05 <= b <= 0.995:
            d2 = D_direct(b)
            worst = max(worst, abs(d2 / d1 - 1))
            s2 = f"{d2:<24.6g}"
        else:
            s2 = f"{'(not run)':<24}"
        print(f"   {b:<12.6g}{d1:<14.6g}{s2}{1.3143 / b:<26.5g}{r_of(b, 2.0):<16.4e}")
    slow = (3 / 8) * quad(lambda x: (1 + x * x) * math.sqrt(2 * (1 - x)), -1, 1, epsabs=0, epsrel=1e-12, limit=200)[0]
    check(abs(slow - 184 / 140) < 1e-8, "the angle average of q/k for slow sound is 184/140 = 1.3143", f"({slow:.8f})")
    # to first order in b (by hand): r = 1 - b s, s = sqrt(2u); r^3 (q/k) J = s (1 - 4 b s); (3/8) int w 2u du = 2; so D b = 1.3143 - 8 b
    check(abs(Dtab[0.0001] * 0.0001 - (slow - 8 * 0.0001)) < 1e-5, "D(b) b = 1.3143 - 8 b for slow sound (first order, by hand)",
          f"({Dtab[0.0001] * 0.0001:.6f} against {slow - 8e-4:.6f} at b = 0.0001; {Dtab[0.001] * 0.001:.5f} against {slow - 8e-3:.5f} at 0.001)")
    check(abs(Dtab[0.999999] * 40 - 1) < 1e-4, "D tends to 1/40 as the sound speed tends to c from below", f"({Dtab[0.999999]:.7f})")
    check(worst < 1e-6, "the closed form equals the angle integral with a finite-difference Jacobian (b = 0.1 to 0.99)", f"(worst relative difference {worst:.1e})")
    D_c = 1 / 40
    D_01 = Dtab[0.1]
    D_05 = Dtab[0.5]
    print(f"   So the needed density never falls below rho0/40, however close the sound is to c (from below).")
    print(f"   At 0.5 c it is {D_05:.3f} rho0; at 0.1 c, {D_01:.2f} rho0; at 0.01 c, {Dtab[0.01]:.1f} rho0.")
    print("   Sound at or above c at every wavelength, or sites that cannot move, are the only escapes in this model.")

    print("\n" + "=" * 100)
    print("2. The needed density for the three photons (kg/m^3)")
    print("=" * 100)
    photons = (("GRB 090510, 28 GeV, c T0", 28e9, c * T0), ("the Crab, 1.1 PeV, 1887 pc", 1.1e15, 1887 * PC),
               ("LHAASO, 1.42 PeV, 1.4 kpc", 1.42e15, 1.4e3 * PC))
    print(f"   {'photon and path':<30}{'f':<8}{'rho0 (trial 20s form)':<24}{'sound just below c':<20}{'0.5 c':<12}{'0.1 c':<12}{'0.01 c':<12}{'lowest, of Planck':<18}")
    R0 = {}
    for lab, E, L in photons:
        for f in (0.25, 0.085):
            r0 = rho0(E, L, f)
            R0[(lab, f)] = r0
            print(f"   {lab:<30}{f:<8}{r0:<24.3e}{r0 * D_c:<20.2e}{r0 * D_05:<12.2e}{r0 * D_01:<12.2e}{r0 * Dtab[0.01]:<12.2e}{r0 * D_c / RHO_PLANCK:<18.1e}")
    check(abs(R0[("LHAASO, 1.42 PeV, 1.4 kpc", 0.25)] / 1.750e85 - 1) < 2e-3 and abs(R0[("GRB 090510, 28 GeV, c T0", 0.25)] / 1.175e68 - 1) < 2e-3,
          "rho0 equals report_numbers_out.txt section 1 (1.750e85 and 1.175e68 kg/m^3)",
          f"({R0[('LHAASO, 1.42 PeV, 1.4 kpc', 0.25)]:.3e}, {R0[('GRB 090510, 28 GeV, c T0', 0.25)]:.3e})")

    print("\n" + "=" * 100)
    print("3. The 28 GeV photon against the classical edge (m c^2 = 10 holds), f = 0.25")
    print("=" * 100)
    E2e, E2a = 2.688e20, 2.620e19
    re_e, re_a = rho_edge(E2e, ALPHA), rho_edge(E2a, ALPHA)
    print(f"   The oscillators' own density at the edge, q = e: {re_e:.3e} kg/m^3 (hold 2.688e20 eV, spacing {a_edge(E2e, ALPHA):.3e} m);")
    print(f"                                                   {re_a:.3e} kg/m^3 (hold 2.620e19 eV, spacing {a_edge(E2a, ALPHA):.3e} m).")
    check(abs(re_e / 9.906e68 - 1) < 1e-3 and abs(re_a / 8.941e64 - 1) < 1e-3 and abs(rho_edge(E2e, 0.1) / 7.229e67 - 1) < 1e-3,
          "the edge densities equal charge_sweep_out.txt (9.906e68, 8.941e64; 7.229e67 at coupling 0.1)",
          f"({re_e:.3e}, {re_a:.3e}, {rho_edge(E2e, 0.1):.3e})")
    r0 = R0[("GRB 090510, 28 GeV, c T0", 0.25)]
    b_eq = brentq(lambda b: D_closed(b) - re_e / r0, 0.01, 0.99)
    print(f"   The (e) hold's edge with q = e meets the 28 GeV condition for sound faster than {b_eq:.3f} c (D = {re_e / r0:.2f}).")
    print(f"   {'sound':<22}{'needed (kg/m^3)':<18}{'(e) edge, q = e':<20}{'largest coupling, charge':<28}{'least hold, q = e (eV)':<24}"
          f"{'(a) edge short by':<20}{'(a): spacing below (m)':<24}{'its m (kg)':<12}{'m c^2/hold':<12}")
    for lab, D in (("just below c", D_c), ("trial 20's form (D=1)", 1.0), ("0.5 c", D_05), ("0.1 c", D_01)):
        need = r0 * D
        margin = re_e / need
        aq_max = ALPHA * re_e / need                    # rho_edge goes as 1/alpha_q
        q_max = math.sqrt(aq_max / ALPHA)
        E2_min = E2e * (need / re_e) ** 0.25            # rho_edge goes as E2^4
        short = need / re_a
        if short > 1:
            a_need = a_edge(E2a, ALPHA) * (re_a / need) ** (1 / 6)   # with q = e the density goes as a^-6
            m_need = need * a_need**3
            s_a = f"{short:<20.3g}{a_need:<24.3e}{m_need:<12.3e}{m_need * c**2 / (E2a * eV):<12.3g}"
        else:
            s_a = f"{'met':<20}{'(the edge itself)':<24}{'':<12}{'':<12}"
        s_m = f"met {margin:.3g} times over" if margin >= 1 else f"short by {1 / margin:.3g}"
        print(f"   {lab:<22}{need:<18.3e}{s_m:<20}{f'{aq_max:.3g}, {q_max:.2f} e':<28}{E2_min:<24.3e}{s_a}")
    print("   The charge sweep's corners for the (e) hold (charge_sweep_out.txt): coupling 0.1 has 7.2e67, coupling 1 has 7.2e66,")
    print("   and the trial's own spacing 3.0e-27 m (coupling 41) has 1.8e65 kg/m^3: compare with the 'needed' column.")

    print("\n" + "=" * 100)
    print("4. The PeV photons against the classical edge of the (e) hold, q = e, f = 0.25")
    print("=" * 100)
    print(f"   {'photon':<30}{'sound':<24}{'needed (kg/m^3)':<18}{'edge short by':<16}{'spacing below (m)':<20}{'oscillator (kg)':<17}{'Planck masses':<15}{'m c^2/hold':<12}")
    got = {}
    for lab, E, L in photons[1:]:
        for slab, D in (("just below c", D_c), ("trial 20's form (D=1)", 1.0), ("0.5 c", D_05), ("0.1 c", D_01)):
            need = R0[(lab, 0.25)] * D
            a_need = a_edge(E2e, ALPHA) * (re_e / need) ** (1 / 6)
            m_need = need * a_need**3
            got[(lab, slab)] = a_need
            print(f"   {lab:<30}{slab:<24}{need:<18.3e}{need / re_e:<16.2e}{a_need:<20.3e}{m_need:<17.3e}{m_need / M_PLANCK:<15.3g}{m_need * c**2 / (E2e * eV):<12.3g}")
    a_lh = got[("LHAASO, 1.42 PeV, 1.4 kpc", "trial 20's form (D=1)")]
    check(abs(a_lh / 3.31e-31 - 1) < 5e-3,
          "in trial 20's form the LHAASO spacing equals compare_trial23_out.txt section 7 (3.31e-31 m)", f"({a_lh:.3e} m)")
    k_l = 1.42e15 * eV / hbarc_J
    print(f"   The 1.42 PeV photon's k a at the edge: {k_l * a_edge(E2e, ALPHA):.2e} (the long-wave form applies).")
    print("   A gas-like level (free sites, S = 1) is opaque to it at every spacing above the Planck length (compare_trial23_out.txt, section 7).")

    print("\n" + "=" * 100)
    print("5. Trial 20's own case with the kinematics: the 28 GeV photon at 2.3e-26 m, f = 0.25")
    print("=" * 100)
    cell = R0[("GRB 090510, 28 GeV, c T0", 0.25)] * 2.3e-26**3
    print(f"   Mass that must move with one site, M = rho_needed a^3: trial 20's form {cell:.2e} kg ({cell / M_PLANCK:.3f} Planck masses;")
    print("   the 23rd reviewer's 1.2e-9 kg is for S below 2e-17, mine for S below 1.75e-17).")
    for slab, D in (("sound just below c", D_c), ("0.5 c", D_05), ("0.1 c", D_01), ("0.01 c", Dtab[0.01])):
        print(f"   {slab:<22}{cell * D:.2e} kg ({cell * D / M_PLANCK:.2e} Planck masses)")

    print("\n" + "=" * 100)
    print("6. What this replaces")
    print("=" * 100)
    print("   report_numbers_out.txt, section 2, lines 44 to 48, said a fall of 1e16 'takes ... sound within 4.6e-06 of c' and that")
    print("   'Sound at c to the precision above ... escape'. Withdrawn: that was the fall at 90 degrees, not of the whole rate.")
    print(f"   The whole rate falls to no less than 1/40 of trial 20's form (section 1). For the 1.42 PeV photon the level then needs")
    print(f"   at least {R0[('LHAASO, 1.42 PeV, 1.4 kpc', 0.25)] * D_c:.1e} kg/m^3 ({R0[('LHAASO, 1.42 PeV, 1.4 kpc', 0.25)] * D_c / RHO_PLANCK:.0e} of Planck's) if its sites can move and its sound is slower than light.")

    print(f"\nChecks: {checks[0]} of {checks[1]} pass.")


if __name__ == "__main__":
    main()