#!/usr/bin/env python3 # -*- coding: utf-8 -*- """Fit the decision-margin law, and test it OUT OF SAMPLE against the corpus's own j=38 control. Two competing laws fit the j<=26 data equally well on a short range: (a) log-power: M ~ (log x)^p -- the form the run printed (b) power of x: M ~ x^q They disagree by orders of magnitude outside the fitted range, so the data must decide. It does: the corpus's own census (research/centered-discrepancy-measurement.md, item 3) reports at j=38 |D_y|/(control rms) = 21.816 with D_y/x = 0.001476, hence its control rms is 6.77e-5 in units of x, hence M(2^38) = (0.16 + 0.001476)/6.77e-5 = 2385 -- an INDEPENDENT measurement, made by another run at a scale this run cannot reach. Whichever law predicts it, wins. This is the out-of-sample test. It is not a fit with a free parameter at j=38: the exponent comes from j<=26 only. """ import numpy as np import sys sys.stdout.reconfigure(encoding='utf-8') # j, sigma_control/x, M(D) measured by work/decision-margin.py (64 draws, per-scale seed SEED+j) ROWS = [ (16, 0.1843, 0.743), (18, 0.1126, 1.286), (20, 0.0994, 1.451), (22, 0.0728, 2.320), (24, 0.0535, 2.874), (26, 0.0394, 4.023), ] j = np.array([r[0] for r in ROWS], dtype=float) sig = np.array([r[1] for r in ROWS]) M = np.array([r[2] for r in ROWS]) lx = np.log(2.0) * j # log x llx = np.log(lx) # log log x # (a) log-power pa = np.polyfit(llx, np.log(M), 1) Ma38 = float(np.exp(np.polyval(pa, np.log(np.log(2.0 ** 38))))) # (b) power of x pb = np.polyfit(lx, np.log(M), 1) Mb38 = float(np.exp(np.polyval(pb, np.log(2.0 ** 38)))) # the corpus's independent j=38 anchor anchor38 = (0.16 + 0.001476) / (0.001476 / 21.816) # residuals of each law inside the fitted range ra = np.log(M) - np.polyval(pa, llx) rb = np.log(M) - np.polyval(pb, lx) # per-doubling decay of the control noise, the robust local reading dec = [sig[k + 1] / sig[k] for k in range(len(sig) - 1)] gm = float(np.exp(np.mean(np.log(dec)))) print("control noise sigma/x per doubling:", ", ".join(f"{d:.3f}" for d in dec), f" -> geometric mean {gm:.4f} => sigma/x ~ x^{np.log2(gm):.3f}") print() print(f"(a) log-power law : M ~ (log x)^{pa[0]:.2f} -> predicts M(2^38) = {Ma38:8.1f}" f" in-range rms resid {ra.std():.3f}") print(f"(b) power of x : M ~ x^{pb[0]:.3f} -> predicts M(2^38) = {Mb38:8.1f}" f" in-range rms resid {rb.std():.3f}") print(f" corpus's own j=38 anchor (independent run, another scale): M(2^38) = {anchor38:8.1f}") # the LOCAL law: the per-doubling multiplier applied from the last measured point (no free fit) Mlocal38 = float(M[-1] * (1.0 / gm) ** (38 - 26)) print() print("OUT-OF-SAMPLE TEST, no free parameter fitted at j=38:") for nm, pred in (("log-power fit ", Ma38), ("power-of-x fit ", Mb38), ("local per-doubling", Mlocal38)): fac = max(pred, anchor38) / min(pred, anchor38) print(f" {nm:18s} predicts M(2^38) = {pred:9.1f} off the independent anchor by {fac:8.1f}x") print() f_a = max(Ma38, anchor38) / min(Ma38, anchor38) f_b = max(Mb38, anchor38) / min(Mb38, anchor38) f_l = max(Mlocal38, anchor38) / min(Mlocal38, anchor38) doublings_per_decade = np.log(10) / (np.log(2) * pb[0]) print("VERDICT (and it is not the one the run's own footnote guessed):") print(" * the GROWTH is settled -- the margin rises monotonically with x, by a local factor") print(f" {1/gm:.3f} per doubling, i.e. one decade of margin per {doublings_per_decade:.1f} doublings") print(f" of x ({2**doublings_per_decade:.0f}x), over the measured range 2^16..2^26;") print(f" * the LEVEL is NOT -- both closed forms fit the same {len(ROWS)} points about equally well") print(f" (rms residual {ra.std():.3f} against {rb.std():.3f}) and NEITHER extrapolates: they miss") print(f" an independent measurement by {f_a:.0f}x and {f_b:.0f}x, and even the parameter-free local") print(f" law, which is the best of the three, misses it by {f_l:.1f}x -- and it ERRORS LOW:") print(f" sigma/x decays FASTER beyond 2^26 than any fit from below can see.") print(" So the extrapolation is good to an order 10, not to an order 1, and must be reported as") print(" such. No fitted exponent from this run is quotable beyond 2^26.") print() print(f"WHAT NEEDS NO EXTRAPOLATION: the corpus's own largest run, j=38, carried a refutation") print(f"margin of order {anchor38:.0f} against the centered consumer's own requirement.") print("What more x can buy is refutation power the branch's requirement does not need -- a finite") print("census can never CONFIRM an asymptotic statement. That asymmetry is the finding.")