nDot.io physics
08-ilang-propagation / 06-mark-inertia
06mark inertiaverified

Determines the inertia of a moving body with its own mark against its cost in oscillator cells, as a function of the ratio of body speed to field speed, and whether weight over inertia is universal.

Code of version 6 · current

check_mark_inertia.py10 KB · raw
"""Check script of 08-ilang-propagation/06-mark-inertia, derivation v1.

Part A (check required by the question): ring of L = 32 cells. For a square grip
and one other grip of class (G2), two clock levels, both branches and
r = tau/c0 in {0.5, 1, 1.5}: the second-order coefficients (in delta F) of
Cost_{k,sigma} and of E''_{k,sigma}(0) from the formula (6.2), (6.3), (6.5) of the
derivation are compared with an independent computation: exact diagonalisation
of the total contract restricted to states with at most two field quanta, in the
sector of the joint label P (P continued continuously, E'' from the exact second
derivative of the eigenvalue), the second-order coefficient being extracted from
several small values of the scale s of delta F.

Part B: the formula (6.3) on long rings (L = 8 ell): rho = I^mark tau^2 / C^mark
of the one-quantum (F1^2) and two-quantum (F2^2) parts against 2 - r^2, and the
held mark against its leading form in ell, as ell grows.

Units: c0 = sqrt(kappa_h) = 1, F0 = 1, so eps_k = F0 M_k = M_k.
"""
from itertools import combinations_with_replacement
from pathlib import Path

import numpy as np

OUT = Path(__file__).parent / "output"
OUT.mkdir(exist_ok=True)
LOG = []


def log(s=""):
    print(s, flush=True)
    LOG.append(s)


S1 = np.array([[0.0, 1.0], [1.0, 0.0]])
S3 = np.diag([1.0, -1.0])


def modes(L, c0, mh):
    q = 2 * np.pi * np.arange(L) / L
    Om = np.sqrt(mh**2 + 2 * c0**2 * (1 - np.cos(q)))
    return q, Om, 1.0 / (2 * L * Om)          # c_q^2 = 1/(2 L Omega_q)


def omega(p, tau, eps):
    return np.sqrt(eps**2 + (tau * np.sin(p))**2)


def theta(p, tau, eps):
    return np.arctan(tau * np.sin(p) / eps)


# ------------------------------------------------------------------ formula (6.3)
def mark_sums(P, sigma, tau, eps, q, Om, c2, chunk=256):
    """(S1, S2) with E^(2)(P) = -M_k^2 (F1^2 S1 + F2^2 S2)."""
    wP, tP = omega(P, tau, eps), theta(P, tau, eps)

    def S(E, Q, w):
        p = P - Q
        th = 0.5 * (tP + theta(p, tau, eps))
        wp = omega(p, tau, eps)
        return np.sum(w * (np.cos(th)**2 / (E + sigma * (wp - wP))
                           + np.sin(th)**2 / (E - sigma * (wp + wP))))

    s1 = S(Om, q, c2)
    s2 = 0.0
    for i in range(0, len(q), chunk):
        sl = slice(i, i + chunk)
        s2 += S(Om[sl, None] + Om[None, :], q[sl, None] + q[None, :],
                2 * c2[sl, None] * c2[None, :])
    return s1, s2


def curv(f, h=1e-2):
    """Second derivative at 0 of an even function, Richardson in h."""
    f0 = f(0.0)
    c = lambda hh: 2 * (f(hh) - f0) / hh**2
    return (4 * c(h) - c(2 * h)) / 3


def formula_second_order(sigma, tau, eps, Mk, F1, F2, q, Om, c2):
    """Second-order coefficients of Cost and E''(0): mark part (6.3) plus the
    second-order part of the zero-quantum level sigma*omega-bar (6.2)."""
    w0 = np.sum(c2)

    def E2(P):
        a, b = mark_sums(P, sigma, tau, eps, q, Om, c2)
        zq = sigma * (F2 * w0 * Mk)**2 * (tau * np.sin(P))**2 / (2 * omega(P, tau, eps)**3)
        return -Mk**2 * (F1**2 * a + F2**2 * b) + zq

    return E2(0.0), curv(E2)


# ------------------------------------------------------------------ exact diagonalisation
def field_ops(L, q, Om, c2):
    states = [()] + [(i,) for i in range(L)] + list(combinations_with_replacement(range(L), 2))
    idx = {s: i for i, s in enumerate(states)}
    n = len(states)
    A = np.zeros((n, n))                       # sum_q c_q a_q on <= 2 quanta
    cq = np.sqrt(c2)
    for j, s in enumerate(states):
        for m in set(s):
            t = list(s)
            t.remove(m)
            A[idx[tuple(t)], j] += cq[m] * np.sqrt(s.count(m))
    Ef = np.array([Om[list(s)].sum() if s else 0.0 for s in states])
    Qn = np.array([q[list(s)].sum() if s else 0.0 for s in states])
    q0 = A + A.T                                # q at the body's cell (x = 0)
    nq2 = A @ A + A.T @ A.T + 2 * A.T @ A       # :q0^2:, exact on <= 2 quanta
    return Ef, Qn, q0, nq2, np.sum(c2)


def ed_levels(P, tau, eps, Mk, F1, F2, s, ops):
    Ef, Qn, q0, nq2, w0 = ops
    n = len(Ef)
    sn, cs = np.sin(P - Qn), np.cos(P - Qn)
    H = (np.kron(np.diag(Ef), np.eye(2)) + eps * np.kron(np.eye(n), S3)
         - tau * np.kron(np.diag(sn), S1)
         + s * Mk * np.kron(F1 * q0 + F2 * (nq2 + w0 * np.eye(n)), S3))
    H1 = -tau * np.kron(np.diag(cs), S1)        # dH/dP
    H2 = tau * np.kron(np.diag(sn), S1)         # d2H/dP2
    E, V = np.linalg.eigh(H)
    _, u0 = np.linalg.eigh(-tau * np.sin(P) * S1 + eps * S3)
    out = {}
    for sigma, col in ((+1, 1), (-1, 0)):
        ref = np.zeros(2 * n)
        ref[:2] = u0[:, col]                     # field vacuum x band sigma
        j = int(np.argmax(np.abs(V.T @ ref)))
        psi = V[:, j]
        d1 = V.T @ (H1 @ psi)
        m = np.arange(len(E)) != j
        Epp = psi @ H2 @ psi + 2 * np.sum(d1[m]**2 / (E[j] - E[m]))
        out[sigma] = (E[j], Epp)
    return out


def coeffs(svals, fpos, fneg, f0):
    """Fit even part s^2 a2 + s^4 a4 + s^6 a6 and odd part s a1 + s^3 a3 + s^5 a5."""
    s = np.array(svals)
    even = (np.array(fpos) + np.array(fneg)) / 2 - f0
    odd = (np.array(fpos) - np.array(fneg)) / 2
    a2 = np.linalg.solve(np.vstack([s**2, s**4, s**6]).T, even)[0]
    a1 = np.linalg.solve(np.vstack([s, s**3, s**5]).T, odd)[0]
    return a1, a2


def part_a():
    L, c0, mh = 32, 1.0, 0.25
    q, Om, c2 = modes(L, c0, mh)
    w0 = np.sum(c2)
    log(f"PART A: ring L={L}, c0={c0}, m_h={mh} (ell={c0/mh}), F0=1, "
        f"G0={2*np.sum(c2/Om):.6f}, w0={w0:.6f}, Omega_max={Om.max():.4f}")
    log("second-order coefficients: formula (6.2), (6.3), (6.5) vs ED restricted to <= 2 quanta")
    ops = field_ops(L, q, Om, c2)
    grips = {"square (F1=0.3, F2=F1^2/4=0.0225)": (0.3, 0.0225),
             "other  (F1=0.3, F2=-0.15)": (0.3, -0.15)}
    svals = [0.01, 0.02, 0.04]
    maxrel = 0.0
    log(f"{'grip':36s} {'Mk':>3s} {'sig':>3s} {'r':>4s} | {'Cost2 form':>12s} {'Cost2 ED':>12s}"
        f" | {'E2pp form':>12s} {'E2pp ED':>12s} | {'Cost1 ED-form':>13s} {'Epp1 ED-form':>13s}")
    for gname, (F1, F2) in grips.items():
        for Mk in (3.0, 4.0):
            eps = Mk
            for r in (0.5, 1.0, 1.5):
                tau = r * c0
                res = {sv: ed_levels(0.0, tau, eps, Mk, F1, F2, sv, ops)
                       for sv in [0.0] + svals + [-x for x in svals]}
                for sigma in (+1, -1):
                    e0, p0 = res[0.0][sigma]
                    c1, c2c = coeffs(svals, [res[x][sigma][0] for x in svals],
                                     [res[-x][sigma][0] for x in svals], e0)
                    d1, d2 = coeffs(svals, [res[x][sigma][1] for x in svals],
                                    [res[-x][sigma][1] for x in svals], p0)
                    fc, fpp = formula_second_order(sigma, tau, eps, Mk, F1, F2, q, Om, c2)
                    c1f = sigma * Mk * F2 * w0
                    d1f = -sigma * tau**2 * F2 * w0 / Mk
                    rel = max(abs(c2c - fc) / abs(fc), abs(d2 - fpp) / abs(fpp))
                    maxrel = max(maxrel, rel)
                    log(f"{gname:36s} {Mk:3.0f} {sigma:+3d} {r:4.1f} | {fc:12.8f} {c2c:12.8f}"
                        f" | {fpp:12.8f} {d2:12.8f} | {c1-c1f:13.2e} {d1-d1f:13.2e}")
                    # zeroth order: bare level and curvature of (6.7) of 04-ilang-time/06-inertia-internal-energy
                    assert abs(e0 - sigma * eps) < 1e-10
                    assert abs(p0 - sigma * tau**2 / eps) < 1e-8
    log(f"max relative deviation of second-order coefficients (formula vs ED): {maxrel:.2e}")
    log("zeroth order: ED level = sigma*F0*M_k and E''(0) = sigma*tau^2/(F0*M_k) asserted to 1e-10 / 1e-8")
    return maxrel


def part_b():
    c0 = 1.0
    log("")
    log("PART B: formula (6.3) on rings with L = 8 ell, c0 = 1, F0 = 1;")
    log("rho_1, rho_2 = I^mark tau^2/C^mark of the F1^2 and F2^2 parts; prediction (6.9): 2 - r^2")
    log("held mark: g1 = G0*2c0^2/ell, g2 = J2*16c0^3/ell (prediction (6.7): -> 1);"
        " Cratio = C^mark(tau)/C^mark(0) for the F1^2 part")
    log("t_i = rho_i + 2 sigma eps_k R_i: rho with the term (iv) of Step 6 removed,"
        " R_i = <<sin^2 Q/E^2>>/<<1/E>> of the part i")
    log(f"{'ell':>5s} {'g1':>8s} {'g2':>8s} {'Mk':>3s} {'sig':>3s} {'r':>4s} {'2-r^2':>6s}"
        f" {'rho_1':>9s} {'rho_2':>9s} {'t_1':>9s} {'t_2':>9s} {'Cratio':>8s}")
    for ell in (16, 32, 64, 128, 256, 512):
        mh, L = c0 / ell, 8 * ell
        q, Om, c2 = modes(L, c0, mh)
        G0 = 2 * np.sum(c2 / Om)
        J2, N2 = 0.0, 0.0
        for i in range(0, L, 256):
            Es = Om[i:i+256, None] + Om[None, :]
            ww = c2[i:i+256, None] * c2[None, :]
            J2 += np.sum(ww / Es)
            N2 += np.sum(ww * np.sin(q[i:i+256, None] + q[None, :])**2 / Es**2)
        R1 = np.sum(c2 * np.sin(q)**2 / Om**2) / (G0 / 2)
        R2 = N2 / J2
        g1, g2 = G0 * 2 * c0**2 / ell, J2 * 16 * c0**3 / ell
        for Mk in (3.0, 4.0):
            eps = Mk
            for sigma in (+1, -1):
                for r in (0.5, 1.0, 1.5):
                    tau = r * c0
                    cache = {}

                    def ms(P):
                        if P not in cache:
                            cache[P] = mark_sums(P, sigma, tau, eps, q, Om, c2)
                        return cache[P]
                    C1, C2 = -Mk**2 * ms(0.0)[0], -Mk**2 * ms(0.0)[1]
                    E1 = -Mk**2 * curv(lambda P: ms(P)[0])
                    E2 = -Mk**2 * curv(lambda P: ms(P)[1])
                    I1, I2 = -(eps**2 / tau**4) * E1, -(eps**2 / tau**4) * E2
                    rho1, rho2 = I1 * tau**2 / C1, I2 * tau**2 / C2
                    cr = C1 / (-Mk**2 * G0 / 2)
                    t1, t2 = rho1 + 2 * sigma * eps * R1, rho2 + 2 * sigma * eps * R2
                    log(f"{ell:5d} {g1:8.5f} {g2:8.5f} {Mk:3.0f} {sigma:+3d} {r:4.1f} {2-r*r:6.2f}"
                        f" {rho1:9.5f} {rho2:9.5f} {t1:9.5f} {t2:9.5f} {cr:8.5f}")


if __name__ == "__main__":
    part_a()
    part_b()
    (OUT / "check_mark_inertia.txt").write_text("\n".join(LOG) + "\n", encoding="utf-8")
