"""P07 C02 supplement (Claude): exact regression of the quadratic floor K >= 4/Delta. For an imaginary quadratic base t (root of A T^2 + B T + C, primitive, A > 0, Delta = 4AC - B^2), vacua of charge N are z = (p t + q)/(r t + s) with ps - qr = N. The charge-weighted separation K = N1 N2 |z1 - z2|^2 / (Im z1 Im z2) is computed here in two independent exact ways: (i) from coordinates: Re z and (Im z)^2 are rational, and |z1 - z2|^2/(Im z1 Im z2) = ((x1 - x2)^2 + y1^2 + y2^2)/(y1 y2) - 2 with y1 y2 rational; (ii) from the identity K = |X|^2/(Im t)^2, X = alpha1 beta2 - alpha2 beta1, evaluated as 4 (C u^2 - B u v + A v^2) / (A Delta) with u = A y - B x, v = A z - C x. Checks: (i) == (ii); A divides C u^2 - B u v + A v^2; K >= 4/Delta for distinct positions, for two charge conventions (every flux representative, and minimal charge per position). Positions are reduced exactly to -1/2 < Re <= 1/2, |z| >= 1 (Re >= 0 on |z| = 1). Standard library only. usage: python3 -I p07_c02s_quadratic_floor_check.py """ import itertools import math import sys from fractions import Fraction as Fr def run(name, A, B, C, L): Dl = 4 * A * C - B * B x0, n0 = Fr(-B, 2 * A), Fr(C, A) # Re t, |t|^2 imt2 = Fr(Dl, 4 * A * A) # (Im t)^2 def coords(p, q, r, s): nb = r * r * n0 + 2 * r * s * x0 + s * s # |beta|^2 re = (p * r * n0 + (p * s + q * r) * x0 + q * s) / nb a2 = (p * p * n0 + 2 * p * q * x0 + q * q) / nb # |z|^2 N = p * s - q * r y2 = N * N * imt2 / (nb * nb) # (Im z)^2 return re, a2, y2, nb def reduce(p, q, r, s): for _ in range(100000): re, a2, y2, nb = coords(p, q, r, s) k = math.ceil(re - Fr(1, 2)) if k: p, q = p - k * r, q - k * s continue if a2 < 1 or (a2 == 1 and re < 0): p, q, r, s = -r, -s, p, q continue return p, q, r, s, re, y2, nb raise RuntimeError vac = [] for N in range(1, L + 1): for d in range(1, N + 1): if N % d == 0: for b in range(d): p, q, r, s, re, y2, nb = reduce(N // d, b, 0, d) vac.append((N, p, q, r, s, re, y2, nb)) def K_pair(v, w): N1, p1, q1, r1, s1, re1, y21, nb1 = v N2, p2, q2, r2, s2, re2, y22, nb2 = w # (i) coordinates y1y2 = N1 * N2 * imt2 / (nb1 * nb2) Kc = N1 * N2 * (((re1 - re2) ** 2 + y21 + y22) / y1y2 - 2) # (ii) identity x = p1 * r2 - p2 * r1 y = p1 * s2 + q1 * r2 - p2 * s1 - q2 * r1 z = q1 * s2 - q2 * s1 u, w_ = A * y - B * x, A * z - C * x m = C * u * u - B * u * w_ + A * w_ * w_ assert m % A == 0 Ki = Fr(4 * m, A * Dl) assert Kc == Ki, (Kc, Ki) return Ki, (re1, y21) == (re2, y22) floor = Fr(4, Dl) # convention 1: every flux representative, distinct positions m1 = None for v, w in itertools.combinations(vac, 2): K, same = K_pair(v, w) if same: assert K == 0 continue assert K >= floor m1 = K if m1 is None or K < m1 else m1 # convention 2: minimal charge per position best = {} for v in vac: key = (v[5], v[6]) if key not in best or v[0] < best[key][0]: best[key] = v m2 = None for v, w in itertools.combinations(list(best.values()), 2): K, same = K_pair(v, w) assert not same and K >= floor m2 = K if m2 is None or K < m2 else m2 return ("%-16s Delta = %2d floor 4/Delta = %-5s L = %d: %4d vacua, %4d positions;" " min K (all representatives) = %-5s min K (minimal charge) = %-5s %s" % (name, Dl, floor, L, len(vac), len(best), m1, m2, "floor attained" if m2 == floor else "floor not attained in this range")) bases = [("t = i", 1, 0, 1), ("t = w", 1, 1, 1), ("t = i sqrt2", 1, 0, 2), ("t = i sqrt5", 1, 0, 5), ("(1+i sqrt7)/4", 2, -1, 1), ("(-1+i sqrt11)/6", 3, 1, 1)] lines = ["python " + sys.version.split()[0], ""] for name, A, B, C in bases: lines.append(run(name, A, B, C, 24)) lines.append("") lines.append("All pairs: coordinate value == identity value exactly; A | (C u^2 - B u v + A v^2);") lines.append("K >= 4/Delta for every pair of distinct positions under both charge conventions.") print("\n".join(lines))