Current task: —

E-007-extended-precision-floor.py

Experiments: E-007, E-007b · script updated 08-17-2026

E-007-extended-precision-floor.csv — 314 bytes, updated 08-17-2026

page 1 of 1 · 500/page · 4 rows
# lambdadN_primerank_above_noiselambda_maxlambda_min_posminpos_over_meanlog10_ratio
2 0.5 55 139 55 6.1994012 1.5420306e-5 6.949e-6 -5.1581
3 1.0 110 139 110 3.2223071 3.1231559e-7 2.815e-7 -6.5506
4 1.5 165 139 139 2.3616051 4.7386005e-31 5.396e-31 -30.268
5 2.0 220 139 139 1.974842 1.7061162e-26 1.943e-26 -25.712

E-007b-extended-precision-floor.csv — 336 bytes, updated 08-17-2026

page 1 of 1 · 500/page · 3 rows
# lambdaTsupport_adN_primefull_rankrank_above_noiselambda_maxlambda_min_posminpos_over_meanlog10_ratio
2 0.5 400.0 2.07679 132 317 True 132 6.132843 5.1055857e-7 2.338e-7 -6.6312
3 0.75 400.0 3.11519 198 317 True 198 4.1498788 5.4758736e-8 3.761e-8 -7.4247
4 1.0 400.0 4.15359 264 317 True 264 3.2023404 8.3456297e-9 7.641e-9 -8.1169

E-007-extended-precision-floor.json — 724 bytes, updated 08-17-2026

JSON sidecar (click to expand)
{
  "experiment": "E-007",
  "task": "3.1 / Q-3.4b (extended-precision positivity floor)",
  "description": "Smallest positive eigenvalue of Gabor-truncated Weil form at dps 40, Hann window (exact FT), T=200, bandwidths 0.5-2.0",
  "script": "research/numerics/scripts/E-007-extended-precision-floor.py",
  "parameters": {
    "T": 200.0,
    "lambdas": [
      0.5,
      1.0,
      1.5,
      2.0
    ],
    "dps": 40,
    "window": "Hann (exact closed-form FT)"
  },
  "caveats": [
    "small T=200: finite-L effects larger than E-006",
    "d > N' for lambda >= 1.5: dimensional deficiency"
  ],
  "elapsed_seconds": 150.2,
  "timestamp_utc": "2026-08-17T22:55:25.583860+00:00",
  "row_count": 4
}

E-007b-extended-precision-floor.json — 713 bytes, updated 08-17-2026

JSON sidecar (click to expand)
{
  "experiment": "E-007",
  "task": "3.1 / Q-3.4b (extended-precision positivity floor)",
  "description": "Smallest positive eigenvalue of Gabor-truncated Weil form at dps 40, Hann window (exact FT), T=200, bandwidths 0.5-2.0",
  "script": "research/numerics/scripts/E-007-extended-precision-floor.py",
  "parameters": {
    "T": 400.0,
    "lambdas": [
      0.5,
      0.75,
      1.0
    ],
    "dps": 40,
    "window": "Hann (exact closed-form FT)"
  },
  "caveats": [
    "small T=200: finite-L effects larger than E-006",
    "d > N' for lambda >= 1.5: dimensional deficiency"
  ],
  "elapsed_seconds": 325.5,
  "timestamp_utc": "2026-08-17T23:04:57.888612+00:00",
  "row_count": 3
}

Source code

Python script (click to expand)
"""E-007 — Q-3.4b follow-up: extended-precision positivity floor.

E-006 showed the float64 pipeline floors at ~1e-10 relative — resolution-
limited. Here: small-dimension, HIGH-PRECISION measurement of the smallest
positive eigenvalue of the Gabor-truncated Weil form.

Key design: Hann window phi(u) = cos^2(pi u/L) on [-L/2, L/2] has CLOSED
FORM Fourier transform:
  phi_hat(xi) = (L/2)sinc(L xi/2) + (L/4)[sinc(L xi/2 - pi) + sinc(L xi/2 + pi)]
(sinc(x) = sin x / x), and ||phi||^2 = 3L/8 exactly => a = 3/8.
All entries exact at mpmath dps — no interpolation noise.

G = (a L^2)^-1 Sum_{gamma in I'} v v^T,  v_k = phi_hat(gamma - alpha_k),
grid alpha_k = T + (2pi/L) k, d = floor(L T / 2pi), T = 200 (small so d
stays ~ 55..220), eigenvalues via mpmath.eigsy at dps 40.

Metrics per lambda: d, N', lambda_min+ (above dps noise), ratio to mean,
log10 ratio — the floor vs bandwidth. Decay of the floor with lambda =
the horizon/complexity-wall measure (Q-3.4b).

Outputs: research/numerics/data/E-007-extended-precision-floor.csv (+json)
"""
import json
import sys
import time
from datetime import datetime, timezone
from pathlib import Path

import mpmath as mp

REPO = Path(__file__).resolve().parents[3]
DATA = REPO / "research" / "numerics" / "data"
ZEROS_CSV = DATA / "E-002-zeros-first-10000.csv"

T = 200.0
LAMBDAS = (0.5, 1.0, 1.5, 2.0)
DPS = 40
TAG = ""

