"""Spherical designs and twisted moments for the Platonic solids. For each of the 7 framed placements, normalized to the unit sphere, this program computes the ordered moments h(X_{i1}...X_{ik}) of the twisted coordinates X_i(x) = x_i sigma_i, with h the normalized trace, and compares them with the same moments over the twisted sphere, which are the spherical moments times the trace of the Pauli word. The degree of agreement is the design strength: 2, 3, 3, 5, 5 for the standard solids, and 3 for the others. """ import itertools from fractions import Fraction import numpy as np from solids import PLACEMENTS, placement, SIGMA def sphere_moment(alpha): """Integral of x^alpha over the unit sphere S^2, normalized area.""" if any(a % 2 for a in alpha): return 0.0 # E[x1^2a1 x2^2a2 x3^2a3] = (2a1-1)!!(2a2-1)!!(2a3-1)!! / (3*5*...*(2n+1)), n = a1+a2+a3 num = 1 for a in alpha: for j in range(1, a, 2): num *= j n = sum(alpha) den = 1 for j in range(3, n + 2, 2): den *= j return num / den def word_trace(word): m = np.eye(2, dtype=complex) for i in word: m = m @ SIGMA[i] return np.trace(m) / 2 def compare(points, kmax): pts = points / np.linalg.norm(points, axis=1)[:, None] strength = None worst = {} for k in range(1, kmax + 1): bad = 0 for word in itertools.product(range(3), repeat=k): alpha = [word.count(i) for i in range(3)] mono = np.prod(pts ** np.array(alpha), axis=1).mean() tr = word_trace(word) hX = mono * tr hA = sphere_moment(alpha) * tr if abs(hX - hA) > 1e-10: bad += 1 worst.setdefault(k, (word, hX, hA)) if bad and strength is None: strength = k - 1 return strength, worst if __name__ == "__main__": for label, _, _ in PLACEMENTS: pts, edges, faces = placement(label) strength, worst = compare(pts, 7) k = strength + 1 word, hX, hA = worst[k] print(f"{label:17s} ordered twisted moments agree up to degree {strength}; " f"first discrepancy in degree {k}, e.g. word {tuple(i + 1 for i in word)}: " f"finite {complex(hX):.6f} = {Fraction(complex(hX).real).limit_denominator(1000) if abs(complex(hX).imag) < 1e-12 else complex(hX)}, " f"sphere {hA.real:.6f}") # the table in the paper: X_1^4 for cube and octahedron, X_1^6 for icosahedron and dodecahedron for label, k in (("cube", 4), ("octahedron", 4), ("icosahedron", 6), ("dodecahedron", 6)): pts, _, _ = placement(label) pts = pts / np.linalg.norm(pts, axis=1)[:, None] v = np.mean(pts[:, 0] ** k) print(f"{label:13s} h(X_1^{k}) = {Fraction(v).limit_denominator(1000)}, sphere {Fraction(sphere_moment([k, 0, 0])).limit_denominator(1000)}") pts, _, _ = placement("tetrahedron") pts = pts / np.linalg.norm(pts, axis=1)[:, None] print("tetrahedron h(X_1X_2X_3) =", np.mean(np.prod(pts, axis=1)) * word_trace((0, 1, 2)), " i/(3 sqrt3) =", 1j / (3 * 3 ** .5))