torus_mark_inertia.py31 KB · raw
"""Computation script of 08-ilang-propagation/06-mark-inertia, derivation v4.

Changes in v4 (verification.r2.md):
- S_i''(0) by analytic differentiation of the summands in P (no finite-difference step);
  Part E checks it against exact diagonalisation, Part G against Richardson finite
  differences with steps h0, h0/2, h0/4 at the points of smallest isolation gap (I4).
- Crossings rho_i,- = 1 by Brent root-finding on the lattice sums, with an error estimate
  (root tolerance; for the two-quantum part the binning, from a lattice with dE/2); the
  windows are built from the roots and checked against every computed point (I1).
- y_ab from direct evaluation at the stated levels instead of interpolation (I1).
- Part G also compares L = 64 and L = 128 at ell = 8 at the smallest-gap points (I3).

Cubic torus (D = 3) of side L, body chain along lattice axis 1, Q = q_1; in
Part F also the ring (D = 1).  The lattice sums of (6.3) are evaluated for the
one-quantum (F1^2) and the two-quantum (F2^2) part separately:
    S_i(P) = << cos^2(th)/(E + a) + sin^2(th)/(E + b) >>_i ,
    a = sigma [omega(P-Q) - omega(P)],  b = -sigma [omega(P-Q) + omega(P)],
with <<f>>_1 = sum_q c_q^2 f(Omega_q, q_1) and
     <<f>>_2 = 2 sum_{q,q'} c_q^2 c_q'^2 f(Omega_q + Omega_q', q_1 + q_1'),
so that E^(2) = -M_k^2 (F1^2 S_1 + F2^2 S_2).  Derived quantities:
    rho_i = -(eps^2/tau^2) S_i''(0)/S_i(0)        (6.6), per part
    t     = rho_1 S_1(0)/G0                        (bracket of (6.12)-(6.13))
    xi*   = S_1(0)(1-rho_1)/(S_2(0)(rho_2-1))      (F2^2/(c0 F1^2) at which rho = 1)
Isolation (6.4), L = infinity: (k, sigma) is isolated iff b_k > sigma*eps_k with
b_k = min_q [Omega_q - omega_k(q_1)]; the minimum lies at q_2 = q_3 = 0, so b_k
is the same function on the ring and the torus.  Thresholds: the lower branch is
isolated iff eps_k > eps_-(r), the upper branch iff eps_k < eps_+(r) < m_h/2.
Only isolated states are evaluated, except in Part E (formula check, both
branches; the upper branch there is a formal coefficient).
One-quantum sums are exact mode sums over classes.  Two-quantum sums (v3): for
each q_1 the one-quantum energies are put on a grid of step dE with linear
(cloud-in-cell) weights, which keep the zeroth and first moments; the pair
measure per total q_1 is the convolution (cyclic in q_1, linear in E), done by
FFT, and the excess variance of the binning is removed to second order
(term -V f''/2).  Checked against brute-force pair sums (Part A).
Units: c0 = sqrt(kappa_h) = 1, F0 = 1, so eps_k = M_k.
"""
from itertools import combinations_with_replacement
from pathlib import Path

import numpy as np
from scipy.optimize import brentq

OUT = Path(__file__).parent / "output"
OUT.mkdir(exist_ok=True)
LOG = []


def log(s=""):
    print(s, flush=True)
    LOG.append(s)


def omega(p, tau, eps):
    return np.sqrt(eps**2 + (tau * np.sin(p))**2)


def theta(p, tau, eps):
    return np.arctan(tau * np.sin(p) / eps)


# ------------------------------------------------------------------ isolation (6.4), L = infinity
_QQ = np.linspace(0.0, np.pi, 400001)


def b_min(tau, eps, mh):
    """b_k = min_q [Omega_q - omega_k(q_1)] (c0 = 1), attained at q_2 = q_3 = 0."""
    return np.min(np.sqrt(mh**2 + 2 * (1 - np.cos(_QQ))) - omega(_QQ, tau, eps))


def thresholds(tau, mh):
    """(eps_-, eps_+): lower branch isolated iff eps > eps_-, upper iff eps < eps_+."""
    gm = lambda e: b_min(tau, e, mh) + e          # increasing in eps
    gp = lambda e: b_min(tau, e, mh) - e          # decreasing in eps
    e0 = 1e-10
    if gm(e0) > 0:
        em = 0.0
    else:
        lo, hi = e0, 50.0
        for _ in range(80):
            mid = 0.5 * (lo + hi)
            lo, hi = (lo, mid) if gm(mid) > 0 else (mid, hi)
        em = hi
    if gp(e0) <= 0:
        ep = 0.0
    else:
        lo, hi = e0, mh
        for _ in range(80):
            mid = 0.5 * (lo + hi)
            lo, hi = (mid, hi) if gp(mid) > 0 else (lo, mid)
        ep = lo
    return em, ep


def lower_gap(tau, eps, mh):
    return b_min(tau, eps, mh) + eps


def upper_gap(tau, eps, mh):
    return b_min(tau, eps, mh) - eps


# ------------------------------------------------------------------ lattice sums
def _terms(P, sigma, tau, eps, Q):
    wP, tP = omega(P, tau, eps), theta(P, tau, eps)
    p = P - Q
    th = 0.5 * (tP + theta(p, tau, eps))
    wp = omega(p, tau, eps)
    return np.cos(th)**2, sigma * (wp - wP), np.sin(th)**2, -sigma * (wp + wP)


def _terms_d(P, sigma, tau, eps, Q):
    """As _terms, with first and second P-derivatives: (A, A', A''), (a, a', a''), (b, b', b''), B.
    A = cos^2(thb), B = sin^2(thb) = 1 - A, thb = (theta(P) + theta(P - Q))/2."""
    def wd(p):
        s, c = np.sin(p), np.cos(p)
        w = np.sqrt(eps**2 + (tau * s)**2)
        w1 = tau**2 * s * c / w
        w2 = tau**2 * np.cos(2 * p) / w - (tau**2 * s * c)**2 / w**3
        t1 = eps * tau * c / w**2
        t2 = -eps * tau * s / w**2 - 2 * eps * tau * c * w1 / w**3
        return w, w1, w2, np.arctan(tau * s / eps), t1, t2
    W0, W1, W2, T0, T1, T2 = wd(P)
    w, w1, w2, th, t1, t2 = wd(P - Q)
    tb, tb1, tb2 = 0.5 * (T0 + th), 0.5 * (T1 + t1), 0.5 * (T2 + t2)
    A = (np.cos(tb)**2, -np.sin(2 * tb) * tb1, -2 * np.cos(2 * tb) * tb1**2 - np.sin(2 * tb) * tb2)
    a = (sigma * (w - W0), sigma * (w1 - W1), sigma * (w2 - W2))
    b = (-sigma * (w + W0), -sigma * (w1 + W1), -sigma * (w2 + W2))
    return A, a, b, np.sin(tb)**2


def _frac(c, x, E, n):
    """Value and second P-derivative of c/(E + x)^n, n in {1, 3}; c, x = (f, f', f'')."""
    d = E + x[0]
    if n == 1:
        return c[0] / d, c[2] / d - 2 * c[1] * x[1] / d**2 + 2 * c[0] * x[1]**2 / d**3 - c[0] * x[2] / d**2
    return (c[0] / d**3,
            c[2] / d**3 - 6 * c[1] * x[1] / d**4 + 12 * c[0] * x[1]**2 / d**5 - 3 * c[0] * x[2] / d**4)


def _sum_d(E, w, A, a, b, B0, wV=None):
    """(S, S'') of sum w [A/(E+a) + B/(E+b)] - sum wV [A/(E+a)^3 + B/(E+b)^3] (binning variance term)."""
    B = (B0, -A[1], -A[2])
    fa, fa2 = _frac(A, a, E, 1)
    fb, fb2 = _frac(B, b, E, 1)
    s0, s2 = np.sum(w * (fa + fb)), np.sum(w * (fa2 + fb2))
    if wV is not None:
        ga, ga2 = _frac(A, a, E, 3)
        gb, gb2 = _frac(B, b, E, 3)
        s0 -= np.sum(wV * (ga + gb))
        s2 -= np.sum(wV * (ga2 + gb2))
    return s0, s2


class Torus:
    def __init__(self, L, ell, pairs=True, dE=1e-3):
        self.L, self.ell, self.mh = L, ell, 1.0 / ell
        k = 2 * np.pi * np.arange(L) / L
        s1 = 2 * (1 - np.cos(k))
        u, n = np.unique(np.round((s1[:, None] + s1[None, :]).ravel(), 12), return_counts=True)
        self.k = k
        self.Om = np.sqrt(self.mh**2 + s1[:, None] + u[None, :])      # (L, U) mode classes
        self.w = n[None, :] / (2 * L**3 * self.Om)                      # multiplicity * c_q^2
        self.G0 = 2 * np.sum(self.w / self.Om)
        self.w0 = np.sum(self.w)
        self.Omax = np.sqrt(self.mh**2 + 12)
        self.R1 = np.sum(self.w * (np.sin(k)**2)[:, None] / self.Om**2) / np.sum(self.w / self.Om)
        self.pairs = pairs
        if pairs:
            self._pairs(dE)

    def _pairs(self, dE):
        L = self.L
        x = self.Om / dE
        g = np.floor(x).astype(np.int64)
        t = x - g
        nb = int(g.max()) + 2
        h, hv = np.zeros((L, nb)), np.zeros((L, nb))
        for i in range(L):
            wi, ti, gi = self.w[i], t[i], g[i]
            h[i] = np.bincount(gi, wi * (1 - ti), nb) + np.bincount(gi + 1, wi * ti, nb)
            vi = wi * ti * (1 - ti) * dE**2
            hv[i] = np.bincount(gi, vi * (1 - ti), nb) + np.bincount(gi + 1, vi * ti, nb)
        n2 = 2 * nb
        Hf = np.fft.rfft2(h, s=(L, n2))
        W = 2 * np.fft.irfft2(Hf * Hf, s=(L, n2))
        V = 4 * np.fft.irfft2(Hf * np.fft.rfft2(hv, s=(L, n2)), s=(L, n2))
        omin, omax = self.Om.min(axis=1), self.Om.max(axis=1)
        E = dE * np.arange(n2)
        ii = np.arange(L)
        mask = np.zeros((L, n2), dtype=bool)
        for m in range(L):
            j = (m - ii) % L
            lo, hi = np.min(omin + omin[j]), np.max(omax + omax[j])
            mask[m] = (E >= lo - 3 * dE) & (E <= hi + 3 * dE)
        mi, gi = np.nonzero(mask)
        self.pm, self.pE, self.pW, self.pV = mi, E[gi], W[mi, gi], V[mi, gi]
        self.dE = dE
        sq = np.sin(self.k[self.pm])**2
        self.J2 = 0.5 * np.sum(self.pW / self.pE - self.pV / self.pE**3)
        self.R2 = np.sum(self.pW * sq / self.pE**2 - 3 * self.pV * sq / self.pE**4) / (2 * self.J2)

    def S1(self, P, sigma, tau, eps):
        A, a, B, b = _terms(P, sigma, tau, eps, self.k)
        E = self.Om
        return np.sum(self.w * (A[:, None] / (E + a[:, None]) + B[:, None] / (E + b[:, None])))

    def S2(self, P, sigma, tau, eps):
        A, a, B, b = _terms(P, sigma, tau, eps, self.k)
        m, E = self.pm, self.pE
        x, y = E + a[m], E + b[m]
        f = A[m] / x + B[m] / y
        f2 = 2 * A[m] / x**3 + 2 * B[m] / y**3
        return np.sum(self.pW * f - 0.5 * self.pV * f2)

    def S1d(self, sigma, tau, eps):
        """(S_1(0), S_1''(0)), analytic in P."""
        A, a, b, B0 = _terms_d(0.0, sigma, tau, eps, self.k)
        col = lambda t: tuple(z[:, None] for z in t)
        return _sum_d(self.Om, self.w, col(A), col(a), col(b), B0[:, None])

    def S2d(self, sigma, tau, eps):
        """(S_2(0), S_2''(0)), analytic in P, on the binned pair measure."""
        A, a, b, B0 = _terms_d(0.0, sigma, tau, eps, self.k)
        m = self.pm
        sel = lambda t: tuple(z[m] for z in t)
        return _sum_d(self.pE, self.pW, sel(A), sel(a), sel(b), B0[m], self.pV)


class Ring:
    def __init__(self, L, ell):
        self.L, self.ell, self.mh = L, ell, 1.0 / ell
        self.k = 2 * np.pi * np.arange(L) / L
        self.Om = np.sqrt(self.mh**2 + 2 * (1 - np.cos(self.k)))
        self.c2 = 1 / (2 * L * self.Om)
        self.G0 = 2 * np.sum(self.c2 / self.Om)

    @staticmethod
    def _S(P, sigma, tau, eps, E, Q, w):
        A, a, B, b = _terms(P, sigma, tau, eps, Q)
        return np.sum(w * (A / (E + a) + B / (E + b)))

    def S1(self, P, sigma, tau, eps):
        return self._S(P, sigma, tau, eps, self.Om, self.k, self.c2)

    def S2(self, P, sigma, tau, eps, chunk=256):
        s, Om, k, c2 = 0.0, self.Om, self.k, self.c2
        for i in range(0, self.L, chunk):
            sl = slice(i, i + chunk)
            s += self._S(P, sigma, tau, eps, Om[sl, None] + Om[None, :], k[sl, None] + k[None, :],
                         2 * c2[sl, None] * c2[None, :])
        return s

    def S1d(self, sigma, tau, eps):
        A, a, b, B0 = _terms_d(0.0, sigma, tau, eps, self.k)
        return _sum_d(self.Om, self.c2, A, a, b, B0)

    def S2d(self, sigma, tau, eps, chunk=256):
        s0 = s2 = 0.0
        Om, k, c2 = self.Om, self.k, self.c2
        for i in range(0, self.L, chunk):
            sl = slice(i, i + chunk)
            A, a, b, B0 = _terms_d(0.0, sigma, tau, eps, k[sl, None] + k[None, :])
            x0, x2 = _sum_d(Om[sl, None] + Om[None, :], 2 * c2[sl, None] * c2[None, :], A, a, b, B0)
            s0, s2 = s0 + x0, s2 + x2
        return s0, s2


def curv(f, h, f0=None):
    """Richardson-extrapolated second derivative at 0 of an even function (used only as a check)."""
    f0 = f(0.0) if f0 is None else f0
    c = lambda hh: 2 * (f(hh) - f0) / hh**2
    return f0, (4 * c(h) - c(2 * h)) / 3


def analyse(T, sigma, tau, eps, parts=(1, 2)):
    """{i: (S_i(0), rho_i)}; S_i''(0) by analytic differentiation of the summands (v4)."""
    out = {}
    for i in parts:
        s0, spp = T.S1d(sigma, tau, eps) if i == 1 else T.S2d(sigma, tau, eps)
        out[i] = (s0, -(eps**2 / tau**2) * spp / s0)
    return out


