# -*- coding: utf-8 -*- """M1, the nu-mass profile, exactly. K_L(theta) = (1/L)(sin(pi L theta)/sin(pi theta))^2 is the Fejer kernel of the bump, and sum_{nu mod n} K_L(nu/n) e(-nu c/n) = n phi_n(c) so the total nu-mass at modulus n is M_n = n*phi_n(0) - L (K_L(0) = L, exact closed form). The fraction inside the published critical scale sqrt(n) is F(n) = 2 * sum_{1 <= nu <= sqrt n} K_L(nu/n) / M_n (exact, direct summation). The support scale is |nu| ~ n/L, so the exact threshold is n = L^2. """ import importlib.util, json, math, sys, time sys.stdout.reconfigure(encoding='utf-8') spec = importlib.util.spec_from_file_location('km', 'work/kl-measure.py') km = importlib.util.module_from_spec(spec) spec.loader.exec_module(km) def F(L, n, cap=None): Mn = n * km.phi0(L, n) - L T = min(math.isqrt(n), n // 2) if cap: T = min(T, cap) s = 0.0 for nu in range(1, T + 1): s += km.fejer(L, n, nu) return 2 * s / Mn, Mn out = {} for x in (11, 13): L, y = km.LV[x] rows = [] for num, den in ((1, 64), (1, 16), (1, 4), (1, 1), (4, 1), (16, 1), (64, 1)): n = max(2, int(L * L * num / den)) f, Mn = F(L, n) rows.append(dict(n=n, n_over_L2=n / (L * L), F=f, mass=Mn, inv_F=(1 / f if f else None), sqrtn=math.isqrt(n))) out[x] = dict(L=L, y=y, rows=rows) print("x=%s L=%s sqrt(L)=%.0f" % (x, L, math.sqrt(L))) for r in rows: print(" n/L^2=%-6.4f n=%-14d sqrt n=%-9d mass=%.4g F(within sqrt n)=%.9f 1/(1-F)=%.3e" % (r['n_over_L2'], r['n'], r['sqrtn'], r['mass'], r['F'], (1 / (1 - r['F']) if r['F'] < 1 else float('inf')))) print() # the modulus mass actually present, from the band measurement: how much of the object sits # where n <= L^2 at all for x in (19, 23): L, y = km.LV[x] print("x=%s L=%d y=%d L^2=%.4g L*ln^2 y=%.4g ratio L^2/(L ln^2 y)=%.3g" % (x, L, y, L * L, L * math.log(y) ** 2, L / math.log(y) ** 2)) json.dump(out, open('work/m1.json', 'w'), indent=1) print("written work/m1.json")