"""Generate the header graphics of the landing page (assets/hero.*, assets/og.png, assets/favicon.png). The picture is the *result of a computation*: the incidence graph of the 85 lines on the smooth quintic surface X_{-1/8} : (x3 - x4)(x1^4 - 3 x2^4) - 6 (x3 + x4) x1^2 x2^2 + x3 x4 (x4^3 + x3^3/8) = 0 of Yu--Zhu (arXiv:2609.26862v1). One vertex per line, one edge per pair of lines that meet. 1. The 85 lines are built from the explicit equations listed in Section 3 of the paper (the same transcription as artifacts/computational/check_listing_numeric.py), in 50-digit arithmetic (mpmath). Each line is a pair of linear equations; we take a basis of its solution space. 2. Checks (the script stops if one fails): * F_{-1/8} vanishes on every listed line (6 sample points each, relative residual < 1e-30); * the 85 lines are pairwise distinct (Pluecker coordinates); * two lines meet iff the 4x4 determinant of their spanning vectors vanishes; every determinant is either < 1e-40 or > 1e-3 (normalised), so the incidence relation is numerically unambiguous; * every line meets exactly 20 others (850 meeting pairs); L1 meets exactly L2, ..., L21; * the intersection matrix (L^2 = -3 on the diagonal, 1/0 off it) has rank 39 (exact rational elimination); * if magma/out/04_lines_exact.out is present, the incidence matrix equals Magma's exact one. 3. Families (computed, then asserted): L1 = V(x3, x4); the 4 lines in the plane x3 = 0; the 16 lines in the planes x4 = mu x3 with mu (mu^3 + 1/8) = 0, four through each vertex (0:0:1:mu); the 64 lines skew to L1. The four lines of a plane through L1 meet each other, lines of different planes are skew, and every skew line meets exactly one line of each of the five planes. 4. Layout: L1 in the centre; the 20 lines meeting L1 on an inner ring, the 4 lines of each plane through L1 at the corners of a square; the 64 skew lines on the outer ring. The substitution (x3, x4) -> (i x3, i x4) multiplies F_t by i, so it maps X_{-1/8} to itself; the script checks that it fixes L1 and the 20 lines meeting it and permutes the 64 skew lines in 16 cycles of length 4 (the index k of the paper's list). The k-th member of every cycle is placed in the k-th quarter of the outer ring, so this symmetry is the rotation by 90 degrees: the chords between skew lines form an exactly 4-fold symmetric pattern. 5. Colours (the page palette): L1 white, x3 = 0 amber, lines through the vertices indigo, skew lines green; an edge is a gradient between the colours of its two ends. Light is accumulated additively, so places where many edges cross glow. Run from the repository root: uv run --no-project --with numpy --with matplotlib --with pillow --with mpmath \ python -I scripts/generate_hero.py """ from __future__ import annotations import itertools import re from fractions import Fraction from pathlib import Path import mpmath as mp import numpy as np from PIL import Image, ImageDraw, ImageFont ROOT = Path(__file__).resolve().parents[1] ASSETS = ROOT / "assets" MAGMA_INCIDENCE = ROOT / "magma" / "out" / "04_lines_exact.out" # --------------------------------------------------------------------------------------------- # 1. The 85 lines of X_{-1/8}, from the explicit list in Section 3 of the paper # --------------------------------------------------------------------------------------------- mp.mp.dps = 50 I = mp.mpc(0, 1) S3 = mp.sqrt(3) R12, R18, R6 = (mp.root(x, 4) for x in (12, 18, 6)) T = mp.mpf(-1) / 8 def F(x, t=T): """The quintic form F_t of Yu--Zhu, eq. (3.1).""" x1, x2, x3, x4 = x return (x3 - x4) * (x1**4 - 3 * x2**4) - 6 * (x3 + x4) * x1**2 * x2**2 + x3 * x4 * (x4**3 - t * x3**3) def paper_lines(): """Equations (two rows of four coefficients) of L_1, ..., L_85, and the labels (j1, j2, j3, k) of the 64 skew lines. Transcribed from the display after the proof of Theorem 1.1.""" eqs, label = {}, {} eqs[1] = [[0, 0, 1, 0], [0, 0, 0, 1]] # L1 = V(x3, x4) for j1, j2, j3 in itertools.product((0, 1), repeat=3): # L2 .. L9 e1 = [0, 0, 0, 0] e1[3 - j1] = 1 # x_{4-j1} = 0 e2 = [S3 - (-1) ** (j1 + j2), -((-1) ** (j1 + j3)) * I**j2 * R12, 0, 0] eqs[2 + 4 * j1 + 2 * j2 + j3] = [e1, e2] for j1, j2 in itertools.product((0, 1), repeat=2): # L10 .. L13 eqs[10 + 2 * j2 + j1] = [[0, 0, 1, 2], [1, -((-1) ** j1) * I * (I * S3) ** j2, 0, 0]] for j1, j3 in itertools.product((0, 1), repeat=2): # L14 .. L21 eqs[14 + 2 * j1 + j3] = [[0, 0, -(1 - I * S3), 4], [R12 + (-1) ** j3 * (1 - I), -((-1) ** j1) * ((-1) ** j3 * R12 - (1 + I) * S3), 0, 0]] eqs[18 + 2 * j1 + j3] = [[0, 0, -(1 + I * S3), 4], [R12 - (-1) ** (j1 + j3) * (1 + I), ((-1) ** j3 * R12 + (-1) ** j1 * (1 - I) * S3), 0, 0]] for j1, j2, j3, k in itertools.product((0, 1), (0, 1), (0, 1), range(4)): # L22 .. L85 n = 22 + 16 * j1 + 40 * j2 + 4 * j3 + k c = I ** (k + (1 - j2) * (1 - j3)) * (I - 1) rhs = c * R6 * ((-1) ** j2 * R12 + (-1) ** j3 * I ** (1 - j2) * (S3 - (-1) ** j2)) eqs[n] = [[2 * R18 * (-1) ** j1, -2 * R18 * (-1) ** (j2 + j3) * I, -c, -2 * c], [4 * (-1) ** j1 * (S3 + (-1) ** j2), 4 * I**j2 * R12, -rhs, 0]] label[n] = ("A", j1, j2, j3, k) n = 30 + 16 * j1 + 24 * j2 + 4 * j3 + k c1 = I ** (k + j2 * (1 - j3)) * R6 c2 = I ** (k + j2 * (3 - j3)) * R6 eqs[n] = [[2 * (-1) ** (j1 + j3) * S3, 6 * (-1) ** j2, -c1, -2 * c1], [(-1) ** j1 * ((-I) ** j2 * R12 + (-1) ** j3 * (1 + (-1) ** j2 * S3)), ((-1) ** j3 * (-I) ** j2 * R12 + 3 - (-1) ** j2 * S3), -c2, 0]] label[n] = ("B", j1, j2, j3, k) assert sorted(eqs) == list(range(1, 86)) and sorted(label) == list(range(22, 86)) return eqs, label def kernel_basis(rows): """Two vectors spanning the kernel of a 2x4 matrix (pivot on the largest 2x2 minor).""" M = mp.matrix(rows) p, q, d = max(((p, q, M[0, p] * M[1, q] - M[0, q] * M[1, p]) for p, q in itertools.combinations(range(4), 2)), key=lambda z: abs(z[2])) assert abs(d) > mp.mpf(10) ** -20, "equations of rank < 2" basis = [] for f in (c for c in range(4) if c not in (p, q)): v = [mp.mpc(0)] * 4 v[f] = mp.mpc(1) b0, b1 = -M[0, f], -M[1, f] v[p] = (b0 * M[1, q] - b1 * M[0, q]) / d v[q] = (M[0, p] * b1 - M[1, p] * b0) / d basis.append(v) return basis def plucker(B): u, v = B p = [u[i] * v[j] - u[j] * v[i] for i, j in itertools.combinations(range(4), 2)] nrm = mp.sqrt(sum(abs(z) ** 2 for z in p)) return [z / nrm for z in p] def pluecker_pairing(p, q): """det(u, v, u', v') in terms of the Pluecker vectors (order 01, 02, 03, 12, 13, 23).""" return p[0] * q[5] - p[1] * q[4] + p[2] * q[3] + p[3] * q[2] - p[4] * q[1] + p[5] * q[0] def det3(M): return (M[0][0] * (M[1][1] * M[2][2] - M[1][2] * M[2][1]) - M[0][1] * (M[1][0] * M[2][2] - M[1][2] * M[2][0]) + M[0][2] * (M[1][0] * M[2][1] - M[1][1] * M[2][0])) def same_line(P, Q, tol=mp.mpf(10) ** -30): k = max(range(6), key=lambda i: abs(P[i])) lam = Q[k] / P[k] return max(abs(Q[i] - lam * P[i]) for i in range(6)) < tol def exact_rank(rows): """Rank over Q of an integer matrix (Gaussian elimination with Fractions).""" M = [[Fraction(x) for x in r] for r in rows] rank, ncol = 0, len(M[0]) for col in range(ncol): piv = next((r for r in range(rank, len(M)) if M[r][col] != 0), None) if piv is None: continue M[rank], M[piv] = M[piv], M[rank] for r in range(len(M)): if r != rank and M[r][col] != 0: f = M[r][col] / M[rank][col] M[r] = [a - f * b for a, b in zip(M[r], M[rank])] rank += 1 return rank def magma_incidence(): """The exact incidence matrix printed by magma/04_lines_exact.m, if available.""" if not MAGMA_INCIDENCE.exists(): return None rows = re.findall(r"^\s*(\d+) ([01]{85})\s*$", MAGMA_INCIDENCE.read_text(), re.M) if len(rows) != 85 or [int(n) for n, _ in rows] != list(range(1, 86)): print(" (Magma transcript present but not in the expected format: cross-check skipped)") return None return np.array([[int(c) for c in s] for _, s in rows], dtype=np.int64) def compute_configuration(): """Lines, checks, incidence matrix, families and the 4-fold symmetry used by the layout.""" eqs, label = paper_lines() bases = {n: kernel_basis(rows) for n, rows in eqs.items()} # (a) every listed line lies on X_{-1/8} samples = [(1, 0), (0, 1), (1, 1), (1, 2), (2, -3), (mp.mpf("0.3"), mp.mpf("-1.7"))] for n, (u, v) in bases.items(): for a, b in samples: x = [a * u[i] + b * v[i] for i in range(4)] res = abs(F(x)) / max(1, max(abs(c) for c in x)) ** 5 assert res < mp.mpf(10) ** -30, f"L{n} is not on X_(-1/8): residual {mp.nstr(res, 5)}" # (b) pairwise distinct P = {n: plucker(B) for n, B in bases.items()} for m, n in itertools.combinations(range(1, 86), 2): assert not same_line(P[m], P[n]), f"L{m} = L{n}" # (c) incidence: L, L' meet iff det(u, v, u', v') = 0. With Pluecker vectors p, q this # determinant is the Pluecker pairing p01 q23 - p02 q13 + p03 q12 + p12 q03 - p13 q02 + p23 q01; # we use unit Pluecker vectors, so the value is scale-free. A = np.zeros((85, 85), dtype=np.int64) smallest_nonzero, largest_zero = mp.inf, mp.mpf(0) for m, n in itertools.combinations(range(1, 86), 2): d = abs(pluecker_pairing(P[m], P[n])) if d < mp.mpf(10) ** -40: A[m - 1, n - 1] = A[n - 1, m - 1] = 1 largest_zero = max(largest_zero, d) else: smallest_nonzero = min(smallest_nonzero, d) assert smallest_nonzero > mp.mpf(10) ** -3, "incidence not numerically clear-cut" deg = A.sum(axis=1) assert set(deg.tolist()) == {20}, f"degrees {sorted(set(deg.tolist()))}" assert A.sum() // 2 == 850 assert [n + 1 for n in np.flatnonzero(A[0])] == list(range(2, 22)), "lines meeting L1" rank = exact_rank((A - 3 * np.eye(85, dtype=np.int64)).tolist()) assert rank == 39, f"rank of the intersection matrix {rank}" M = magma_incidence() magma_ok = None if M is not None: assert (M == A).all(), "incidence differs from Magma's exact computation" magma_ok = True # (d) families. A line meeting L1 spans with L1 the plane x4 = mu x3 (or x3 = 0, "mu = inf"): # read mu off a spanning vector with (x3, x4) != (0, 0). The 4 lines of each such plane # pass through its vertex (0:0:1:mu), resp. (0:0:0:1), and meet each other. planes: list[tuple[object, list[int]]] = [] # (mu or None for x3 = 0, lines) for n in range(2, 22): u, v = bases[n] w = max((u, v), key=lambda z: abs(z[2]) + abs(z[3])) mu = None if abs(w[2]) < mp.mpf(10) ** -30 else w[3] / w[2] if mu is not None: assert abs(mu * (mu**3 - T)) < mp.mpf(10) ** -30, f"L{n}: mu (mu^3 - t) != 0" for key, group in planes: if (key is None and mu is None) or (key is not None and mu is not None and abs(key - mu) < 1e-30): group.append(n) break else: planes.append((mu, [n])) assert sorted(len(g) for _, g in planes) == [4] * 5, planes for mu, group in planes: vertex = [0, 0, 0, 1] if mu is None else [0, 0, 1, mu] for n in group: assert rank3(*bases[n], vertex) == 2, f"L{n} misses its vertex" for a, b in itertools.combinations(group, 2): assert A[a - 1, b - 1] == 1 assert [g for mu, g in planes if mu is None] == [[6, 7, 8, 9]] # the plane x3 = 0 skew = list(range(22, 86)) assert all(A[0, n - 1] == 0 for n in skew) for n in skew: # a skew line meets exactly one line of each plane assert all(sum(A[n - 1, q - 1] for q in group) == 1 for _, group in planes) for a, b in itertools.combinations(range(1, 22), 2): # lines of different planes are skew same_plane = any(a in g and b in g for _, g in planes) or 1 in (a, b) assert A[a - 1, b - 1] == (1 if same_plane else 0) # (e) the symmetry iota: (x1, x2, x3, x4) -> (x1, x2, i x3, i x4); F_t(iota x) = i F_t(x). x = [mp.mpf("0.7"), mp.mpf("-1.3"), mp.mpf("0.4"), mp.mpf("2.1")] assert abs(F([x[0], x[1], I * x[2], I * x[3]]) - I * F(x)) < 1e-40 def iota(B): return [[w[0], w[1], I * w[2], I * w[3]] for w in B] image = {} for n in range(1, 86): Pn = plucker(iota(bases[n])) hits = [m for m in range(1, 86) if same_line(Pn, P[m])] assert len(hits) == 1 image[n] = hits[0] assert all(image[n] == n for n in range(1, 22)), "iota fixes L1 and the 20 lines meeting it" for n in skew: # iota decreases k by 1 (mod 4) fam, j1, j2, j3, k = label[n] fam2, *rest = label[image[n]] assert (fam2, *rest[:3]) == (fam, j1, j2, j3) and rest[3] == (k - 1) % 4 perm = np.array([image[n] - 1 for n in range(1, 86)]) assert (A[np.ix_(perm, perm)] == A).all() # an automorphism of the graph for n in skew: # so a cycle has one set of neighbours assert (A[n - 1, :21] == A[image[n] - 1, :21]).all() # among L1, ..., L21 return dict(A=A, label=label, planes=planes, magma_ok=magma_ok, smallest_nonzero=smallest_nonzero, largest_zero=largest_zero) def rank3(u, v, w): """Numerical rank (2 or 3) of three vectors of C^4 (all 3 x 3 minors).""" best = max(abs(det3([[z[c] for c in cols] for z in (u, v, w)])) for cols in itertools.combinations(range(4), 3)) return 2 if best < mp.mpf(10) ** -30 else 3 # --------------------------------------------------------------------------------------------- # 2. Layout: L1 in the centre, the 20 lines meeting L1 on an inner ring, the 64 skew lines on the # outer ring (the k-th member of every iota-cycle in the k-th quarter) # --------------------------------------------------------------------------------------------- FAMILY_COLOURS = { # the page palette (CSS: --warn, accent, --thm), lightened "L1": (0.97, 0.98, 1.00), # for light on a dark background "x3=0": (245 / 255, 158 / 255, 11 / 255), # amber #f59e0b "vertex": (129 / 255, 140 / 255, 248 / 255), # indigo #818cf8 "skew": (16 / 255, 185 / 255, 129 / 255), # green #10b981 } def layout(C): """Unit-disc positions (outer ring radius 1) and family of each line, indexed 0..84.""" A, label, planes = C["A"], C["label"], C["planes"] family = ["L1"] + ["?"] * 84 pos = np.zeros((85, 2)) # inner ring: the five planes through L1, in the order x3 = 0, x4 = 0, then the three # planes x4 = mu x3 with mu^3 = t; inside a plane the lines in the paper's order. def plane_rank(mu): # x3 = 0, x4 = 0, then mu^3 = t by argument if mu is None: return (0, 0.0) if abs(mu) < 1e-30: return (1, 0.0) return (2, float(mp.arg(mu) % (2 * mp.pi))) order = sorted(planes, key=lambda p: plane_rank(p[0])) r_in = INNER_RADIUS for g, (mu, group) in enumerate(order): for m, n in enumerate(group): family[n - 1] = "x3=0" if mu is None else "vertex" if INNER_STYLE == "squares": # the 4 lines of a plane at the corners of a square ang = 2 * np.pi * (5 * m + g) / 20 else: # the 4 lines of a plane next to each other ang = 2 * np.pi * (g + (m - 1.5) * INNER_SPREAD) / 5 pos[n - 1] = r_in * np.array([np.cos(ang + INNER_PHASE), np.sin(ang + INNER_PHASE)]) # outer ring: the 16 iota-cycles {k = 0, 1, 2, 3}. A cycle meets exactly one line in each # plane through L1; order the cycles in a quarter by the line they meet in the plane x4 = 0, # then by the line in the plane x4 = -x3/2 (this is a bijection onto 4 x 4 slots). first = next(g for mu, g in planes if mu is not None and abs(mu) < 1e-30) # x4 = 0 second = next(g for mu, g in planes if mu is not None and abs(mu + 0.5) < 1e-30) # x4 = -x3/2 cycles: dict[tuple, list[int]] = {} for n, (fam, j1, j2, j3, k) in label.items(): cycles.setdefault((fam, j1, j2, j3), [None] * 4)[k] = n slots = {} for key, members in cycles.items(): n0 = members[0] a = next(i for i, q in enumerate(first) if A[n0 - 1, q - 1]) b = next(i for i, q in enumerate(second) if A[n0 - 1, q - 1]) slots[key] = OUTER_ORDER(a, b) assert sorted(slots.values()) == list(range(16)), "slots are not a bijection" for key, members in cycles.items(): for k, n in enumerate(members): family[n - 1] = "skew" ang = OUTER_PHASE - 2 * np.pi * (16 * k + slots[key] + 0.5) / 64 pos[n - 1] = [np.cos(ang), np.sin(ang)] assert "?" not in family return pos, family INNER_RADIUS = 0.40 INNER_STYLE = "squares" # or "clusters" INNER_SPREAD = 0.16 # (clusters only) INNER_PHASE = np.pi / 2 # the plane x3 = 0 at the top, right, bottom, left OUTER_PHASE = np.pi / 2 OUTER_ORDER = lambda a, b: 4 * a + b # noqa: E731 slot of the cycle meeting line a of x4 = 0, b of x4 = -x3/2 # --------------------------------------------------------------------------------------------- # 3. Rendering: additive light, accumulated along every edge, then glow and tone mapping # --------------------------------------------------------------------------------------------- BG = np.array([11, 16, 32], dtype=float) / 255 # the navy of the page header def deposit(acc, pts, cols, w): """Bilinear splat of weighted coloured points into acc (H x W x 3).""" H, Wd, _ = acc.shape flat = acc.reshape(-1, 3) # a view: acc is C-contiguous x, y = pts[:, 0], pts[:, 1] x0, y0 = np.floor(x).astype(np.int64), np.floor(y).astype(np.int64) fx, fy = x - x0, y - y0 for dx, dy, ww in ((0, 0, (1 - fx) * (1 - fy)), (1, 0, fx * (1 - fy)), (0, 1, (1 - fx) * fy), (1, 1, fx * fy)): xi, yi = x0 + dx, y0 + dy ok = (xi >= 0) & (xi < Wd) & (yi >= 0) & (yi < H) idx = yi[ok] * Wd + xi[ok] wt = (w * ww)[ok] for c in range(3): flat[:, c] += np.bincount(idx, weights=wt * cols[ok, c], minlength=H * Wd) def bezier_samples(P, Q, ctrl, spacing): """Sample points along quadratic Bezier curves; returns points, curve parameter, edge index and the arc length carried by each sample.""" lengths = np.linalg.norm(P - ctrl, axis=1) + np.linalg.norm(ctrl - Q, axis=1) n = np.maximum(8, (lengths / spacing).astype(np.int64)) e = np.repeat(np.arange(len(P)), n) s = (np.arange(n.sum()) - np.repeat(np.cumsum(n) - n, n) + 0.5) / np.repeat(n, n) p0, c, p1 = P[e], ctrl[e], Q[e] pts = ((1 - s) ** 2)[:, None] * p0 + (2 * (1 - s) * s)[:, None] * c + (s**2)[:, None] * p1 speed = np.linalg.norm(2 * (1 - s)[:, None] * (c - p0) + 2 * s[:, None] * (p1 - c), axis=1) return pts, s, e, speed / np.repeat(n, n) def polar_samples(r0, a0, r1, a1, bulge, centre, scale, spacing): """Curves in polar coordinates around `centre`: the angle runs linearly from a0 to a1, the radius from r0 to r1 plus bulge * sin(pi s). Radii in units of `scale` pixels.""" approx = scale * (np.abs(r1 - r0) + np.abs(a1 - a0) * np.maximum(r0, r1) + 2 * np.abs(bulge)) n = np.maximum(8, (approx / spacing).astype(np.int64)) e = np.repeat(np.arange(len(r0)), n) s = (np.arange(n.sum()) - np.repeat(np.cumsum(n) - n, n) + 0.5) / np.repeat(n, n) r = (1 - s) * r0[e] + s * r1[e] + bulge[e] * np.sin(np.pi * s) a = (1 - s) * a0[e] + s * a1[e] pts = centre + scale * np.stack([r * np.cos(a), -r * np.sin(a)], axis=1) seg = np.zeros(len(s)) d = np.linalg.norm(np.diff(pts, axis=0), axis=1) same = e[1:] == e[:-1] seg[1:][same] = d[same] first = np.r_[True, ~same] seg[first] = np.r_[d, 0][first] # first sample of a curve: use the next step return pts, s, e, seg def splat(acc, pts, s, e, ds, C0, C1, weight, chunk=3_000_000): """Deposit colour (C0 -> C1 along each curve) times weight per unit length.""" for a in range(0, len(s), chunk): b = min(len(s), a + chunk) ee, ss = e[a:b], s[a:b] cols = (1 - ss)[:, None] * C0[ee] + ss[:, None] * C1[ee] deposit(acc, pts[a:b], cols, weight[ee] * ds[a:b]) def box_blur(img, r): if r < 1: return img out = img for axis in (0, 1): c = np.cumsum(out, axis=axis, dtype=np.float64) pad = [(0, 0)] * img.ndim pad[axis] = (r + 1, r) c = np.pad(c, pad, mode="edge") n = out.shape[axis] hi = np.take(c, np.arange(2 * r + 1, 2 * r + 1 + n), axis=axis) lo = np.take(c, np.arange(0, n), axis=axis) out = ((hi - lo) / (2 * r + 1)).astype(np.float32) return out def gauss_blur(img, sigma): """Three box blurs ~ a Gaussian of standard deviation sigma.""" r = max(1, int(round((np.sqrt(4 * sigma**2 + 1) - 1) / 2))) # 3 passes of radius r: var = r(r+1) for _ in range(3): img = box_blur(img, r) return img def render(C, width, height, centre, radius, ss=2, gain=1.0, node_scale=1.0, line_weight=1.0, glow=1.0, background_glow=True, style=None, glow_radius=1.3, glow_strength=1.0): """Float RGB image (values in [0, 1]) of size height x width; the outer ring has the given radius (pixels) and centre.""" st = dict(STYLE, **(style or {})) pos, family = layout(C) A = C["A"] W, H = width * ss, height * ss cen = np.array(centre, dtype=float) * ss R = radius * ss XY = cen + R * pos * np.array([1.0, -1.0]) rad = np.linalg.norm(pos, axis=1) ang = np.arctan2(pos[:, 1], pos[:, 0]) col = np.array([FAMILY_COLOURS[f] for f in family]) acc = np.zeros((H, W, 3), dtype=np.float32) spacing = 0.45 E = np.array([(a, b) for a in range(85) for b in range(a + 1, 85) if A[a, b]]) fa = np.array([family[a] for a, _ in E]) fb = np.array([family[b] for _, b in E]) w0 = 0.11 * line_weight * ss def draw(sel, kind, weight, bulge=0.0, bend=0.0): a, b = E[sel, 0], E[sel, 1] if kind == "bezier": P, Q = XY[a], XY[b] mid = (P + Q) / 2 ctrl = mid + bend * (cen - mid) pts, sp, e, ds = bezier_samples(P, Q, ctrl, spacing) else: # polar: angle interpolated the short way round a0, a1 = ang[a], ang[b] d = (a1 - a0 + np.pi) % (2 * np.pi) - np.pi d[np.isclose(np.abs(d), np.pi)] = np.pi bul = bulge if np.ndim(bulge) else np.full(len(a), bulge) pts, sp, e, ds = polar_samples(rad[a], a0, rad[b], a0 + d, bul, cen, R, spacing) splat(acc, pts, sp, e, ds, col[a], col[b], np.full(len(a), weight * w0)) spokes = (fa == "L1") | (fb == "L1") inner_pair = np.isin(fa, ["x3=0", "vertex"]) & np.isin(fb, ["x3=0", "vertex"]) skew_pair = (fa == "skew") & (fb == "skew") cross = ~(spokes | inner_pair | skew_pair) draw(spokes, "bezier", st["w_spoke"]) a, b = E[inner_pair, 0], E[inner_pair, 1] dang = np.abs((ang[b] - ang[a] + np.pi) % (2 * np.pi) - np.pi) draw(inner_pair, "polar", st["w_inner"], bulge=st["inner_bulge"] * (0.35 + dang / np.pi)) draw(cross, st["cross"], st["w_cross"], bulge=0.0, bend=st["cross_bend"]) draw(skew_pair, "bezier", st["w_skew"], bend=st["skew_bend"]) # nodes: a bright core, a small white centre and a soft halo (sizes in output pixels) k = ss * node_scale * radius / 460 for i in range(85): size = {"L1": 1.7, "x3=0": 1.25, "vertex": 1.25, "skew": 1.0}[family[i]] sc, sh, sw = 1.55 * size * k, 4.2 * size * k, 0.75 * size * k x0, y0 = XY[i] win = int(4 * sh) + 2 x_lo, x_hi = max(0, int(x0) - win), min(W, int(x0) + win) y_lo, y_hi = max(0, int(y0) - win), min(H, int(y0) + win) yy, xx = np.mgrid[y_lo:y_hi, x_lo:x_hi] d2 = (xx - x0) ** 2 + (yy - y0) ** 2 lum = 2.2 * np.exp(-d2 / (2 * sc**2)) + 0.16 * np.exp(-d2 / (2 * sh**2)) acc[y_lo:y_hi, x_lo:x_hi] += lum[..., None] * col[i] + (0.9 * np.exp(-d2 / (2 * sw**2)))[..., None] # down-sample (anti-aliasing), glow, tone mapping light = acc.reshape(height, ss, width, ss, 3).mean(axis=(1, 3)) g1 = gauss_blur(light, 1.6 * radius / 460) g2 = gauss_blur(light, 14 * radius / 460) light = light + glow * (st["glow_near"] * g1 + st["glow_far"] * g2) light = 1.0 - np.exp(-gain * light) img = np.broadcast_to(BG, (height, width, 3)).copy() if background_glow: y, x = np.mgrid[0:height, 0:width] r2 = ((x - centre[0]) ** 2 + (y - centre[1]) ** 2) / (glow_radius * radius) ** 2 img += glow_strength * np.exp(-r2)[..., None] * np.array([0.035, 0.045, 0.10]) return 1.0 - (1.0 - img) * (1.0 - light) # screen blend # edge classes: spokes (L1 - lines meeting it), inner arcs (two lines in one plane through L1, drawn # as arcs outside the inner ring), cross curves (line meeting L1 - skew line, a spiral running the # short way round), skew chords (two skew lines, bundled towards the centre) STYLE = dict(w_spoke=1.6, w_inner=1.3, w_cross=0.9, w_skew=0.55, inner_bulge=0.16, cross="polar", cross_bend=0.0, skew_bend=0.8, glow_near=0.5, glow_far=1.4) def fade_left(img, start, end): """Blend the left part of the picture into the header navy (smoothstep on [start, end]).""" w = img.shape[1] t = np.clip((np.arange(w) / (w - 1) - start) / (end - start), 0.0, 1.0) alpha = (t * t * (3 - 2 * t))[None, :, None] return BG + (img - BG) * alpha def to_uint8(img, seed=0): """Quantise with dithering (no banding in the dark gradients).""" rng = np.random.default_rng(seed) return np.clip(255 * img + rng.uniform(-0.5, 0.5, img.shape), 0, 255).round().astype(np.uint8) # --------------------------------------------------------------------------------------------- # 4. The three files # --------------------------------------------------------------------------------------------- def find_font(size): for name in ("/System/Library/Fonts/Supplemental/Arial Unicode.ttf", "/System/Library/Fonts/Helvetica.ttc", "/Library/Fonts/Arial Unicode.ttf", "DejaVuSans.ttf"): try: return ImageFont.truetype(name, size) except OSError: continue return ImageFont.load_default() def main(): ASSETS.mkdir(exist_ok=True) C = compute_configuration() print("85 lines of X_{-1/8} from the paper's list (50 digits): all on the surface, pairwise distinct") print("incidence: every line meets exactly 20 others, 850 meeting pairs; L1 meets L2..L21") print(f" |det| of meeting pairs <= {mp.nstr(C['largest_zero'], 3)}, of skew pairs >= {mp.nstr(C['smallest_nonzero'], 3)}") print("intersection matrix (diagonal -3): rank 39 (exact)") print("families: 1 + 4 (x3 = 0) + 16 (through the vertices (0:0:1:mu), mu^4 = t mu) + 64 skew") print("each skew line meets exactly one line in each of the 5 planes through L1") print("iota: (x3, x4) -> (i x3, i x4) fixes L1..L21, permutes the skew lines in 16 four-cycles") print("Magma cross-check (magma/out/04_lines_exact.out):", "incidence identical" if C["magma_ok"] else "transcript not available, skipped") # 1) page header, 2000 x 1250. The page shows the image with object-fit: cover, anchored at # the LEFT edge, in a box of about 41 % of the header width, so on common screens only the # left 45-80 % of the frame is visible: the graph sits in the left half, and only a narrow # strip at the left edge is blended into the header navy. hero = render(C, 2000, 1250, centre=(550, 625), radius=415, ss=2, line_weight=2.0, gain=1.2, glow_radius=0.95, glow_strength=0.7) hero = Image.fromarray(to_uint8(fade_left(hero, 0.0, 0.06))) hero.save(ASSETS / "hero.jpg", quality=88, optimize=True, progressive=True) hero.save(ASSETS / "hero.webp", quality=84, method=6) # 2) social preview (Open Graph), 1200 x 630, with the title og = render(C, 1200, 630, centre=(935, 315), radius=250, ss=2, line_weight=2.0 * 250 / 460 * 1.25, gain=1.2) og = Image.fromarray(to_uint8(og)).convert("RGBA") shade = Image.new("RGBA", og.size, (0, 0, 0, 0)) ds = ImageDraw.Draw(shade) for x in range(760): # darken the left part under the text a = int(235 * (1 - x / 760) ** 1.1) ds.line([(x, 0), (x, og.size[1])], fill=(11, 16, 32, a)) og = Image.alpha_composite(og, shade) d = ImageDraw.Draw(og) d.text((64, 150), "A smooth quintic surface", font=find_font(50), fill=(248, 250, 252)) d.text((64, 212), "with 85 lines and", font=find_font(50), fill=(248, 250, 252)) d.text((64, 274), "Picard number 43", font=find_font(50), fill=(248, 250, 252)) d.text((64, 366), "SFARA seminar · WMI UAM · 19 November 2026", font=find_font(26), fill=(148, 163, 184)) d.text((64, 408), "Yu–Zhu, arXiv:2609.26862", font=find_font(26), fill=(148, 163, 184)) d.text((64, 450), "mathematics · Magma · Lean", font=find_font(26), fill=(129, 140, 248)) og.convert("RGB").save(ASSETS / "og.png", optimize=True) # 3) favicon, 128 x 128: the whole graph, small icon = render(C, 128, 128, centre=(64, 64), radius=57, ss=4, line_weight=2.0 * 57 / 460 * 2.2, node_scale=1.6, background_glow=False) Image.fromarray(to_uint8(icon)).save(ASSETS / "favicon.png", optimize=True) for name in ("hero.jpg", "hero.webp", "og.png", "favicon.png"): print(f"{name:12s} {(ASSETS / name).stat().st_size / 1024:8.1f} KiB") if __name__ == "__main__": main()