def roots(T, r, part, e, y, Th=None):
    """Roots of rho_{part,-}(eps) = 1 by Brent's method in each grid interval where y = rho - 1
    changes sign.  Returns (root, error estimate): residual-based for part 1 (exact mode sum);
    for part 2 the binning error, |rho_2 - 1| at the root on the lattice Th with dE/2, over the slope."""
    out = []
    g = lambda x, TT=T: analyse(TT, -1, r, x, (part,))[part][1] - 1
    for i in np.nonzero(np.sign(y[:-1]) * np.sign(y[1:]) < 0)[0]:
        x = brentq(g, e[i], e[i + 1], xtol=1e-10, rtol=1e-12)
        d = 1e-4 * x
        slope = (g(x + d) - g(x - d)) / (2 * d)
        res = abs(g(x))
        if part == 2 and Th is not None:
            res = max(res, abs(g(x, Th)))
        out.append((x, res / abs(slope) + 1e-10))
    return out


MARGIN = 0.2      # lower branch evaluated where b_k + eps_k > MARGIN * m_h


# ------------------------------------------------------------------ part A: pair-sum check
def part_a():
    L, ell = 12, 3.0
    log(f"PART A: lattice sums by mode classes and FFT pair convolution vs brute-force mode and ordered-pair"
        f" sums, torus L={L}, ell={ell}")
    g = np.array(np.meshgrid(np.arange(L), np.arange(L), np.arange(L), indexing="ij")).reshape(3, -1)
    q = 2 * np.pi * g / L
    Om = np.sqrt(1 / ell**2 + 2 * np.sum(1 - np.cos(q), axis=0))
    c2 = 1 / (2 * L**3 * Om)
    E = Om[:, None] + Om[None, :]
    Q = q[0][:, None] + q[0][None, :]
    ww = 2 * c2[:, None] * c2[None, :]
    cases = ((-1, 1.0, 1.0), (-1, 1.5, 3.0), (-1, 0.5, 0.2), (+1, 0.5, 0.05))
    for dE in (1e-2, 1e-3):
        T = Torus(L, ell, dE=dE)
        w1 = w2 = 0.0
        for sigma, tau, eps in cases:
            for P in (0.0, 0.02):
                A, a, B, b = _terms(P, sigma, tau, eps, Q)
                b2 = np.sum(ww * (A / (E + a) + B / (E + b)))
                A1, a1, B1, b1_ = _terms(P, sigma, tau, eps, q[0])
                b1 = np.sum(c2 * (A1 / (Om + a1) + B1 / (Om + b1_)))
                w1 = max(w1, abs(T.S1(P, sigma, tau, eps) / b1 - 1))
                w2 = max(w2, abs(T.S2(P, sigma, tau, eps) / b2 - 1))
        log(f"  dE={dE}: max relative deviation S_1 {w1:.2e}, S_2 {w2:.2e}"
            f" (cases (sigma,r,eps) = {cases}, P = 0, 0.02)")
    bR1 = np.sum(c2 * np.sin(q[0])**2 / Om**2) / np.sum(c2 / Om)
    log(f"  R_1: classes {T.R1:.12f}, brute force {bR1:.12f};  J2: FFT {T.J2:.12f},"
        f" brute force {np.sum(c2[:, None]*c2[None, :]/E):.12f}")


# ------------------------------------------------------------------ part B: convergence in L and ell
def part_b(T8):
    log("")
    log("PART B: convergence in ell and L (c0 = 1); rho_1, rho_2 of the F1^2 and F2^2 parts, lower branch")
    lattices = [(32, 4.0), (48, 6.0), (64, 8.0), (128, 16.0), (256, 32.0)]
    cases = [(1.0, 1.0), (1.0, 4.0), (0.5, 2.0), (2.0, 2.0), (3.0, 4.0)]
    log(f"{'L':>4s} {'ell':>5s} {'G0':>9s} {'w0':>8s} {'J2':>9s} {'R1':>8s} {'R2':>8s} |"
        + "".join(f"  r={r} e={e}: rho_1, rho_2 " for r, e in cases))
    Ts = {}
    for L, ell in lattices:
        T = T8 if (L, ell) == (64, 8.0) else Torus(L, ell)
        Ts[(L, ell)] = T
        row = f"{L:4d} {ell:5.1f} {T.G0:9.6f} {T.w0:8.5f} {T.J2:9.6f} {T.R1:8.5f} {T.R2:8.5f} |"
        for r, eps in cases:
            res = analyse(T, -1, r, eps)
            row += f"  {res[1][1]:9.5f} {res[2][1]:9.5f}     "
        log(row)
    return Ts


# ------------------------------------------------------------------ part C: main table
def part_c(T):
    log("")
    log(f"PART C: main table, lower branch (isolated), torus L={T.L}, ell={T.ell} (m_h={T.mh}), c0=1, F0=1,"
        f" eps_k=M_k")
    log(f"  G0={T.G0:.6f}, w0={T.w0:.6f}, J2={T.J2:.6f}, R1={T.R1:.6f}, R2={T.R2:.6f}, "
        f"Omega_max={T.Omax:.4f}")
    log("  C_i = S_i(0)/S_i(0)|_{tau=0} (moving mark over held mark), rho_i of the parts, "
        "t = T/G0, xi* = F2^2/(c0 F1^2) at which rho = 1 (- if none finite >= 0)")
    log(f"{'r':>5s} {'eps':>5s} {'gap':>7s} | {'C_1':>8s} {'C_2':>8s} | "
        f"{'rho_1':>9s} {'rho_2':>9s} | {'t':>9s} {'xi*':>9s}")
    grid = []
    for r in (0.25, 0.5, 1.0, 1.5, 2.0):
        for eps in (0.5, 1.0, 2.0, 3.0, 4.0, 6.0, 8.0, 16.0, 32.0):
            gap = lower_gap(r, eps, T.mh)
            if gap <= MARGIN * T.mh:
                continue
            grid.append((r, eps))
            res = analyse(T, -1, r, eps)
            (s1, rho1), (s2, rho2) = res[1], res[2]
            xi = s1 * (1 - rho1) / (s2 * (rho2 - 1))
            xs = f"{xi:9.4f}" if xi >= 0 else f"{'-':>9s}"
            log(f"{r:5.2f} {eps:5.1f} {gap:7.4f} | {s1/(T.G0/2):8.5f} {s2/(2*T.J2):8.5f} | "
                f"{rho1:9.4f} {rho2:9.4f} | {rho1*s1/T.G0:9.4f} {xs}")
    return grid


# ------------------------------------------------------------------ part B2: convergence over the table
def part_b2(Ts, grid):
    log("")
    log("PART B2: convergence over the configurations of Part C: change of rho_1, rho_2 and t from"
        " (L,ell)=(64,8) to (128,16) and to (256,32); absolute for eps <= 4, relative for eps > 4")
    T8 = Ts[(64, 8.0)]
    for key in ((128, 16.0), (256, 32.0)):
        To = Ts[key]
        ab = {"rho_1": 0.0, "rho_2": 0.0, "t": 0.0}
        rl = {"rho_1": 0.0, "rho_2": 0.0, "t": 0.0}
        for r, eps in grid:
            a8, ao = analyse(T8, -1, r, eps), analyse(To, -1, r, eps)
            vals = {"rho_1": (a8[1][1], ao[1][1]), "rho_2": (a8[2][1], ao[2][1]),
                    "t": (a8[1][1] * a8[1][0] / T8.G0, ao[1][1] * ao[1][0] / To.G0)}
            for k_, (x8, xo) in vals.items():
                if eps <= 4.0:
                    ab[k_] = max(ab[k_], abs(x8 - xo))
                else:
                    rl[k_] = max(rl[k_], abs(x8 - xo) / abs(x8))
        log(f"  to {key}: eps <= 4 max |change|: " + ", ".join(f"{k_} {v:.4f}" for k_, v in ab.items())
            + ";  eps > 4 max relative change: " + ", ".join(f"{k_} {v:.4f}" for k_, v in rl.items()))


# ------------------------------------------------------------------ part D: fine grid, items 2 and 3
def grid_tests(T, rs, eg, tag, Th, members=True):
    log(f"  thresholds (L = infinity): eps_-(r) [lower isolated above], eps_+(r) [upper isolated below],"
        f" m_h/2 = {T.mh/2:.4f}")
    tabs, smin = [], np.inf
    for r in rs:
        em, ep = thresholds(r, T.mh)
        lo = {e: analyse(T, -1, r, e) for e in eg if lower_gap(r, e, T.mh) > MARGIN * T.mh}
        e = np.array(sorted(lo))
        s1 = np.array([lo[x][1][0] for x in e]); r1 = np.array([lo[x][1][1] for x in e])
        s2 = np.array([lo[x][2][0] for x in e]); r2 = np.array([lo[x][2][1] for x in e])
        smin = min(smin, np.min(s1 / (T.G0 / 2)), np.min(s2 / (2 * T.J2)))
        t = r1 * s1 / T.G0
        phi = e * t
        d2 = 2 * np.diff(np.diff(phi) / np.diff(e)) / (e[2:] - e[:-2])
        R1, R2 = roots(T, r, 1, e, r1 - 1), roots(T, r, 2, e, r2 - 1, Th)
        log(f"r={r:4.2f}: eps_-={em:.4f}, eps_+={ep:.4f}; lower computed on eps in [{e.min():.3f},{e.max():.1f}]"
            f" ({len(e)} pts); rho_1,- {r1[0]:.4f}..{r1[-1]:.3f} incr {bool(np.all(np.diff(r1) > 0))};"
            f" rho_2,- {r2[0]:.4f}..{r2[-1]:.3f} incr {bool(np.all(np.diff(r2) > 0))}")
        log("   roots (Brent, +- error estimate): rho_1,- = 1 at eps "
            + (", ".join(f"{x:.4f} (+-{dx:.0e})" for x, dx in R1) or "none")
            + ";  rho_2,- = 1 at eps " + (", ".join(f"{x:.4f} (+-{dx:.0e})" for x, dx in R2) or "none"))
        win = (r1 - 1) * (r2 - 1) < 0
        pts = [(x, bool(w_)) for x, w_ in zip(e, win)]
        if np.any(win):
            ia, ib = np.nonzero(win)[0][[0, -1]]
            fine = np.linspace(e[max(ia - 1, 0)], e[min(ib + 1, len(e) - 1)], 81)
            fx = []
            for x in fine:
                if lower_gap(r, x, T.mh) <= MARGIN * T.mh:
                    continue
                a_ = analyse(T, -1, r, x)
                pts.append((x, bool((a_[1][1] - 1) * (a_[2][1] - 1) < 0)))
                if (a_[1][1] - 1) * (a_[2][1] - 1) < 0:
                    fx.append((x, a_[1][0] * (1 - a_[1][1]) / (a_[2][0] * (a_[2][1] - 1))))
            fe, fv = np.array([u for u, _ in fx]), np.array([v for _, v in fx])
            log(f"   finite xi* >= 0 [(rho_1-1)(rho_2-1) < 0] on eps in [{fe.min():.3f},{fe.max():.3f}]"
                f" (81-point refinement, {len(fe)} pts): xi* {fv[0]:.4f} at {fe[0]:.3f} .. {fv[-1]:.2f} at"
                f" {fe[-1]:.3f}; increasing {bool(np.all(np.diff(fv) > 0))},"
                f" decreasing {bool(np.all(np.diff(fv) < 0))}")
        else:
            log("   (rho_1-1)(rho_2-1) >= 0 at every computed point")
        bnd = ([(e[0] - 1e-12, "edge of computed range")]
               + sorted([(x, "rho_1=1") for x, _ in R1] + [(x, "rho_2=1") for x, _ in R2])
               + [(e[-1] + 1e-12, "edge of computed range")])
        wins, ok = [], True
        for (a0, na), (b0, nb_) in zip(bnd[:-1], bnd[1:]):
            ins = [w_ for x, w_ in pts if a0 < x < b0]
            ok = ok and (all(ins) or not any(ins))
            if ins and all(ins):
                wins.append(f"[{a0:.4f} ({na}), {b0:.4f} ({nb_})]")
        log("   windows of finite xi* >= 0 between consecutive roots: " + ("; ".join(wins) or "none")
            + f"; all {len(pts)} computed points (grid and refinement) consistent with them: {ok}")
        neg = e[1:-1][d2 <= 0]
        log(f"   phi increasing {bool(np.all(np.diff(phi) > 0))}; phi'' min {d2.min():.3f} max {d2.max():.3f}"
            + ("" if neg.size == 0 else f"; phi'' <= 0 at eps in [{neg.min():.3f},{neg.max():.3f}]")
            + f"; t_- {t[0]:.4f}..{t[-1]:.3f}; at eps={e[-1]:.1f}: rho_1,- - 2 eps R1 = {r1[-1]-2*e[-1]*T.R1:.4f},"
            f" rho_1,-/(2 eps R1) = {r1[-1]/(2*e[-1]*T.R1):.4f}")
        tabs.append((r, e, t, lo))
    log(f"  min over all computed points of S_i(0)/S_i(0)|_(tau=0): {smin:.4f}")
    log("  grip y = F0 F2/F1^2 that equalises the bracket of (6.12) for two lower levels (eps_a, eps_b),"
        " direct evaluation at the stated levels:")
    tval = lambda r, x: (lambda a_: a_[1][1] * a_[1][0] / T.G0)(analyse(T, -1, r, x, (1,)))
    for r, e, t, _ in tabs:
        out = f"   r={r:4.2f}:"
        for ea, eb in ((0.25, 0.5), (0.5, 1.0), (1.0, 2.0), (2.0, 4.0), (4.0, 8.0), (1.0, 8.0)):
            if min(lower_gap(r, ea, T.mh), lower_gap(r, eb, T.mh)) > MARGIN * T.mh:
                ta, tb = tval(r, ea), tval(r, eb)
                out += f" ({ea:g},{eb:g}) {(ea*ta - eb*tb)/(2*(ea - eb)):.4f}"
        log(out)
    if members:
        log(f"  members with stated margins (exact evaluation at the stated eps, r = 1), {tag}:")
        a4 = analyse(T, -1, 1.0, 4.0)
        log(f"   item 2: level eps=4: rho_1,- = {a4[1][1]:.4f}, rho_2,- = {a4[2][1]:.4f}"
            f" -> rho_- >= {min(a4[1][1], a4[2][1]):.4f} > 1 for every grip")
        xs = []
        for x in (1.2, 2.0):
            a_ = analyse(T, -1, 1.0, x)
            xs.append(a_[1][0] * (1 - a_[1][1]) / (a_[2][0] * (a_[2][1] - 1)))
        log(f"   item 2: levels eps=1.2, 2.0: xi* = {xs[0]:.4f}, {xs[1]:.4f}")
        tt = {}
        for x in (1.0, 2.0, 3.0):
            a_ = analyse(T, -1, 1.0, x, (1,))
            tt[x] = a_[1][1] * a_[1][0] / T.G0
        y12 = (2 * tt[2.0] - 1 * tt[1.0]) / 2
        y23 = (3 * tt[3.0] - 2 * tt[2.0]) / 2
        log(f"   item 3: levels eps=1,2,3: t_- = {tt[1.0]:.4f}, {tt[2.0]:.4f}, {tt[3.0]:.4f};"
            f" y_12 = {y12:.4f}, y_23 = {y23:.4f}")


