deep_regime_fp.py — src/32-dark

The file src/32-dark/deep_regime_fp.py of the validation package of the paper 32-dark, rendered with an anchor per line; the file itself is beside this page.

32-dark ledgersrc/32-dark/deep_regime_fp.py · 2.2 KBdeep_regime_fp.py
1#!/usr/bin/env python32"""Stationary Fokker-Planck check for the noisy link of deep_regime.py (32-dark, §3.2 and Prop. newton).34The link  dphi = (T - sin phi) dt + sqrt(2D) dW  (Adler / noisy Kuramoto, unit stiffness) has the5stationary density on the circle6    P(phi) ∝ exp(-U(phi)/D) * ∫_phi^{phi+2pi} exp(U(psi)/D) dpsi,   U(phi) = -T phi - cos phi,7(additive noise, so Ito and Stratonovich coincide).  The transmitted flux is <sin phi>(T); the map8(g_N = <sin phi>, g_eff = T) is the one deep_regime.py reads off its simulation.910What this shows, exactly for the chart model: the mean response is linear at small tilt11(log-slope d ln g_eff / d ln g_N = 1) at every noise level, the noise renormalising the stiffness by a12constant boost g_eff/g_N = 1/chi(D) that rises only as the tilt approaches the running threshold T -> 1.13There is no sqrt regime in the mean force at any D: the deep-regime law of §3.2 is a registration14statement (row B4), not a modification of the mean force — the content of Prop. newton and of the15gravity paper's Lemma fluxnoise.  The simulated slopes 1.03 / 1.11 of deep_regime.py are the16Euler-step and finite-sample bias on this exact 1.000.1718Run: python3 deep_regime_fp.py   (numpy only; ~10 s)19"""20import numpy as np2122def mean_sin(T, D, n=3000):23    phi = np.linspace(0, 2 * np.pi, n, endpoint=False); dphi = 2 * np.pi / n24    U = lambda x: -T * x - np.cos(x)25    P = np.empty(n)26    for i, p in enumerate(phi):27        psi = np.linspace(p, p + 2 * np.pi, n)28        P[i] = np.exp(-U(p) / D) * np.trapezoid(np.exp(U(psi) / D), psi)29    P /= P.sum() * dphi30    return float((np.sin(phi) * P).sum() * dphi)3132if __name__ == "__main__":33    tilts = np.array([0.01, 0.02, 0.04, 0.08, 0.16, 0.32])34    ok = True35    for D in (0.3, 0.6):36        flux = np.array([mean_sin(t, D) for t in tilts])37        slope = np.polyfit(np.log(flux[:3]), np.log(tilts[:3]), 1)[0]38        boost = tilts / flux39        print(f"D={D}: small-tilt log-slope d ln g_eff/d ln g_N = {slope:.4f}   boost g_eff/g_N = {np.round(boost, 3)}")40        ok &= abs(slope - 1.0) < 2e-3 and np.all(np.diff(boost) >= -1e-9)41    print("PASS: mean response Newtonian (slope 1) at every D; boost constant to rising; no sqrt regime" if ok else "FAIL")42