# --T400 variant: T=400, lambdas chosen so d <= N' (no dimensional
# deficiency): interleaves support values a = lambda*ell(T) with the
# T=200 run for a decay-law fit.
if "--T400" in sys.argv:
    T = 400.0
    LAMBDAS = (0.5, 0.75, 1.0)
    TAG = "b"

CSV = DATA / f"E-007{TAG}-extended-precision-floor.csv"
JSON = DATA / f"E-007{TAG}-extended-precision-floor.json"


def sinc(x):
    return mp.mpf(1) if x == 0 else mp.sin(x) / x


def phi_hat(xi, L):
    """Exact Hann-window Fourier transform (sinc(x)=sin x/x convention)."""
    x = L * xi / 2
    return (L / 2) * sinc(x) + (L / 4) * (sinc(x - mp.pi) + sinc(x + mp.pi))


def main() -> int:
    if CSV.exists() and "--force" not in sys.argv:
        print(f"cached: {CSV} exists (use --force to recompute)"); return 0
    mp.mp.dps = DPS
    t0 = time.time()

    gam = []
    with ZEROS_CSV.open(encoding="utf-8") as f:
        next(f)
        for line in f:
            gam.append(mp.mpf(line.split(",", 1)[1]))
    ell = mp.log(T / (2 * mp.pi))
    sqT = mp.sqrt(T)
    zeros_Ip = [g for g in gam if T - sqT <= g < 2 * T + sqT]
    Np = len(zeros_Ip)
    print(f"T={T}  ell={mp.nstr(ell,6)}  zeros in I'={Np}  dps={DPS}",
          flush=True)

    rows = []
    for lam in LAMBDAS:
        t1 = time.time()
        L = lam * ell
        h = 2 * mp.pi / L
        d = int(L * T / (2 * mp.pi))
        a = mp.mpf(3) / 8  # ||phi||^2/L for Hann
        # build V (Np x d) then G = V^T V / (a L^2)
        V = [[phi_hat(g - (T + h * k), L) for k in range(d)]
             for g in zeros_Ip]
        G = mp.matrix(d, d)
        scale = a * L**2
        for i in range(d):
            vi = [V[r][i] for r in range(Np)]
            for j in range(i, d):
                s = mp.mpf(0)
                for r in range(Np):
                    s += vi[r] * V[r][j]
                G[i, j] = G[j, i] = s / scale
        ev = sorted(mp.eigsy(G)[0])  # ascending eigenvalues
        lam_max = ev[-1]
        noise = mp.mpf(10) ** (-(DPS - 8)) * lam_max
        pos = [e for e in ev if e > noise]
        lam_min_pos = pos[0] if pos else mp.mpf(0)
        mean_pos = sum(pos) / len(pos) if pos else mp.mpf(1)
        ratio = lam_min_pos / mean_pos if mean_pos else mp.mpf(0)
        rows.append({
            "lambda": lam, "T": T, "support_a": mp.nstr(L, 6),
            "d": d, "N_prime": Np,
            "full_rank": len(pos) == min(d, Np),
            "rank_above_noise": len(pos),
            "lambda_max": mp.nstr(lam_max, 8),
            "lambda_min_pos": mp.nstr(lam_min_pos, 8),
            "minpos_over_mean": mp.nstr(ratio, 4),
            "log10_ratio": mp.nstr(mp.log10(ratio) if ratio > 0 else mp.mpf("-999"), 5),
        })
        print(f"lam={lam}: d={d} rank={len(pos)} "
              f"lmax={mp.nstr(lam_max,4)} lmin+={mp.nstr(lam_min_pos,3)} "
              f"log10(min+/mean)={mp.nstr(mp.log10(ratio) if ratio>0 else -999,4)} "
              f"({time.time()-t1:.0f}s)", flush=True)

    DATA.mkdir(parents=True, exist_ok=True)
    with CSV.open("w", encoding="utf-8", newline="") as f:
        f.write(",".join(rows[0].keys()) + "\n")
        for r in rows:
            f.write(",".join(str(v) for v in r.values()) + "\n")
    meta = {
        "experiment": "E-007",
        "task": "3.1 / Q-3.4b (extended-precision positivity floor)",
        "description": "Smallest positive eigenvalue of Gabor-truncated "
                       "Weil form at dps 40, Hann window (exact FT), "
                       "T=200, bandwidths 0.5-2.0",
        "script": "research/numerics/scripts/E-007-extended-precision-floor.py",
        "parameters": {"T": T, "lambdas": list(LAMBDAS), "dps": DPS,
                       "window": "Hann (exact closed-form FT)"},
        "caveats": ["small T=200: finite-L effects larger than E-006",
                    "d > N' for lambda >= 1.5: dimensional deficiency"],
        "elapsed_seconds": round(time.time() - t0, 1),
        "timestamp_utc": datetime.now(timezone.utc).isoformat(),
        "row_count": len(rows),
    }
    JSON.write_text(json.dumps(meta, indent=2), encoding="utf-8")
    print(f"wrote {CSV.name}, {JSON.name}")
    return 0


if __name__ == "__main__":
    raise SystemExit(main())