def part_d(T):
    log("")
    log(f"PART D: fine grid, 71 values of eps in [0.1, 64] (geometric), torus L={T.L}, ell={T.ell};"
        f" lower branch where b_k + eps_k > {MARGIN} m_h")
    log("  item 2: rho_{i,-} increasing on the grid?  crossings of rho_i,- = 1; points with finite xi* >= 0;"
        "  item 3: phi = eps*t_- increasing and convex at the grid points?")
    grid_tests(T, (0.1, 0.25, 0.5, 0.75, 1.0, 1.25, 1.5, 2.0, 3.0), np.geomspace(0.1, 64.0, 71),
               f"L={T.L}, ell={T.ell}", Torus(T.L, T.ell, dE=T.dE / 2))


def part_d2(T):
    log("")
    log(f"PART D2: as Part D, both parts, torus L={T.L}, ell={T.ell}; 36 values of eps in [0.1, 64]")
    grid_tests(T, (0.1, 0.5, 1.0, 1.5, 2.0, 3.0), np.geomspace(0.1, 64.0, 36), f"L={T.L}, ell={T.ell}",
               Torus(T.L, T.ell, dE=T.dE / 2))


# ------------------------------------------------------------------ part E: ED on torus L = 4
def part_e():
    log("")
    L, ell = 4, 2.0
    mh = 1 / ell
    g = np.array(np.meshgrid(np.arange(L), np.arange(L), np.arange(L), indexing="ij")).reshape(3, -1)
    q = 2 * np.pi * g / L
    Om = np.sqrt(mh**2 + 2 * np.sum(1 - np.cos(q), axis=0))
    c2 = 1 / (2 * L**3 * Om)
    n = len(Om)
    states = [()] + [(i,) for i in range(n)] + list(combinations_with_replacement(range(n), 2))
    idx = {s: i for i, s in enumerate(states)}
    ns = len(states)
    A = np.zeros((ns, ns))
    cq = np.sqrt(c2)
    for j, s in enumerate(states):
        for m in set(s):
            t = list(s)
            t.remove(m)
            A[idx[tuple(t)], j] += cq[m] * np.sqrt(s.count(m))
    Ef = np.array([Om[list(s)].sum() if s else 0.0 for s in states])
    Qn = np.array([q[0][list(s)].sum() if s else 0.0 for s in states])
    q0 = A + A.T
    nq2 = A @ A + A.T @ A.T + 2 * A.T @ A
    w0 = np.sum(c2)
    S1m, S3m = np.array([[0.0, 1.0], [1.0, 0.0]]), np.diag([1.0, -1.0])
    Mk, F1, F2, tau = 5.0, 0.3, 0.1, 1.0
    eps = Mk
    log(f"PART E: ED of the contract restricted to <= 2 field quanta, cubic torus L={L}, ell={ell}, "
        f"dimension {2*ns}; M_k={Mk}, F1={F1}, F2={F2}, r={tau}, Omega_max={Om.max():.4f}"
        f" (sigma=+1: formal coefficients, the upper branch is not isolated here)")
    base = (np.kron(np.diag(Ef), np.eye(2)) + eps * np.kron(np.eye(ns), S3m)
            - tau * np.kron(np.diag(np.sin(-Qn)), S1m))
    V = Mk * np.kron(F1 * q0 + F2 * (nq2 + w0 * np.eye(ns)), S3m)
    H1 = -tau * np.kron(np.diag(np.cos(-Qn)), S1m)
    H2 = tau * np.kron(np.diag(np.sin(-Qn)), S1m)
    svals = [0.01, 0.02, 0.04]
    res = {}
    for s in [0.0] + svals + [-x for x in svals]:
        E, Vv = np.linalg.eigh(base + s * V)
        out = {}
        for sigma in (+1, -1):
            ref = np.zeros(2 * ns)
            ref[0 if sigma == +1 else 1] = 1.0
            j = int(np.argmax(np.abs(Vv.T @ ref)))
            psi = Vv[:, j]
            d1 = Vv.T @ (H1 @ psi)
            msk = np.arange(len(E)) != j
            out[sigma] = (E[j], psi @ H2 @ psi + 2 * np.sum(d1[msk]**2 / (E[j] - E[msk])))
        res[s] = out
    sarr = np.array(svals)
    T = Torus(L, ell)
    worst = 0.0
    for sigma in (+1, -1):
        for comp in (0, 1):
            f0 = res[0.0][sigma][comp]
            even = np.array([(res[x][sigma][comp] + res[-x][sigma][comp]) / 2 - f0 for x in svals])
            a2 = np.linalg.solve(np.vstack([sarr**2, sarr**4, sarr**6]).T, even)[0]
            if comp == 0:
                form = -Mk**2 * (F1**2 * T.S1(0.0, sigma, tau, eps) + F2**2 * T.S2(0.0, sigma, tau, eps))
            else:
                _, p1 = T.S1d(sigma, tau, eps)
                _, p2 = T.S2d(sigma, tau, eps)
                form = -Mk**2 * (F1**2 * p1 + F2**2 * p2) + sigma * (F2 * w0 * Mk)**2 * tau**2 / eps**3
            worst = max(worst, abs(a2 / form - 1))
            label = "Cost" if comp == 0 else "E''(0)"
            log(f"  sigma={sigma:+d} {label:6s} second order: ED {a2:.10f}  formula {form:.10f}")
    log(f"  max relative deviation: {worst:.2e}")


# ------------------------------------------------------------------ part F: light levels
def part_f():
    log("")
    ell = 8.0
    mh = 1 / ell
    log(f"PART F: light levels eps_k < eps_+(r) (upper branch isolated), ell={ell} (m_h={mh}),"
        f" eps = f*eps_+, both branches, both parts; ring and cubic torus")
    lat = [("ring", Ring(2048, ell)), ("ring", Ring(4096, ell)), ("torus", Torus(128, ell)),
           ("torus", Torus(256, ell))]
    log(f"{'graph':>6s} {'L':>5s} {'r':>5s} {'eps_+':>8s} {'f':>4s} {'eps':>8s} | {'rho_1,+':>9s} {'rho_2,+':>9s}"
        f" {'rho_1,-':>9s} {'rho_2,-':>9s}")
    ext = {}
    for r in (0.25, 0.5, 0.75, 1.0):
        em, ep = thresholds(r, mh)
        for f in (0.3, 0.5, 0.7, 0.9):
            eps = f * ep
            for name, T in lat:
                if name == "ring" and T.L == 4096:
                    parts = (1,)
                else:
                    parts = (1, 2)
                up, dn = analyse(T, +1, r, eps, parts), analyse(T, -1, r, eps, parts)
                v = [up[1][1], up[2][1] if 2 in parts else np.nan, dn[1][1], dn[2][1] if 2 in parts else np.nan]
                log(f"{name:>6s} {T.L:5d} {r:5.2f} {ep:8.5f} {f:4.1f} {eps:8.5f} | "
                    + " ".join(f"{x:9.4f}" for x in v))
                key = (name, T.L)
                lo_, hi_ = ext.get(key, (np.inf, -np.inf))
                vv = [x for x in v if np.isfinite(x)]
                ext[key] = (min(lo_, min(vv)), max(hi_, max(vv)))
    log("  range of all rho_{i,sigma} above, per lattice: "
        + "; ".join(f"{k[0]} L={k[1]}: [{a:.4f}, {b:.4f}]" for k, (a, b) in ext.items()))
    return lat


# ------------------------------------------------------------------ part G: curvature and finite-size checks
def part_g(T8, T32, lat):
    log("")
    log("PART G: accuracy of S_i''(0) (I4) and finite size (I3) at the points of smallest isolation gap."
        " Analytic rho_i against Richardson finite differences with h0 = min(1e-2, 0.05 eps/tau) (step of v3),"
        " h0/2, h0/4: max |rho_i(h) - rho_i(analytic)| over the cases")
    ring, torus = lat[0][1], lat[2][1]
    cases = []
    for r in (0.25, 0.5, 0.75, 1.0):
        ep = thresholds(r, 1 / 8.0)[1]
        for name, T in (("ring", ring), ("torus", torus)):
            for sg in (+1, -1):
                cases.append((f"light {name} L={T.L}", T, sg, r, 0.9 * ep))
    eg8, eg32 = np.geomspace(0.1, 64.0, 71), np.geomspace(0.1, 64.0, 36)
    edge = {}
    for T, eg, rs in ((T8, eg8, (1.25, 1.5, 2.0, 3.0)), (T32, eg32, (1.5, 2.0, 3.0))):
        for r in rs:
            x = min(z for z in eg if lower_gap(r, z, T.mh) > MARGIN * T.mh)
            edge[(T.L, r)] = x
            cases.append((f"lower edge torus L={T.L} ell={T.ell}", T, -1, r, x))
    dev = {}
    for name, T, sg, r, eps in cases:
        an = analyse(T, sg, r, eps)
        gap = (upper_gap(r, eps, T.mh) if sg == 1 else lower_gap(r, eps, T.mh)) / T.mh
        h0 = min(1e-2, 0.05 * eps / r)
        for i in (1, 2):
            f = (lambda P: T.S1(P, sg, r, eps)) if i == 1 else (lambda P: T.S2(P, sg, r, eps))
            f0 = an[i][0]
            for j, h in enumerate((h0, h0 / 2, h0 / 4)):
                _, spp = curv(f, h, f0)
                d = abs(-(eps**2 / r**2) * spp / f0 - an[i][1])
                key = (name, i, j)
                dev[key] = max(dev.get(key, 0.0), d)
        log(f"  {name:28s} sigma={sg:+d} r={r:4.2f} eps={eps:.5f} gap/m_h={gap:.3f}:"
            f" rho_1={an[1][1]:.6f} rho_2={an[2][1]:.6f}")
    for name in dict.fromkeys(c[0] for c in cases):
        log(f"  {name:28s}: " + "; ".join(
            f"rho_{i}: " + ", ".join(f"{dev[(name, i, j)]:.1e}" for j in range(3)) for i in (1, 2))
            + "  (h0, h0/2, h0/4)")
    T128 = torus if torus.L == 128 else Torus(128, 8.0)
    dmax = 0.0
    for r in (1.25, 1.5, 2.0, 3.0):
        x = edge[(64, r)]
        a64, a128 = analyse(T8, -1, r, x), analyse(T128, -1, r, x)
        dmax = max(dmax, abs(a64[1][1] - a128[1][1]), abs(a64[2][1] - a128[2][1]))
        log(f"  finite size, lower edge r={r:4.2f} eps={x:.4f}: rho_1 {a64[1][1]:.6f} (L=64) {a128[1][1]:.6f}"
            f" (L=128); rho_2 {a64[2][1]:.6f} (L=64) {a128[2][1]:.6f} (L=128)")
    log(f"  max |rho_i(L=64) - rho_i(L=128)| at these points: {dmax:.2e}")


if __name__ == "__main__":
    part_a()
    T8 = Torus(64, 8.0)
    Ts = part_b(T8)
    grid = part_c(T8)
    part_b2(Ts, grid)
    part_d(T8)
    part_d2(Ts[(256, 32.0)])
    part_e()
    lat = part_f()
    part_g(T8, Ts[(256, 32.0)], lat)
    (OUT / "torus_mark_inertia.txt").write_text("\n".join(LOG) + "\n", encoding="utf-8")
