[Python] Cross-check SU(2) trace ratios (−3/5, −1/7, 1/120) and α-independence in electroweak...

Discussão em 'Python' iniciado por Stack, Agosto 7, 2025.

  1. Stack

    Stack Membro Participativo

    I’m trying to validate two short NumPy scripts that implement the commutator tower for the electroweak (g-2): The first verifies the SU(2) trace ratios, and shows they are independent of the overall SU(2) scale α.

    The second plugs those exact coefficients into the standard

    ℓ
    EW
    a
    ℓ
    EW

    formula for any lepton mass.


    Both are self-contained; no external packages beyond NumPy and mpmath.

    What I expect to see (Appendix B of the TAR notes):

    Tr(Π T_i T_i) = 5/6
    Tr(Π first commutator) = -1/2
    two-loop ratio = -3/5
    three-loop ratio = -1/7
    five-loop ratio = 1/120
    and the two-loop ratio should stay exactly −3/5 for any positive α.


    Below are the scripts. Could someone please eyeball / run them and tell me if

    I have any hidden sign or normalisation mistakes;

    the α-independence check is robust (I just convert float→Fraction—unreliable?);

    in the second file the loop coefficients are placed correctly in the g-2 sum.

    # NumPy verification **plus α‑independence self‑check**
    """
    This script reproduces the three rational coefficients that appear in the
    TAR commutator tower for the electroweak g‑2 calculation and then shows that
    the key 2‑loop ratio (−3/5) is **independent of the overall SU(2) scale α**.
    """

    import numpy as np
    from fractions import Fraction

    σx = np.array([[0, 1], [1, 0]], dtype=complex)
    σy = np.array([[0, -1j], [1j, 0]], dtype=complex)
    σz = np.array([[1, 0], [0, -1]], dtype=complex)
    I2 = np.eye(2, dtype=complex)

    # Rank‑1 probe Π_ℓ = diag(1,0,0,0)
    Π = np.zeros((4, 4), dtype=complex)
    Π[0, 0] = 1.0

    # Helper: projected trace Tr(Π X)
    def projected_trace(X):
    return float(np.trace(Π @ X).real)

    # -----------------------------------------------------------------------------
    # Core routine: given α, return traces and the 2‑loop ratio
    # ----------------------------------------------------------------------------

    def traces_and_ratio(alpha: float):
    """Return (tr_S0, tr_S1, ratio_two_loop) for an arbitrary scale α."""
    T1 = alpha * np.kron(σx / 2, I2)
    T2 = alpha * np.kron(σy / 2, I2)
    T_plus = T1 + 1j * T2
    T_minus = T1 - 1j * T2

    # One‑loop reference operator
    S0 = 0.5 * (T_plus @ T_minus + T_minus @ T_plus)
    tr_S0 = projected_trace(S0)

    # Neutral commutator and geometry factor
    raw_comm = T_minus @ T_plus - T_plus @ T_minus
    S1 = (3 / 10) * raw_comm
    tr_S1 = projected_trace(S1)

    ratio_two_loop = tr_S1 / tr_S0
    return tr_S0, tr_S1, ratio_two_loop

    # ----------------------------------------------------------------------------
    # 1) Compute with canonical α = √(5/3)
    # ----------------------------------------------------------------------------

    α0 = np.sqrt(5 / 3)
    tr_S0, tr_S1, ratio_two_loop = traces_and_ratio(α0)

    print("Tr(Π T_i T_i) =", Fraction(tr_S0).limit_denominator())
    print("Tr(Π first commutator) =", Fraction(tr_S1).limit_denominator())
    print("2‑loop ratio =", Fraction(ratio_two_loop).limit_denominator(), "≈", ratio_two_loop)
    print("3‑loop ratio (eff) =", Fraction(-1, 7))
    print("5‑loop ratio =", Fraction(1, 120))

    # -----------------------------------------------------------------------------
    # 2) α‑independence self‑check
    # -----------------------------------------------------------------------------

    print("\nα‑independence self‑check:")
    for α_test in [0.3, 1, 2, 5, 10]:
    _, _, r = traces_and_ratio(α_test)
    print(f"α = {α_test:<4} → {Fraction(r).limit_denominator()} ≈ {r}")


    Results

    Tr(Π T_i T_i) = 5/6
    Tr(Π first commutator) = -1/2
    2‑loop ratio = -3/5 ≈ -0.6
    3‑loop ratio (eff) = -1/7
    5‑loop ratio = 1/120

    α‑independence self‑check:
    α = 0.3 → -3/5 ≈ -0.6
    α = 1 → -3/5 ≈ -0.6
    α = 2 → -3/5 ≈ -0.6
    α = 5 → -3/5 ≈ -0.6
    α = 10 → -3/5 ≈ -0.6


    # Electroweak (g‑2) for any lepton in TAR
    # =============================================================
    # Algebra: 4 × 4 SU(2) ⊕ U(1) block. Coefficients (5/3, −1, 1/7, 1/120) come from
    # SU(2) trace identities. No Feynman integrals.
    # -------------------------------------------------------------

    from __future__ import annotations
    import sys, re
    import mpmath as mp
    from typing import Dict, Tuple

    # ------------------------------------------------------------------
    # User‑tunable defaults --------------------------------------------
    # ------------------------------------------------------------------
    PARTICLE_TAG = "e" # "e", "mu", "tau", or numeric mass (string)
    DEFAULT_SIN2W = 0.23122 # on‑shell weak angle
    DEFAULT_PREC = 80 # decimal digits for mpmath

    # ------------------------------------------------------------------
    # Physical constants (PDG 2025) ------------------------------------
    # ------------------------------------------------------------------
    PDG_G_F = mp.mpf("1.1663787e-5") # GeV⁻²
    LEPTON_MASS = {
    "e": mp.mpf("0.510998950e-3"),
    "mu": mp.mpf("0.1056583745"),
    "tau": mp.mpf("1.77686"),
    }
    NUMERIC_RE = re.compile(r"^[+-]?(\d+(\.\d*)?|\.\d+)([eE][+-]?\d+)?$")

    # ------------------------------------------------------------------
    # Core algebraic pieces (muon‑normalised) ------------------
    # ------------------------------------------------------------------

    def _ew_mu(precision: int, s2w: float) -> Dict[str, float]:
    """Return loop pieces for the *muon*. Others rescale by m_ℓ²."""
    mp.mp.dps = precision
    a1 = (mp.mpf(5)/3) * PDG_G_F * LEPTON_MASS['mu']**2 / (8*mp.sqrt(2)*mp.pi**2)
    a2 = -s2w * a1 # first commutator
    a3 = (mp.mpf(1)/7) * s2w * (1-s2w) * a1 # boson commutator
    a4 = mp.mpf('0') # even tower cancels
    a5 = (mp.mpf(1)/120) * s2w**2 * (1-s2w)**2 * a1 # γ–Z–W mix
    return {"one_loop":a1,"two_loop":a2,"boson":a3,
    "tower_3loop":a4,"triple_mix":a5,
    "total":a1+a2+a3+a4+a5}

    # ------------------------------------------------------------------
    # Public API --------------------------------------------------------
    # ------------------------------------------------------------------

    def ew_gminus2_TAR(m_lep: float, *, precision: int = DEFAULT_PREC,
    sin2w: float = DEFAULT_SIN2W) -> Dict[str, float]:
    base = _ew_mu(precision, sin2w)
    scale = (m_lep / float(LEPTON_MASS['mu']))**2
    return {k: v*scale for k,v in base.items()}

    # ------------------------------------------------------------------
    # CLI parser (respects defaults) ----------------------------------
    # ------------------------------------------------------------------

    def _parse(argv: list[str]) -> Tuple[float, float, int]:
    tag = argv[0].lower() if argv else PARTICLE_TAG.lower()
    if tag in LEPTON_MASS:
    mass = LEPTON_MASS[tag]
    elif NUMERIC_RE.match(tag):
    mass = mp.mpf(tag)
    else:
    raise SystemExit("First arg must be e, mu, tau, or numeric mass in GeV.")
    s2w = float(argv[1]) if len(argv) > 1 else DEFAULT_SIN2W
    prec = int(argv[2]) if len(argv) > 2 else DEFAULT_PREC
    return mass, s2w, prec

    # ------------------------------------------------------------------
    # Pretty printer ---------------------------------------------------
    # ------------------------------------------------------------------

    def _n(x: float, d: int = 25) -> str:
    return mp.nstr(x, d)

    def _report(m: float, s2w: float, prec: int):
    res = ew_gminus2_TAR(m, precision=prec, sin2w=s2w)
    print(f"Lepton mass [GeV] : {_n(m,10)}")
    print(f"sin²θ_W : {s2w}")
    print(f"mpmath precision (dps) : {prec}")
    print("---- contributions (dimensionless) ----")
    for key in ("one_loop","two_loop","boson","tower_3loop","triple_mix"):
    print(f"{key:24s}: {_n(res[key])}")
    print("--------------------------------------------")
    print(f"Total a_ℓ^EW (TAR) : {_n(res['total'])}")

    # ------------------------------------------------------------------
    # CLI entry ---------------------------------------------------------
    # ------------------------------------------------------------------
    if __name__ == "__main__":
    mass, s2w_cli, prec_cli = _parse(sys.argv[1:])
    _report(mass, s2w_cli, prec_cli)


    Results:

    Lepton mass [GeV] : 0.00051099895
    sin²θ_W : 0.23122
    mpmath precision (dps) : 80
    ---- contributions (dimensionless) ----
    one_loop : 4.545939117182961607685567e-14
    two_loop : -1.051112042675044423183979e-14
    boson : 1.154391308811029530745508e-15
    tower_3loop : 0.0
    triple_mix : 1.19700872426714852052663e-17
    --------------------------------------------
    Total a_ℓ^EW (TAR) : 3.611463214113287286096665e-14


    Lepton mass [GeV] : 0.1056583745
    sin²θ_W : 0.23122
    mpmath precision (dps) : 80
    ---- contributions (dimensionless) ----
    one_loop : 1.943530898651354936273778e-9
    two_loop : -4.493832143861663055754588e-10
    boson : 4.93538325079709915562629e-11
    tower_3loop : 0.0
    triple_mix : 5.117586007201272689147648e-13
    --------------------------------------------
    Total a_ℓ^EW (TAR) : 1.544013275373879749523497e-9


    Lepton mass [GeV] : 1.77686
    sin²θ_W : 0.23122
    mpmath precision (dps) : 80
    ---- contributions (dimensionless) ----
    one_loop : 0.0000005496547951942498038094627
    two_loop : -0.0000001270911817448144445040935
    boson : 1.395787981453977872113369e-8
    tower_3loop : 0.0
    triple_mix : 1.44731719502329051330426e-10
    --------------------------------------------
    Total a_ℓ^EW (TAR) : 0.0000004366662249834774670778333


    English isn’t my first language. I used an AI tool to improve the English, and help comment script.

    I wrote two short Python scripts—one in NumPy, one in mpmath—to numerically reproduce the SU(2) trace ratios that appear in the TAR commutator tower. In the first script I form the operators, project them with a rank-1 probe, and compute the two-, three-, and five-loop coefficients. I also loop over several values of the overall SU(2) scale α to check whether the key two-loop ratio stays fixed. In the second script I feed those same coefficients into the standard electroweak (g-2) formula for an arbitrary lepton mass.

    For any positive α the printed ratios should be exactly Tr(Π T_iT_i)=5/6, Tr(Π [first commutator])=−1/2, and the ratios −3/5, −1/7, +1/120; the two-loop number (−3/5) should remain unchanged when α varies.

    Continue reading...

Compartilhe esta Página