The script src/21-gravity/make_fig_phase_a.py of the validation package of the paper 21-grav, rendered with an anchor per line. ▶ run the predicates on Google Colab.
1"""Figure 2, panel (a): the Carrier phase cycle (Fig.~\\ref{fig:phase}).23Phi^C ~ C_156 = F_157^x with primitive generator g = 5 (order 156, verified in the quantum4companion's validate.py); the four cardinal residues 1, i, -1, -i form the quarter-turn core5Q_4; the drive advances every cell one generator step (one chronon) per step, clockwise.6Panels (b) and (c) of Figure 2 are unchanged.7"""8import pathlib, math, matplotlib9matplotlib.use("Agg")10import matplotlib.pyplot as plt11from matplotlib.patches import Circle, FancyArrowPatch12FIG = pathlib.Path(__file__).resolve().parent.parent / "figures"13plt.rcParams.update({"font.family":"serif","mathtext.fontset":"cm","figure.dpi":150})1415# sanity: 5 is a primitive root mod 157 (order 156)16def order(a,m):17 o,x=1,a%m18 while x!=1: x=(x*a)%m; o+=119 return o20assert order(5,157)==156, "5 must be a primitive root mod 157"2122fig, ax = plt.subplots(figsize=(3.4,3.4))23ax.set_aspect("equal"); ax.axis("off"); ax.set_xlim(-1.34,1.34); ax.set_ylim(-1.34,1.34)24N=15625ax.add_patch(Circle((0,0),1.0, fill=False, ec="0.72", lw=1.6, zorder=2))26for k in range(N):27 a=math.radians(90 - k*360/N)28 ax.plot([math.cos(a)*1.0, math.cos(a)*0.955],[math.sin(a)*1.0, math.sin(a)*0.955],29 color="0.6", lw=0.6, zorder=1)30cards=[(0,"$1$",(0,0.16)),(39,"$i$",(0.16,0)),(78,r"$-1$",(0,-0.18)),(117,r"$-i$",(-0.18,0))]31for k,lab,off in cards:32 a=math.radians(90 - k*360/N); x,y=math.cos(a),math.sin(a)33 ax.plot([x],[y],"o",ms=9,color="black",zorder=4)34 ax.text(x*1.18+off[0], y*1.18+off[1], lab, ha="center", va="center", fontsize=21)35ax.text(0, 0.12, r"$\Phi^{\mathrm{C}}\simeq C_{156}$", ha="center", va="center", fontsize=16)36ax.text(0,-0.13, r"$g=5$", ha="center", va="center", fontsize=16)37a1=math.radians(74); a2=math.radians(47); R=1.1338ax.add_patch(FancyArrowPatch((math.cos(a1)*R,math.sin(a1)*R),(math.cos(a2)*R,math.sin(a2)*R),39 connectionstyle="arc3,rad=-0.32", arrowstyle="-|>", mutation_scale=16,40 lw=2.4, color="#cc1133", zorder=5))41fig.savefig(str(FIG/"fig_phase_a.pdf"), bbox_inches="tight")42fig.savefig(str(FIG/"fig_phase_a.png"), bbox_inches="tight", dpi=150)43print("wrote", FIG/"fig_phase_a.pdf", " (order of 5 mod 157 = 156)")44