output/check_mark_inertia.txt11 KB · raw
PART A: ring L=32, c0=1.0, m_h=0.25 (ell=4.0), F0=1, G0=1.985916, w0=0.550116, Omega_max=2.0156
second-order coefficients: formula (6.2), (6.3), (6.5) vs ED restricted to <= 2 quanta
grip                                  Mk sig    r |   Cost2 form     Cost2 ED |    E2pp form      E2pp ED | Cost1 ED-form  Epp1 ED-form
square (F1=0.3, F2=F1^2/4=0.0225)      3  +1  0.5 |  -0.79709146  -0.79709146 |   0.00272483   0.00272483 |     -5.88e-11     -7.56e-13
square (F1=0.3, F2=F1^2/4=0.0225)      3  -1  0.5 |  -0.81355379  -0.81355379 |   0.06469109   0.06469109 |      6.38e-11     -1.30e-11
square (F1=0.3, F2=F1^2/4=0.0225)      3  +1  1.0 |  -0.77188596  -0.77188596 |  -0.01790101  -0.01790101 |     -5.00e-11     -1.63e-11
square (F1=0.3, F2=F1^2/4=0.0225)      3  -1  1.0 |  -0.83695453  -0.83695453 |   0.24473099   0.24473099 |      6.85e-11     -5.10e-11
square (F1=0.3, F2=F1^2/4=0.0225)      3  +1  1.5 |  -0.73621933  -0.73621933 |  -0.12253651  -0.12253651 |     -3.93e-11     -5.93e-11
square (F1=0.3, F2=F1^2/4=0.0225)      3  -1  1.5 |  -0.88257932  -0.88257932 |   0.47513821   0.47513820 |      7.74e-11     -1.10e-10
square (F1=0.3, F2=F1^2/4=0.0225)      4  +1  0.5 |  -1.42156754  -1.42156754 |  -0.00839540  -0.00839540 |     -4.41e-10     -1.88e-11
square (F1=0.3, F2=F1^2/4=0.0225)      4  -1  0.5 |  -1.44333641  -1.44333642 |   0.07578325   0.07578325 |      4.69e-10     -6.91e-11
square (F1=0.3, F2=F1^2/4=0.0225)      4  +1  1.0 |  -1.38830326  -1.38830326 |  -0.06039710  -0.06039710 |     -3.94e-10     -1.21e-10
square (F1=0.3, F2=F1^2/4=0.0225)      4  -1  1.0 |  -1.47480499  -1.47480499 |   0.28739467   0.28739468 |      4.99e-10     -2.70e-10
square (F1=0.3, F2=F1^2/4=0.0225)      4  +1  1.5 |  -1.33921483  -1.33921484 |  -0.21748355  -0.21748356 |     -3.33e-10     -3.65e-10
square (F1=0.3, F2=F1^2/4=0.0225)      4  -1  1.5 |  -1.53381757  -1.53381758 |   0.57028552   0.57028551 |      5.55e-10     -5.68e-10
other  (F1=0.3, F2=-0.15)              3  +1  0.5 |  -0.88255089  -0.88255088 |   0.00244496   0.00244496 |      1.97e-09      1.22e-10
other  (F1=0.3, F2=-0.15)              3  -1  0.5 |  -0.90108819  -0.90108819 |   0.07033359   0.07033359 |     -2.17e-09      6.41e-10
other  (F1=0.3, F2=-0.15)              3  +1  1.0 |  -0.85386846  -0.85386846 |  -0.01963079  -0.01963079 |      1.67e-09      8.37e-10
other  (F1=0.3, F2=-0.15)              3  -1  1.0 |  -0.92705583  -0.92705583 |   0.26807672   0.26807672 |     -2.47e-09      2.53e-09
other  (F1=0.3, F2=-0.15)              3  +1  1.5 |  -0.81331009  -0.81331009 |  -0.12802719  -0.12802719 |      1.32e-09      2.48e-09
other  (F1=0.3, F2=-0.15)              3  -1  1.5 |  -0.97758359  -0.97758359 |   0.53083127   0.53083125 |     -3.16e-09      4.96e-09
other  (F1=0.3, F2=-0.15)              4  +1  0.5 |  -1.57419026  -1.57419024 |  -0.01025575  -0.01025575 |      1.49e-08      1.09e-09
other  (F1=0.3, F2=-0.15)              4  -1  0.5 |  -1.59864379  -1.59864377 |   0.08292655   0.08292654 |     -1.60e-08      3.27e-09
other  (F1=0.3, F2=-0.15)              4  +1  1.0 |  -1.53652382  -1.53652380 |  -0.06819105  -0.06819104 |      1.32e-08      5.66e-09
other  (F1=0.3, F2=-0.15)              4  -1  1.0 |  -1.63363731  -1.63363729 |   0.31662572   0.31662569 |     -1.77e-08      1.28e-08
other  (F1=0.3, F2=-0.15)              4  +1  1.5 |  -1.48093983  -1.48093982 |  -0.23595428  -0.23595426 |      1.11e-08      1.53e-08
other  (F1=0.3, F2=-0.15)              4  -1  1.5 |  -1.69916986  -1.69916983 |   0.63864993   0.63864987 |     -2.13e-08      2.58e-08
max relative deviation of second-order coefficients (formula vs ED): 2.26e-07
zeroth order: ED level = sigma*F0*M_k and E''(0) = sigma*tau^2/(F0*M_k) asserted to 1e-10 / 1e-8

PART B: formula (6.3) on rings with L = 8 ell, c0 = 1, F0 = 1;
rho_1, rho_2 = I^mark tau^2/C^mark of the F1^2 and F2^2 parts; prediction (6.9): 2 - r^2
held mark: g1 = G0*2c0^2/ell, g2 = J2*16c0^3/ell (prediction (6.7): -> 1); Cratio = C^mark(tau)/C^mark(0) for the F1^2 part
t_i = rho_i + 2 sigma eps_k R_i: rho with the term (iv) of Step 6 removed, R_i = <<sin^2 Q/E^2>>/<<1/E>> of the part i
  ell       g1       g2  Mk sig    r  2-r^2     rho_1     rho_2       t_1       t_2   Cratio
   16  1.00018  0.96912   3  +1  0.5   1.75   1.02947   0.27353   1.71048   1.55478  0.99488
   16  1.00018  0.96912   3  +1  1.0   1.00   0.42042  -0.09180   1.10143   1.18945  0.98053
   16  1.00018  0.96912   3  +1  1.5  -0.25  -0.49901  -0.61591   0.18200   0.66535  0.95935
   16  1.00018  0.96912   3  -1  0.5   1.75   2.34232   2.68110   1.66131   1.39984  1.00443
   16  1.00018  0.96912   3  -1  1.0   1.00   1.77840   2.40227   1.09739   1.12101  1.01848
   16  1.00018  0.96912   3  -1  1.5  -0.25   0.72788   1.84891   0.04687   0.56766  1.04497
   16  1.00018  0.96912   4  +1  0.5   1.75   0.79609  -0.17873   1.70411   1.52961  0.99624
   16  1.00018  0.96912   4  +1  1.0   1.00   0.19283  -0.53165   1.10085   1.17669  0.98551
   16  1.00018  0.96912   4  +1  1.5  -0.25  -0.73980  -1.05627   0.16821   0.65207  0.96919
   16  1.00018  0.96912   4  -1  0.5   1.75   2.57525   3.12404   1.66724   1.41570  1.00337
   16  1.00018  0.96912   4  -1  1.0   1.00   2.00585   2.83561   1.09784   1.12727  1.01394
   16  1.00018  0.96912   4  -1  1.5  -0.25   0.97571   2.28919   0.06769   0.58085  1.03324
   32  1.00055  0.98473   3  +1  0.5   1.75   1.30991   0.66603   1.73271   1.63703  0.99686
   32  1.00055  0.98473   3  +1  1.0   1.00   0.63602   0.17247   1.05882   1.14347  0.98799
   32  1.00055  0.98473   3  +1  1.5  -0.25  -0.41564  -0.56204   0.00716   0.40895  0.97466
   32  1.00055  0.98473   3  -1  0.5   1.75   2.12805   2.50760   1.70526   1.53660  1.00278
   32  1.00055  0.98473   3  -1  1.0   1.00   1.48043   2.07982   1.05764   1.10882  1.01154
   32  1.00055  0.98473   3  -1  1.5  -0.25   0.31874   1.26875  -0.10406   0.29775  1.02776
   32  1.00055  0.98473   4  +1  0.5   1.75   1.16546   0.32687   1.72918   1.62153  0.99769
   32  1.00055  0.98473   4  +1  1.0   1.00   0.49491  -0.15757   1.05863   1.13709  0.99105
   32  1.00055  0.98473   4  +1  1.5  -0.25  -0.56826  -0.89831  -0.00454   0.39635  0.98081
   32  1.00055  0.98473   4  -1  0.5   1.75   2.27233   2.84200   1.70860   1.54734  1.00211
   32  1.00055  0.98473   4  -1  1.0   1.00   1.62149   2.40670   1.05776   1.11204  1.00869
   32  1.00055  0.98473   4  -1  1.5  -0.25   0.47630   1.60897  -0.08742   0.31431  1.02055
   64  1.00064  0.99254   3  +1  0.5   1.75   1.49021   0.99884   1.74289   1.68674  0.99814
   64  1.00064  0.99254   3  +1  1.0   1.00   0.78115   0.41067   1.03383   1.09857  0.99285
   64  1.00064  0.99254   3  +1  1.5  -0.25  -0.35207  -0.49218  -0.09939   0.19572  0.98478
   64  1.00064  0.99254   3  -1  0.5   1.75   1.98048   2.31156   1.72780   1.62366  1.00168
   64  1.00064  0.99254   3  -1  1.0   1.00   1.28617   1.76929   1.03349   1.08139  1.00692
   64  1.00064  0.99254   3  -1  1.5  -0.25   0.07381   0.77769  -0.17887   0.08979  1.01650
   64  1.00064  0.99254   4  +1  0.5   1.75   1.40406   0.76016   1.74097   1.67736  0.99863
   64  1.00064  0.99254   4  +1  1.0   1.00   0.69686   0.17823   1.03377   1.09543  0.99467
   64  1.00064  0.99254   4  +1  1.5  -0.25  -0.44489  -0.73290  -0.10798   0.18430  0.98849
   64  1.00064  0.99254   4  -1  0.5   1.75   2.06655   2.54781   1.72965   1.63061  1.00127
   64  1.00064  0.99254   4  -1  1.0   1.00   1.37043   2.00020   1.03352   1.08300  1.00521
   64  1.00064  0.99254   4  -1  1.5  -0.25   0.16961   1.02296  -0.16730   0.10576  1.01223
  128  1.00066  0.99645   3  +1  0.5   1.75   1.60052   1.25165   1.74753   1.71538  0.99893
  128  1.00066  0.99645   3  +1  1.0   1.00   0.87314   0.59979   1.02014   1.06352  0.99585
  128  1.00066  0.99645   3  +1  1.5  -0.25  -0.30818  -0.42551  -0.16118   0.03822  0.99111
  128  1.00066  0.99645   3  -1  0.5   1.75   1.88631   2.14051   1.73931   1.67678  1.00098
  128  1.00066  0.99645   3  -1  1.0   1.00   1.16705   1.51888   1.02005   1.05514  1.00403
  128  1.00066  0.99645   3  -1  1.5  -0.25  -0.06643   0.41326  -0.21343  -0.05048  1.00955
  128  1.00066  0.99645   4  +1  0.5   1.75   1.55048   1.09149   1.74648   1.70980  0.99921
  128  1.00066  0.99645   4  +1  1.0   1.00   0.82412   0.44367   1.02012   1.06198  0.99690
  128  1.00066  0.99645   4  +1  1.5  -0.25  -0.36296  -0.58958  -0.16696   0.02873  0.99328
  128  1.00066  0.99645   4  -1  0.5   1.75   1.93632   2.29943   1.74032   1.68112  1.00074
  128  1.00066  0.99645   4  -1  1.0   1.00   1.21606   1.67424   1.02005   1.05592  1.00303
  128  1.00066  0.99645   4  -1  1.5  -0.25  -0.00998   0.58111  -0.20599  -0.03720  1.00709
  256  1.00067  0.99840   3  +1  0.5   1.75   1.66579   1.43035   1.74963   1.73137  0.99939
  256  1.00067  0.99840   3  +1  1.0   1.00   0.92909   0.73812   1.01293   1.03914  0.99764
  256  1.00067  0.99840   3  +1  1.5  -0.25  -0.27981  -0.37076  -0.19597  -0.06974  0.99491
  256  1.00067  0.99840   3  -1  0.5   1.75   1.82902   2.00926   1.74519   1.70824  1.00056
  256  1.00067  0.99840   3  -1  1.0   1.00   1.09673   1.33612   1.01290   1.03510  1.00230
  256  1.00067  0.99840   3  -1  1.5  -0.25  -0.14469   0.16335  -0.22853  -0.13767  1.00542
  256  1.00067  0.99840   4  +1  0.5   1.75   1.63728   1.32673   1.74906   1.72810  0.99955
  256  1.00067  0.99840   4  +1  1.0   1.00   0.90114   0.63703   1.01292   1.03839  0.99824
  256  1.00067  0.99840   4  +1  1.5  -0.25  -0.31142  -0.47842  -0.19964  -0.07706  0.99616
  256  1.00067  0.99840   4  -1  0.5   1.75   1.85751   2.11225   1.74573   1.71089  1.00043
  256  1.00067  0.99840   4  -1  1.0   1.00   1.12468   1.43684   1.01290   1.03548  1.00173
  256  1.00067  0.99840   4  -1  1.5  -0.25  -0.11219   0.27373  -0.22397  -0.12763  1.00403
  512  1.00067  0.99938   3  +1  0.5   1.75   1.70349   1.55041   1.75057   1.74011  0.99966
  512  1.00067  0.99938   3  +1  1.0   1.00   0.96211   0.83367   1.00920   1.02337  0.99868
  512  1.00067  0.99938   3  +1  1.5  -0.25  -0.26229  -0.32977  -0.21521  -0.14007  0.99713
  512  1.00067  0.99938   3  -1  0.5   1.75   1.79528   1.91619   1.74819   1.72649  1.00032
  512  1.00067  0.99938   3  -1  1.0   1.00   1.05627   1.21113   1.00919   1.02143  1.00130
  512  1.00067  0.99938   3  -1  1.5  -0.25  -0.18766   0.00087  -0.23475  -0.18883  1.00303
  512  1.00067  0.99938   4  +1  0.5   1.75   1.68749   1.48528   1.75027   1.73821  0.99975
  512  1.00067  0.99938   4  +1  1.0   1.00   0.94642   0.77007   1.00920   1.02300  0.99901
  512  1.00067  0.99938   4  +1  1.5  -0.25  -0.28022  -0.39831  -0.21744  -0.14537  0.99784
  512  1.00067  0.99938   4  -1  0.5   1.75   1.81127   1.98101   1.74849   1.72807  1.00024
  512  1.00067  0.99938   4  -1  1.0   1.00   1.07197   1.27454   1.00919   1.02160  1.00097
  512  1.00067  0.99938   4  -1  1.5  -0.25  -0.16927   0.07122  -0.23205  -0.18171  1.00226
output/torus_mark_inertia.txt30 KB · raw
PART A: lattice sums by mode classes and FFT pair convolution vs brute-force mode and ordered-pair sums, torus L=12, ell=3.0
  dE=0.01: max relative deviation S_1 4.20e-14, S_2 7.33e-10 (cases (sigma,r,eps) = ((-1, 1.0, 1.0), (-1, 1.5, 3.0), (-1, 0.5, 0.2), (1, 0.5, 0.05)), P = 0, 0.02)
  dE=0.001: max relative deviation S_1 4.20e-14, S_2 2.46e-13 (cases (sigma,r,eps) = ((-1, 1.0, 1.0), (-1, 1.5, 3.0), (-1, 0.5, 0.2), (1, 0.5, 0.05)), P = 0, 0.02)
  R_1: classes 0.229832921964, brute force 0.229832921964;  J2: FFT 0.011638555558, brute force 0.011638555558

PART B: convergence in ell and L (c0 = 1); rho_1, rho_2 of the F1^2 and F2^2 parts, lower branch
   L   ell        G0       w0        J2       R1       R2 |  r=1.0 e=1.0: rho_1, rho_2   r=1.0 e=4.0: rho_1, rho_2   r=0.5 e=2.0: rho_1, rho_2   r=2.0 e=2.0: rho_1, rho_2   r=3.0 e=4.0: rho_1, rho_2 
  32   4.0  0.232239  0.22480  0.011949  0.23251  0.12474 |    1.03105   0.45186         2.60889   1.38144         1.57378   0.78110         1.70071   0.85177         2.42262   1.56652     
  48   6.0  0.239180  0.22625  0.012219  0.23251  0.12634 |    1.04864   0.45934         2.62184   1.39875         1.59684   0.79160         1.64517   0.86582         2.11221   1.59060     
  64   8.0  0.242616  0.22682  0.012329  0.23200  0.12701 |    1.05570   0.46260         2.62347   1.40610         1.60686   0.79611         1.60931   0.87171         1.94764   1.59989     
 128  16.0  0.247714  0.22742  0.012450  0.23035  0.12778 |    1.06325   0.46651         2.61780   1.41470         1.61911   0.80147         1.54831   0.87840         1.71425   1.60921     
 256  32.0  0.250233  0.22760  0.012487  0.22901  0.12802 |    1.06527   0.46781         2.61022   1.41747         1.62351   0.80323         1.51653   0.88045         1.61492   1.61155     

PART C: main table, lower branch (isolated), torus L=64, ell=8.0 (m_h=0.125), c0=1, F0=1, eps_k=M_k
  G0=0.242616, w0=0.226815, J2=0.012329, R1=0.231996, R2=0.127005, Omega_max=3.4664
  C_i = S_i(0)/S_i(0)|_{tau=0} (moving mark over held mark), rho_i of the parts, t = T/G0, xi* = F2^2/(c0 F1^2) at which rho = 1 (- if none finite >= 0)
    r   eps     gap |      C_1      C_2 |     rho_1     rho_2 |         t       xi*
 0.25   0.5  0.1250 |  1.00550  1.00171 |    0.6521    0.2474 |    0.3278         -
 0.25   1.0  0.1250 |  1.00392  1.00139 |    1.0202    0.4490 |    0.5121    0.1811
 0.25   2.0  0.1250 |  1.00252  1.00102 |    1.6032    0.7931 |    0.8036   14.3639
 0.25   3.0  0.1250 |  1.00187  1.00081 |    2.1224    1.1002 |    1.0632         -
 0.25   4.0  0.1250 |  1.00148  1.00067 |    2.6185    1.3894 |    1.3112         -
 0.25   6.0  0.1250 |  1.00105  1.00050 |    3.5823    1.9414 |    1.7930         -
 0.25   8.0  0.1250 |  1.00081  1.00040 |    4.5299    2.4758 |    2.2668         -
 0.25  16.0  0.1250 |  1.00043  1.00022 |    8.2736    4.5550 |    4.1386         -
 0.25  32.0  0.1250 |  1.00022  1.00012 |   15.7146    8.6470 |    7.8590         -
 0.50   0.5  0.1250 |  1.02269  1.00691 |    0.6616    0.2494 |    0.3383         -
 0.50   1.0  0.1250 |  1.01603  1.00562 |    1.0270    0.4516 |    0.5217    0.2446
 0.50   2.0  0.1250 |  1.01023  1.00412 |    1.6069    0.7961 |    0.8116   14.7325
 0.50   3.0  0.1250 |  1.00754  1.00326 |    2.1245    1.1034 |    1.0703         -
 0.50   4.0  0.1250 |  1.00598  1.00270 |    2.6196    1.3927 |    1.3176         -
 0.50   6.0  0.1250 |  1.00423  1.00201 |    3.5823    1.9447 |    1.7987         -
 0.50   8.0  0.1250 |  1.00327  1.00160 |    4.5293    2.4791 |    2.2721         -
 0.50  16.0  0.1250 |  1.00172  1.00089 |    8.2720    4.5583 |    4.1431         -
 0.50  32.0  0.1250 |  1.00088  1.00047 |   15.7124    8.6503 |    7.8631         -
 1.00   0.5  0.1250 |  1.10472  1.02891 |    0.7065    0.2579 |    0.3903         -
 1.00   1.0  0.1250 |  1.07031  1.02324 |    1.0557    0.4626 |    0.5650    0.5334
 1.00   2.0  0.1250 |  1.04324  1.01685 |    1.6212    0.8088 |    0.8457   16.3994
 1.00   3.0  0.1250 |  1.03137  1.01326 |    2.1322    1.1166 |    1.0996         -
 1.00   4.0  0.1250 |  1.02465  1.01095 |    2.6235    1.4061 |    1.3441         -
 1.00   6.0  0.1250 |  1.01728  1.00813 |    3.5819    1.9582 |    1.8219         -
 1.00   8.0  0.1250 |  1.01330  1.00646 |    4.5264    2.4927 |    2.2933         -
 1.00  16.0  0.1250 |  1.00693  1.00356 |    8.2652    4.5717 |    4.1613         -
 1.00  32.0  0.1250 |  1.00354  1.00188 |   15.7036    8.6636 |    7.8796         -
 1.50   0.5  0.1012 |  1.34842  1.07115 |    0.6742    0.2776 |    0.4546         -
 1.50   1.0  0.1250 |  1.19218  1.05566 |    1.0962    0.4847 |    0.6534    1.0371
 1.50   2.0  0.1250 |  1.10791  1.03948 |    1.6407    0.8323 |    0.9089   20.0338
 1.50   3.0  0.1250 |  1.07583  1.03076 |    2.1414    1.1404 |    1.1519         -
 1.50   4.0  0.1250 |  1.05860  1.02524 |    2.6268    1.4299 |    1.3904         -
 1.50   6.0  0.1250 |  1.04036  1.01861 |    3.5787    1.9818 |    1.8616         -
 1.50   8.0  0.1250 |  1.03080  1.01475 |    4.5198    2.5160 |    2.3295         -
 1.50  16.0  0.1250 |  1.01583  1.00807 |    8.2530    4.5945 |    4.1918         -
 1.50  32.0  0.1250 |  1.00803  1.00424 |   15.6883    8.6859 |    7.9072         -
 2.00   2.0  0.1250 |  1.23048  1.07474 |    1.6093    0.8717 |    0.9901   26.7521
 2.00   3.0  0.1250 |  1.15137  1.05724 |    2.1326    1.1781 |    1.2277         -
 2.00   4.0  0.1250 |  1.11345  1.04653 |    2.6184    1.4665 |    1.4577         -
 2.00   6.0  0.1250 |  1.07589  1.03394 |    3.5670    2.0171 |    1.9188         -
 2.00   8.0  0.1250 |  1.05710  1.02675 |    4.5053    2.5504 |    2.3813         -
 2.00  16.0  0.1250 |  1.02874  1.01450 |    8.2334    4.6272 |    4.2350         -
 2.00  32.0  0.1250 |  1.01443  1.00758 |   15.6657    8.7176 |    7.9459         -

PART B2: convergence over the configurations of Part C: change of rho_1, rho_2 and t from (L,ell)=(64,8) to (128,16) and to (256,32); absolute for eps <= 4, relative for eps > 4
  to (128, 16.0): eps <= 4 max |change|: rho_1 0.0634, rho_2 0.0093, t 0.0412;  eps > 4 max relative change: rho_1 0.0163, rho_2 0.0060, t 0.0167
  to (256, 32.0): eps <= 4 max |change|: rho_1 0.0928, rho_2 0.0122, t 0.0581;  eps > 4 max relative change: rho_1 0.0269, rho_2 0.0079, t 0.0277

PART D: fine grid, 71 values of eps in [0.1, 64] (geometric), torus L=64, ell=8.0; lower branch where b_k + eps_k > 0.2 m_h
  item 2: rho_{i,-} increasing on the grid?  crossings of rho_i,- = 1; points with finite xi* >= 0;  item 3: phi = eps*t_- increasing and convex at the grid points?
  thresholds (L = infinity): eps_-(r) [lower isolated above], eps_+(r) [upper isolated below], m_h/2 = 0.0625
r=0.10: eps_-=0.0000, eps_+=0.0625; lower computed on eps in [0.100,64.0] (71 pts); rho_1,- 0.1999..30.572 incr True; rho_2,- 0.0553..16.790 incr True
   roots (Brent, +- error estimate): rho_1,- = 1 at eps 0.9721 (+-1e-10);  rho_2,- = 1 at eps 2.6683 (+-1e-10)
   finite xi* >= 0 [(rho_1-1)(rho_2-1) < 0] on eps in [0.986,2.658] (81-point refinement, 73 pts): xi* 0.0821 at 0.986 .. 1552.27 at 2.658; increasing True, decreasing False
   windows of finite xi* >= 0 between consecutive roots: [0.9721 (rho_1=1), 2.6683 (rho_2=1)]; all 152 computed points (grid and refinement) consistent with them: True
   phi increasing True; phi'' min 0.464 max 1.321; t_- 0.1001..15.286; at eps=64.0: rho_1,- - 2 eps R1 = 0.8764, rho_1,-/(2 eps R1) = 1.0295
r=0.25: eps_-=0.0000, eps_+=0.0625; lower computed on eps in [0.100,64.0] (71 pts); rho_1,- 0.2022..30.571 incr True; rho_2,- 0.0555..16.791 incr True
   roots (Brent, +- error estimate): rho_1,- = 1 at eps 0.9692 (+-1e-10);  rho_2,- = 1 at eps 2.6654 (+-1e-10)
   finite xi* >= 0 [(rho_1-1)(rho_2-1) < 0] on eps in [0.986,2.658] (81-point refinement, 73 pts): xi* 0.0990 at 0.986 .. 2192.64 at 2.658; increasing True, decreasing False
   windows of finite xi* >= 0 between consecutive roots: [0.9692 (rho_1=1), 2.6654 (rho_2=1)]; all 152 computed points (grid and refinement) consistent with them: True
   phi increasing True; phi'' min 0.464 max 1.328; t_- 0.1019..15.287; at eps=64.0: rho_1,- - 2 eps R1 = 0.8757, rho_1,-/(2 eps R1) = 1.0295
r=0.50: eps_-=0.0000, eps_+=0.0625; lower computed on eps in [0.100,64.0] (71 pts); rho_1,- 0.2112..30.569 incr True; rho_2,- 0.0561..16.794 incr True
   roots (Brent, +- error estimate): rho_1,- = 1 at eps 0.9587 (+-1e-10);  rho_2,- = 1 at eps 2.6550 (+-1e-10)
   finite xi* >= 0 [(rho_1-1)(rho_2-1) < 0] on eps in [0.963,2.635] (81-point refinement, 73 pts): xi* 0.0245 at 0.963 .. 770.92 at 2.635; increasing True, decreasing False
   windows of finite xi* >= 0 between consecutive roots: [0.9587 (rho_1=1), 2.6550 (rho_2=1)]; all 152 computed points (grid and refinement) consistent with them: True
   phi increasing True; phi'' min 0.464 max 1.350; t_- 0.1094..15.291; at eps=64.0: rho_1,- - 2 eps R1 = 0.8732, rho_1,-/(2 eps R1) = 1.0294
r=0.75: eps_-=0.0000, eps_+=0.0620; lower computed on eps in [0.100,64.0] (71 pts); rho_1,- 0.2310..30.565 incr True; rho_2,- 0.0573..16.799 incr True
   roots (Brent, +- error estimate): rho_1,- = 1 at eps 0.9402 (+-1e-10);  rho_2,- = 1 at eps 2.6373 (+-1e-10)
   finite xi* >= 0 [(rho_1-1)(rho_2-1) < 0] on eps in [0.963,2.635] (81-point refinement, 73 pts): xi* 0.1334 at 0.963 .. 7000.51 at 2.635; increasing True, decreasing False
   windows of finite xi* >= 0 between consecutive roots: [0.9402 (rho_1=1), 2.6373 (rho_2=1)]; all 152 computed points (grid and refinement) consistent with them: True
   phi increasing True; phi'' min 0.464 max 1.367; t_- 0.1258..15.298; at eps=64.0: rho_1,- - 2 eps R1 = 0.8691, rho_1,-/(2 eps R1) = 1.0293
r=1.00: eps_-=0.0000, eps_+=0.0260; lower computed on eps in [0.100,64.0] (71 pts); rho_1,- 0.2783..30.559 incr True; rho_2,- 0.0593..16.807 incr True
   roots (Brent, +- error estimate): rho_1,- = 1 at eps 0.9123 (+-1e-10);  rho_2,- = 1 at eps 2.6119 (+-1e-10)
   finite xi* >= 0 [(rho_1-1)(rho_2-1) < 0] on eps in [0.933,2.605] (81-point refinement, 70 pts): xi* 0.1195 at 0.933 .. 2169.06 at 2.605; increasing True, decreasing False
   windows of finite xi* >= 0 between consecutive roots: [0.9123 (rho_1=1), 2.6119 (rho_2=1)]; all 152 computed points (grid and refinement) consistent with them: True
   phi increasing True; phi'' min 0.464 max 1.283; t_- 0.1658..15.307; at eps=64.0: rho_1,- - 2 eps R1 = 0.8633, rho_1,-/(2 eps R1) = 1.0291
r=1.25: eps_-=0.1170, eps_+=0.0000; lower computed on eps in [0.159,64.0] (66 pts); rho_1,- 0.3458..30.551 incr True; rho_2,- 0.0966..16.817 incr True
   roots (Brent, +- error estimate): rho_1,- = 1 at eps 0.8740 (+-1e-10);  rho_2,- = 1 at eps 2.5779 (+-1e-10)
   finite xi* >= 0 [(rho_1-1)(rho_2-1) < 0] on eps in [0.884,2.556] (81-point refinement, 70 pts): xi* 0.0591 at 0.884 .. 705.35 at 2.556; increasing True, decreasing False
   windows of finite xi* >= 0 between consecutive roots: [0.8740 (rho_1=1), 2.5779 (rho_2=1)]; all 147 computed points (grid and refinement) consistent with them: True
   phi increasing True; phi'' min -10.935 max 0.655; phi'' <= 0 at eps in [0.174,0.209]; t_- 0.2388..15.318; at eps=64.0: rho_1,- - 2 eps R1 = 0.8558, rho_1,-/(2 eps R1) = 1.0288
r=1.50: eps_-=0.3460, eps_+=0.0000; lower computed on eps in [0.399,64.0] (56 pts); rho_1,- -0.1158..30.542 incr True; rho_2,- 0.2307..16.829 incr True
   roots (Brent, +- error estimate): rho_1,- = 1 at eps 0.8447 (+-1e-10);  rho_2,- = 1 at eps 2.5342 (+-1e-10)
   finite xi* >= 0 [(rho_1-1)(rho_2-1) < 0] on eps in [0.860,2.532] (81-point refinement, 70 pts): xi* 0.0967 at 0.860 .. 7303.39 at 2.532; increasing True, decreasing False
   windows of finite xi* >= 0 between consecutive roots: [0.8447 (rho_1=1), 2.5342 (rho_2=1)]; all 137 computed points (grid and refinement) consistent with them: True
   phi increasing True; phi'' min -65.091 max 0.483; phi'' <= 0 at eps in [0.438,0.634]; t_- -0.0839..15.333; at eps=64.0: rho_1,- - 2 eps R1 = 0.8465, rho_1,-/(2 eps R1) = 1.0285
r=2.00: eps_-=0.9846, eps_+=0.0000; lower computed on eps in [1.102,64.0] (45 pts); rho_1,- -0.8525..30.518 incr True; rho_2,- 0.5649..16.860 incr True
   roots (Brent, +- error estimate): rho_1,- = 1 at eps 1.3385 (+-1e-10);  rho_2,- = 1 at eps 2.4089 (+-1e-10)
   finite xi* >= 0 [(rho_1-1)(rho_2-1) < 0] on eps in [1.341,2.394] (81-point refinement, 71 pts): xi* 0.0853 at 1.341 .. 1011.36 at 2.394; increasing True, decreasing False
   windows of finite xi* >= 0 between consecutive roots: [1.3385 (rho_1=1), 2.4089 (rho_2=1)]; all 126 computed points (grid and refinement) consistent with them: True
   phi increasing True; phi'' min -67.350 max 0.464; phi'' <= 0 at eps in [1.209,1.749]; t_- -0.6397..15.369; at eps=64.0: rho_1,- - 2 eps R1 = 0.8223, rho_1,-/(2 eps R1) = 1.0277
r=3.00: eps_-=2.8771, eps_+=0.0000; lower computed on eps in [3.043,64.0] (34 pts); rho_1,- -10.0497..30.445 incr True; rho_2,- 1.3281..16.950 incr True
   roots (Brent, +- error estimate): rho_1,- = 1 at eps 3.5649 (+-1e-10);  rho_2,- = 1 at eps none
   finite xi* >= 0 [(rho_1-1)(rho_2-1) < 0] on eps in [3.043,3.559] (81-point refinement, 68 pts): xi* 234.2429 at 3.043 .. 0.26 at 3.559; increasing False, decreasing True
   windows of finite xi* >= 0 between consecutive roots: [3.0428 (edge of computed range), 3.5649 (rho_1=1)]; all 115 computed points (grid and refinement) consistent with them: True
   phi increasing True; phi'' min -223.950 max 0.464; phi'' <= 0 at eps in [3.337,4.827]; t_- -8.1671..15.474; at eps=64.0: rho_1,- - 2 eps R1 = 0.7492, rho_1,-/(2 eps R1) = 1.0252
  min over all computed points of S_i(0)/S_i(0)|_(tau=0): 1.0000
  grip y = F0 F2/F1^2 that equalises the bracket of (6.12) for two lower levels (eps_a, eps_b), direct evaluation at the stated levels:
   r=0.10: (0.25,0.5) 0.2242 (0.5,1) 0.3470 (1,2) 0.5467 (2,4) 0.9087 (4,8) 1.6106 (1,8) 1.2581
   r=0.25: (0.25,0.5) 0.2257 (0.5,1) 0.3482 (1,2) 0.5476 (2,4) 0.9094 (4,8) 1.6112 (1,8) 1.2587
   r=0.50: (0.25,0.5) 0.2312 (0.5,1) 0.3526 (1,2) 0.5508 (2,4) 0.9118 (4,8) 1.6132 (1,8) 1.2610
   r=0.75: (0.25,0.5) 0.2407 (0.5,1) 0.3599 (1,2) 0.5561 (2,4) 0.9158 (4,8) 1.6166 (1,8) 1.2649
   r=1.00: (0.25,0.5) 0.2544 (0.5,1) 0.3698 (1,2) 0.5632 (2,4) 0.9212 (4,8) 1.6213 (1,8) 1.2701
   r=1.25: (0.25,0.5) 0.2715 (0.5,1) 0.3814 (1,2) 0.5718 (2,4) 0.9280 (4,8) 1.6272 (1,8) 1.2766
   r=1.50: (0.5,1) 0.4261 (1,2) 0.5821 (2,4) 0.9359 (4,8) 1.6343 (1,8) 1.2845
   r=2.00: (2,4) 0.9627 (4,8) 1.6524
   r=3.00: (4,8) 1.8593
  members with stated margins (exact evaluation at the stated eps, r = 1), L=64, ell=8.0:
   item 2: level eps=4: rho_1,- = 2.6235, rho_2,- = 1.4061 -> rho_- >= 1.4061 > 1 for every grip
   item 2: levels eps=1.2, 2.0: xi* = 1.9596, 16.3994
   item 3: levels eps=1,2,3: t_- = 0.5650, 0.8457, 1.0996; y_12 = 0.5632, y_23 = 0.8037

PART D2: as Part D, both parts, torus L=256, ell=32.0; 36 values of eps in [0.1, 64]
  thresholds (L = infinity): eps_-(r) [lower isolated above], eps_+(r) [upper isolated below], m_h/2 = 0.0156
r=0.10: eps_-=0.0000, eps_+=0.0156; lower computed on eps in [0.100,64.0] (36 pts); rho_1,- 0.2289..30.219 incr True; rho_2,- 0.0563..16.922 incr True
   roots (Brent, +- error estimate): rho_1,- = 1 at eps 0.9274 (+-1e-10);  rho_2,- = 1 at eps 2.6406 (+-1e-10)
   finite xi* >= 0 [(rho_1-1)(rho_2-1) < 0] on eps in [0.940,2.635] (81-point refinement, 74 pts): xi* 0.0718 at 0.940 .. 2833.10 at 2.635; increasing True, decreasing False
   windows of finite xi* >= 0 between consecutive roots: [0.9274 (rho_1=1), 2.6406 (rho_2=1)]; all 117 computed points (grid and refinement) consistent with them: True
   phi increasing True; phi'' min 0.458 max 1.273; t_- 0.1146..15.110; at eps=64.0: rho_1,- - 2 eps R1 = 0.9056, rho_1,-/(2 eps R1) = 1.0309
r=0.50: eps_-=0.0000, eps_+=0.0156; lower computed on eps in [0.100,64.0] (36 pts); rho_1,- 0.2403..30.211 incr True; rho_2,- 0.0572..16.927 incr True
   roots (Brent, +- error estimate): rho_1,- = 1 at eps 0.9201 (+-1e-10);  rho_2,- = 1 at eps 2.6272 (+-1e-10)
   finite xi* >= 0 [(rho_1-1)(rho_2-1) < 0] on eps in [0.940,2.612] (81-point refinement, 73 pts): xi* 0.1150 at 0.940 .. 1007.75 at 2.612; increasing True, decreasing False
   windows of finite xi* >= 0 between consecutive roots: [0.9201 (rho_1=1), 2.6272 (rho_2=1)]; all 117 computed points (grid and refinement) consistent with them: True
   phi increasing True; phi'' min 0.458 max 1.281; t_- 0.1246..15.112; at eps=64.0: rho_1,- - 2 eps R1 = 0.8973, rho_1,-/(2 eps R1) = 1.0306
r=1.00: eps_-=0.0000, eps_+=0.0034; lower computed on eps in [0.100,64.0] (36 pts); rho_1,- 0.3070..30.184 incr True; rho_2,- 0.0609..16.940 incr True
   roots (Brent, +- error estimate): rho_1,- = 1 at eps 0.8957 (+-1e-10);  rho_2,- = 1 at eps 2.5838 (+-1e-10)
   finite xi* >= 0 [(rho_1-1)(rho_2-1) < 0] on eps in [0.913,2.573] (81-point refinement, 67 pts): xi* 0.1014 at 0.913 .. 1438.91 at 2.573; increasing True, decreasing False
   windows of finite xi* >= 0 between consecutive roots: [0.8957 (rho_1=1), 2.5838 (rho_2=1)]; all 117 computed points (grid and refinement) consistent with them: True
   phi increasing True; phi'' min 0.458 max 1.174; t_- 0.1841..15.119; at eps=64.0: rho_1,- - 2 eps R1 = 0.8713, rho_1,-/(2 eps R1) = 1.0297
r=1.50: eps_-=0.3578, eps_+=0.0000; lower computed on eps in [0.438,64.0] (28 pts); rho_1,- 0.2193..30.141 incr True; rho_2,- 0.2535..16.962 incr True
   roots (Brent, +- error estimate): rho_1,- = 1 at eps 0.8909 (+-1e-10);  rho_2,- = 1 at eps 2.5053 (+-1e-10)
   finite xi* >= 0 [(rho_1-1)(rho_2-1) < 0] on eps in [0.913,2.498] (81-point refinement, 64 pts): xi* 0.1483 at 0.913 .. 1949.26 at 2.498; increasing True, decreasing False
   windows of finite xi* >= 0 between consecutive roots: [0.8909 (rho_1=1), 2.5053 (rho_2=1)]; all 109 computed points (grid and refinement) consistent with them: True
   phi increasing True; phi'' min -9.444 max 0.470; phi'' <= 0 at eps in [0.527,0.634]; t_- 0.1546..15.131; at eps=64.0: rho_1,- - 2 eps R1 = 0.8275, rho_1,-/(2 eps R1) = 1.0282
r=2.00: eps_-=0.9990, eps_+=0.0000; lower computed on eps in [1.102,64.0] (23 pts); rho_1,- -1.6875..30.079 incr True; rho_2,- 0.5678..16.993 incr True
   roots (Brent, +- error estimate): rho_1,- = 1 at eps 1.4187 (+-1e-10);  rho_2,- = 1 at eps 2.3785 (+-1e-10)
   finite xi* >= 0 [(rho_1-1)(rho_2-1) < 0] on eps in [1.434,2.376] (81-point refinement, 53 pts): xi* 0.5056 at 1.434 .. 5387.87 at 2.376; increasing True, decreasing False
   windows of finite xi* >= 0 between consecutive roots: [1.4187 (rho_1=1), 2.3785 (rho_2=1)]; all 104 computed points (grid and refinement) consistent with them: True
   phi increasing True; phi'' min -30.764 max 0.458; phi'' <= 0 at eps in [1.326,1.595]; t_- -1.2715..15.147; at eps=64.0: rho_1,- - 2 eps R1 = 0.7653, rho_1,-/(2 eps R1) = 1.0261
r=3.00: eps_-=2.9015, eps_+=0.0000; lower computed on eps in [3.337,64.0] (17 pts); rho_1,- -1.0119..29.896 incr True; rho_2,- 1.4204..17.084 incr True
   roots (Brent, +- error estimate): rho_1,- = 1 at eps 3.6997 (+-1e-10);  rho_2,- = 1 at eps none
   finite xi* >= 0 [(rho_1-1)(rho_2-1) < 0] on eps in [3.337,3.692] (81-point refinement, 43 pts): xi* 31.4242 at 3.337 .. 0.25 at 3.692; increasing False, decreasing True
   windows of finite xi* >= 0 between consecutive roots: [3.3370 (edge of computed range), 3.6997 (rho_1=1)]; all 98 computed points (grid and refinement) consistent with them: True
   phi increasing True; phi'' min -8.825 max 0.458; phi'' <= 0 at eps in [4.014,4.827]; t_- -0.7566..15.192; at eps=64.0: rho_1,- - 2 eps R1 = 0.5824, rho_1,-/(2 eps R1) = 1.0199
  min over all computed points of S_i(0)/S_i(0)|_(tau=0): 1.0000
  grip y = F0 F2/F1^2 that equalises the bracket of (6.12) for two lower levels (eps_a, eps_b), direct evaluation at the stated levels:
   r=0.10: (0.25,0.5) 0.2324 (0.5,1) 0.3533 (1,2) 0.5501 (2,4) 0.9072 (4,8) 1.6000 (1,8) 1.2521
   r=0.50: (0.25,0.5) 0.2382 (0.5,1) 0.3576 (1,2) 0.5528 (2,4) 0.9090 (4,8) 1.6013 (1,8) 1.2537
   r=1.00: (0.25,0.5) 0.2569 (0.5,1) 0.3703 (1,2) 0.5608 (2,4) 0.9141 (4,8) 1.6050 (1,8) 1.2584
   r=1.50: (0.5,1) 0.4381 (1,2) 0.5733 (2,4) 0.9217 (4,8) 1.6109 (1,8) 1.2657
   r=2.00: (2,4) 0.9418 (4,8) 1.6194
   r=3.00: (4,8) 1.8315
  members with stated margins (exact evaluation at the stated eps, r = 1), L=256, ell=32.0:
   item 2: level eps=4: rho_1,- = 2.6102, rho_2,- = 1.4175 -> rho_- >= 1.4175 > 1 for every grip
   item 2: levels eps=1.2, 2.0: xi* = 2.1050, 17.3835
   item 3: levels eps=1,2,3: t_- = 0.5699, 0.8458, 1.0959; y_12 = 0.5608, y_23 = 0.7980

PART E: ED of the contract restricted to <= 2 field quanta, cubic torus L=4, ell=2.0, dimension 4290; M_k=5.0, F1=0.3, F2=0.1, r=1.0, Omega_max=3.5000 (sigma=+1: formal coefficients, the upper branch is not isolated here)
  sigma=+1 Cost   second order: ED -0.2793475807  formula -0.2793475807
  sigma=+1 E''(0) second order: ED -0.0038368899  formula -0.0038368899
  sigma=-1 Cost   second order: ED -0.2892384565  formula -0.2892384576
  sigma=-1 E''(0) second order: ED 0.0307210119  formula 0.0307210119
  max relative deviation: 3.84e-09

PART F: light levels eps_k < eps_+(r) (upper branch isolated), ell=8.0 (m_h=0.125), eps = f*eps_+, both branches, both parts; ring and cubic torus
 graph     L     r    eps_+    f      eps |   rho_1,+   rho_2,+   rho_1,-   rho_2,-
  ring  2048  0.25  0.06250  0.3  0.01875 |   -0.5163   -0.1403    0.3143    0.1159
  ring  4096  0.25  0.06250  0.3  0.01875 |   -0.5163       nan    0.3143       nan
 torus   128  0.25  0.06250  0.3  0.01875 |   -0.0536   -0.0109    0.0463    0.0107
 torus   256  0.25  0.06250  0.3  0.01875 |   -0.0536   -0.0109    0.0463    0.0107
  ring  2048  0.25  0.06250  0.5  0.03125 |   -1.1159   -0.2526    0.4656    0.1831
  ring  4096  0.25  0.06250  0.5  0.03125 |   -1.1159       nan    0.4656       nan
 torus   128  0.25  0.06250  0.5  0.03125 |   -0.0959   -0.0182    0.0742    0.0178
 torus   256  0.25  0.06250  0.5  0.03125 |   -0.0959   -0.0182    0.0742    0.0178
  ring  2048  0.25  0.06250  0.7  0.04375 |   -2.2855   -0.3854    0.5875    0.2437
  ring  4096  0.25  0.06250  0.7  0.04375 |   -2.2855       nan    0.5875       nan
 torus   128  0.25  0.06250  0.7  0.04375 |   -0.1471   -0.0257    0.1004    0.0248
 torus   256  0.25  0.06250  0.7  0.04375 |   -0.1471   -0.0257    0.1004    0.0248
  ring  2048  0.25  0.06250  0.9  0.05625 |   -6.2948   -0.5466    0.6883    0.2990
  ring  4096  0.25  0.06250  0.9  0.05625 |   -6.2948       nan    0.6883       nan
 torus   128  0.25  0.06250  0.9  0.05625 |   -0.2198   -0.0332    0.1250    0.0317
 torus   256  0.25  0.06250  0.9  0.05625 |   -0.2197   -0.0332    0.1250    0.0317
  ring  2048  0.50  0.06250  0.3  0.01875 |   -0.5776   -0.1541    0.3346    0.1247
  ring  4096  0.50  0.06250  0.3  0.01875 |   -0.5776       nan    0.3346       nan
 torus   128  0.50  0.06250  0.3  0.01875 |   -0.0590   -0.0110    0.0495    0.0109
 torus   256  0.50  0.06250  0.3  0.01875 |   -0.0590   -0.0110    0.0495    0.0109
  ring  2048  0.50  0.06250  0.5  0.03125 |   -1.2864   -0.2800    0.4907    0.1958
  ring  4096  0.50  0.06250  0.5  0.03125 |   -1.2864       nan    0.4907       nan
 torus   128  0.50  0.06250  0.5  0.03125 |   -0.1070   -0.0185    0.0790    0.0180
 torus   256  0.50  0.06250  0.5  0.03125 |   -0.1070   -0.0185    0.0790    0.0180
  ring  2048  0.50  0.06250  0.7  0.04375 |   -2.7657   -0.4321    0.6139    0.2595
  ring  4096  0.50  0.06250  0.7  0.04375 |   -2.7657       nan    0.6139       nan
 torus   128  0.50  0.06250  0.7  0.04375 |   -0.1683   -0.0261    0.1064    0.0251
 torus   256  0.50  0.06250  0.7  0.04375 |   -0.1682   -0.0261    0.1064    0.0251
  ring  2048  0.50  0.06250  0.9  0.05625 |   -8.5004   -0.6212    0.7140    0.3169
  ring  4096  0.50  0.06250  0.9  0.05625 |   -8.5004       nan    0.7140       nan
 torus   128  0.50  0.06250  0.9  0.05625 |   -0.2651   -0.0337    0.1320    0.0321
 torus   256  0.50  0.06250  0.9  0.05625 |   -0.2650   -0.0337    0.1320    0.0321
  ring  2048  0.75  0.06202  0.3  0.01861 |   -0.7723   -0.1906    0.3866    0.1457
  ring  4096  0.75  0.06202  0.3  0.01861 |   -0.7723       nan    0.3866       nan
 torus   128  0.75  0.06202  0.3  0.01861 |   -0.0741   -0.0113    0.0574    0.0110
 torus   256  0.75  0.06202  0.3  0.01861 |   -0.0741   -0.0113    0.0574    0.0110
  ring  2048  0.75  0.06202  0.5  0.03101 |   -1.9041   -0.3557    0.5517    0.2257
  ring  4096  0.75  0.06202  0.5  0.03101 |   -1.9041       nan    0.5517       nan
 torus   128  0.75  0.06202  0.5  0.03101 |   -0.1419   -0.0189    0.0902    0.0183
 torus   256  0.75  0.06202  0.5  0.03101 |   -0.1419   -0.0189    0.0902    0.0183
  ring  2048  0.75  0.06202  0.7  0.04341 |   -4.9499   -0.5674    0.6754    0.2955
  ring  4096  0.75  0.06202  0.7  0.04341 |   -4.9499       nan    0.6754       nan
 torus   128  0.75  0.06202  0.7  0.04341 |   -0.2466   -0.0266    0.1200    0.0255
 torus   256  0.75  0.06202  0.7  0.04341 |   -0.2466   -0.0266    0.1200    0.0255
  ring  2048  0.75  0.06202  0.9  0.05582 |  -27.2162   -0.8510    0.7715    0.3571
  ring  4096  0.75  0.06202  0.9  0.05582 |  -27.2162       nan    0.7715       nan
 torus   128  0.75  0.06202  0.9  0.05582 |   -0.5329   -0.0345    0.1473    0.0326
 torus   256  0.75  0.06202  0.9  0.05582 |   -0.5301   -0.0345    0.1473    0.0326
  ring  2048  1.00  0.02600  0.3  0.00780 |   -0.8806   -0.1338    0.3795    0.1065
  ring  4096  1.00  0.02600  0.3  0.00780 |   -0.8806       nan    0.3795       nan
 torus   128  1.00  0.02600  0.3  0.00780 |   -0.0676   -0.0049    0.0449    0.0049
 torus   256  1.00  0.02600  0.3  0.00780 |   -0.0676   -0.0049    0.0449    0.0049
  ring  2048  1.00  0.02600  0.5  0.01300 |   -2.4095   -0.2441    0.5271    0.1664
  ring  4096  1.00  0.02600  0.5  0.01300 |   -2.4095       nan    0.5271       nan
 torus   128  1.00  0.02600  0.5  0.01300 |   -0.1447   -0.0082    0.0686    0.0081
 torus   256  1.00  0.02600  0.5  0.01300 |   -0.1446   -0.0082    0.0686    0.0081
  ring  2048  1.00  0.02600  0.7  0.01820 |   -7.5371   -0.3778    0.6313    0.2193
  ring  4096  1.00  0.02600  0.7  0.01820 |   -7.5371       nan    0.6313       nan
 torus   128  1.00  0.02600  0.7  0.01820 |   -0.3093   -0.0116    0.0891    0.0113
 torus   256  1.00  0.02600  0.7  0.01820 |   -0.3091   -0.0116    0.0891    0.0113
  ring  2048  1.00  0.02600  0.9  0.02340 |  -65.2061   -0.5435    0.7084    0.2664
  ring  4096  1.00  0.02600  0.9  0.02340 |  -65.2061       nan    0.7084       nan
 torus   128  1.00  0.02600  0.9  0.02340 |   -1.2769   -0.0149    0.1074    0.0145
 torus   256  1.00  0.02600  0.9  0.02340 |   -1.2097   -0.0149    0.1074    0.0145
  range of all rho_{i,sigma} above, per lattice: ring L=2048: [-65.2061, 0.7715]; ring L=4096: [-65.2061, 0.7715]; torus L=128: [-1.2769, 0.1473]; torus L=256: [-1.2097, 0.1473]

PART G: accuracy of S_i''(0) (I4) and finite size (I3) at the points of smallest isolation gap. Analytic rho_i against Richardson finite differences with h0 = min(1e-2, 0.05 eps/tau) (step of v3), h0/2, h0/4: max |rho_i(h) - rho_i(analytic)| over the cases
  light ring L=2048            sigma=+1 r=0.25 eps=0.05625 gap/m_h=0.100: rho_1=-6.294773 rho_2=-0.546641
  light ring L=2048            sigma=-1 r=0.25 eps=0.05625 gap/m_h=1.000: rho_1=0.688284 rho_2=0.298995
  light torus L=128            sigma=+1 r=0.25 eps=0.05625 gap/m_h=0.100: rho_1=-0.219772 rho_2=-0.033221
  light torus L=128            sigma=-1 r=0.25 eps=0.05625 gap/m_h=1.000: rho_1=0.124991 rho_2=0.031706
  light ring L=2048            sigma=+1 r=0.50 eps=0.05625 gap/m_h=0.100: rho_1=-8.500448 rho_2=-0.621246
  light ring L=2048            sigma=-1 r=0.50 eps=0.05625 gap/m_h=1.000: rho_1=0.714030 rho_2=0.316921
  light torus L=128            sigma=+1 r=0.50 eps=0.05625 gap/m_h=0.100: rho_1=-0.265073 rho_2=-0.033725
  light torus L=128            sigma=-1 r=0.50 eps=0.05625 gap/m_h=1.000: rho_1=0.131961 rho_2=0.032095
  light ring L=2048            sigma=+1 r=0.75 eps=0.05582 gap/m_h=0.085: rho_1=-27.216244 rho_2=-0.850951
  light ring L=2048            sigma=-1 r=0.75 eps=0.05582 gap/m_h=0.978: rho_1=0.771491 rho_2=0.357115
  light torus L=128            sigma=+1 r=0.75 eps=0.05582 gap/m_h=0.085: rho_1=-0.532888 rho_2=-0.034455
  light torus L=128            sigma=-1 r=0.75 eps=0.05582 gap/m_h=0.978: rho_1=0.147277 rho_2=0.032581
  light ring L=2048            sigma=+1 r=1.00 eps=0.02340 gap/m_h=0.022: rho_1=-65.206114 rho_2=-0.543476
  light ring L=2048            sigma=-1 r=1.00 eps=0.02340 gap/m_h=0.397: rho_1=0.708414 rho_2=0.266437
  light torus L=128            sigma=+1 r=1.00 eps=0.02340 gap/m_h=0.022: rho_1=-1.276852 rho_2=-0.014933
  light torus L=128            sigma=-1 r=1.00 eps=0.02340 gap/m_h=0.397: rho_1=0.107429 rho_2=0.014463
  lower edge torus L=64 ell=8.0 sigma=-1 r=1.25 eps=0.15865 gap/m_h=0.279: rho_1=0.345796 rho_2=0.096638
  lower edge torus L=64 ell=8.0 sigma=-1 r=1.50 eps=0.39932 gap/m_h=0.297: rho_1=-0.115816 rho_2=0.230717
  lower edge torus L=64 ell=8.0 sigma=-1 r=2.00 eps=1.10229 gap/m_h=0.455: rho_1=-0.852547 rho_2=0.564905
  lower edge torus L=64 ell=8.0 sigma=-1 r=3.00 eps=3.04275 gap/m_h=0.352: rho_1=-10.049746 rho_2=1.328066
  lower edge torus L=256 ell=32.0 sigma=-1 r=1.50 eps=0.43794 gap/m_h=1.000: rho_1=0.219344 rho_2=0.253451
  lower edge torus L=256 ell=32.0 sigma=-1 r=2.00 eps=1.10229 gap/m_h=1.000: rho_1=-1.687452 rho_2=0.567791
  lower edge torus L=256 ell=32.0 sigma=-1 r=3.00 eps=3.33699 gap/m_h=1.000: rho_1=-1.011914 rho_2=1.420400
  light ring L=2048           : rho_1: 1.5e+01, 3.6e-01, 1.9e-02; rho_2: 5.5e-06, 3.4e-07, 2.2e-08  (h0, h0/2, h0/4)
  light torus L=128           : rho_1: 1.1e-01, 2.7e-03, 1.5e-04; rho_2: 3.1e-07, 1.9e-08, 1.2e-09  (h0, h0/2, h0/4)
  lower edge torus L=64 ell=8.0: rho_1: 8.1e-03, 4.7e-04, 2.9e-05; rho_2: 9.6e-07, 6.0e-08, 3.8e-09  (h0, h0/2, h0/4)
  lower edge torus L=256 ell=32.0: rho_1: 1.2e-03, 7.2e-05, 4.5e-06; rho_2: 6.4e-07, 4.0e-08, 2.5e-09  (h0, h0/2, h0/4)
  finite size, lower edge r=1.25 eps=0.1587: rho_1 0.345796 (L=64) 0.345841 (L=128); rho_2 0.096638 (L=64) 0.096637 (L=128)
  finite size, lower edge r=1.50 eps=0.3993: rho_1 -0.115816 (L=64) -0.115803 (L=128); rho_2 0.230717 (L=64) 0.230717 (L=128)
  finite size, lower edge r=2.00 eps=1.1023: rho_1 -0.852547 (L=64) -0.852570 (L=128); rho_2 0.564905 (L=64) 0.564905 (L=128)
  finite size, lower edge r=3.00 eps=3.0428: rho_1 -10.049746 (L=64) -10.049904 (L=128); rho_2 1.328066 (L=64) 1.328071 (L=128)
  max |rho_i(L=64) - rho_i(L=128)| at these points: 1.59e-04
Analyse with ChatGPTnDot Physics Research plugin
ChatGPT plugin

Analyse this research in ChatGPT

The free plugin nDot Physics Research gives ChatGPT read-only access to everything published here.

  1. Open ChatGPT and select the plugin in the message box.
  2. Write your question after it:nDot Physics Research Explain what 08-ilang-propagation/06-mark-inertia establishes and what it builds on.
  3. Name the subproject when you cite an equation number, e.g. (17.7) of 03-ilang-space.
Open in ChatGPT

Interested in this research?

Join the readers' list and get an e-mail when a new stage or a correction is published. No password, and you can unsubscribe at any time.