def main_poincare_1(): for (l, m, n, maxsize) in [(5, 2, 4, 4000)]: # build the rotation group generators a, b = [g.todisc() for g in mktriangle(l, m, n)] cvs = Canvas() cvs.append(Scale(2.)) disc = Disc(cvs) z_face = 0j z_vert = (a * b).inner_fixed() gamma = Geodesic.construct(z_vert, (~a)(z_vert)) z_edge = gamma.z2 # midpoint g_face = gamma.get_refl() gamma = Geodesic.construct(z_face, z_vert) g_edge = gamma.get_refl() g_vert = Mobius.conjugate() gens = [g_face, g_edge, g_vert] gens = gens + [~g for g in gens] G = mulclose(gens, verbose=True, maxsize=maxsize) faces, edges, verts = [], [], [] for g in G: faces.append(g(z_face)) edges.append(g(z_edge)) verts.append(g(z_vert)) for g in G: disc.show_geodesic(g(z_face), g(z_vert), attrs=st_round + [grey.alpha(0.1)]) for g in G: disc.show_geodesic(g(z_face), g(z_edge), attrs=st_round + [grey]) for g in G: disc.show_geodesic(g(z_vert), g(z_edge), attrs=st_round) # for [cl, zs] in ([green, faces], [blue, edges], [red, verts]): for [cl, zs] in ([red, verts], ): for z in zs: disc.show_point(z, [cl]) disc.fini() disc.save("poincare-rotation-%d%d%d" % (l, m, n))
def render_group(l, m, n, words=[], rels=[], labels={}, name="output", maxsize=1000): # build the rotation group generators a, b = [g.todisc() for g in mktriangle(l, m, n)] assert (a.order()) == 10 # SL(2) not PSL(2) assert (b.order()) == 4 # SL(2) not PSL(2) c = (~b) * (~a) cvs = Canvas() cvs.append(Scale(4.)) disc = Disc(cvs) z_face = 0j z_vert = (a * b).inner_fixed() gamma = Geodesic.construct(z_vert, (~a)(z_vert)) z_edge = gamma.z2 # midpoint #z_tile = (1/3)*(z_face + z_edge + z_vert) z_tile = (1 / 2) * (z_face + z_vert) g_face = gamma.get_refl() gamma = Geodesic.construct(z_face, z_vert) g_edge = gamma.get_refl() g_vert = Mobius.conjugate() gens = [g_vert, ~g_vert, g_edge, ~g_edge, g_face, ~g_face] G = mulclose(gens, verbose=True, maxsize=maxsize) faces, edges, verts = [], [], [] for g in G: faces.append(g(z_face)) edges.append(g(z_edge)) verts.append(g(z_vert)) #for g in G: # disc.show_geodesic(g(z_face), g(z_vert), attrs=st_round+[grey.alpha(0.1)]) for g in G: disc.show_geodesic(g(z_face), g(z_edge), attrs=st_round + [grey]) for g in G: disc.show_geodesic(g(z_vert), g(z_edge), attrs=st_round) # for [cl, zs] in ([green, faces], [blue, edges], [red, verts]): for [cl, zs] in ([red, verts], ): for z in zs: disc.show_point(z, fill_attrs=[white], stroke_attrs=[black]) # ------------------------------------------------------ I = Mobius() gens = [a, ~a, b, ~b, c, ~c] def get(word): g = reduce(mul, [gens[i] for i in word], I) return g for word in words: g = get(word) disc.show_point(g(z_tile), [blue.alpha(0.5)]) scale = 0.4 if labels: for (word, label) in labels.items(): g = reduce(mul, [gens[w] for w in reversed(word)], I) disc.show_label(g(z_tile), label, scale) else: for (g, label) in [ (I, r"$\star$"), (a, r"$a$"), (b, r"$b$"), (c, r"$c$"), #(c**2, r"$c^2$"), #(c**3, r"$c^3$"), ]: disc.show_label(g(z_tile), label, scale) for rel in rels: g = get(reversed(rel)) disc.show_label(g(z_tile), "I", scale) disc.fini() disc.save(name)
def main_bring(): # build the rotation group generators a, b = [g.todisc() for g in mktriangle(5, 2, 5)] disc = Disc() z_face = 0j z_vert = (a * b).inner_fixed() gamma = Geodesic.construct(z_vert, (~a)(z_vert)) z_edge = gamma.z2 # midpoint g_face = gamma.get_refl() gamma = Geodesic.construct(z_face, z_vert) g_edge = gamma.get_refl() g_vert = Mobius.conjugate() gens = [g_face, g_edge, g_vert] gens = gens + [~g for g in gens] G = mulclose(gens, verbose=True, maxsize=8000) # 8000 is enough faces, edges, verts = [], [], [] for g in G: #disc.show_geodesic(g(z_face), g(z_vert), attrs=[grey]) #disc.show_geodesic(g(z_face), g(z_edge), attrs=[grey]) faces.append(g(z_face)) edges.append(g(z_edge)) verts.append(g(z_vert)) for g in G: disc.show_geodesic(g(z_vert), g(z_edge), attrs=st_round) # break #disc.show_polygon([z_face, z_edge, z_vert], st_fill=[grey]) #disc.show_point(z_vert, radius=0.1) #disc.show_point((~a)(z_vert), radius=0.1) #disc.show_point(z_edge, radius=0.1) # z1, z2 = z_vert, a(z_vert) # faces.append(0.j) # for i in range(5): # disc.show_geodesic(z1, z2) # gamma = Geodesic.construct(z1, z2) # disc.show_geodesic(0, z1) # disc.show_geodesic(0, gamma.z2) # edges.append(gamma.z2) # verts.append(gamma.z0) # #g = gamma.get_refl() # #disc.show_point(g(0)) # z1, z2 = z2, a(z2) for z in edges: disc.show_qubit(z) #for [cl, zs] in ([green, faces], [blue, edges], [red, verts]): # for z in zs: # disc.show_point(z, [cl]) I = Mobius() z = 0.j pts0 = [] for (g, label) in [ (I, "1"), (b, "6"), (a * b, "2"), (a * a * b, "3"), (a * a * a * b, "4"), (a * a * a * a * b, "5"), (b * a * b, "8"), (a * b * a * b, "10"), (a * a * b * a * b, "7"), (a * a * a * b * a * b, "9"), (a * a * a * a * b * a * b, "11"), (b * a * b * a * b, "7"), (a * b * a * b * a * b, "9"), (a * a * b * a * b * a * b, "11"), (a * a * a * b * a * b * a * b, "8"), (a * a * a * a * b * a * b * a * b, "10"), (a * b * a * a * b, "5"), (a * a * b * a * a * b, "6"), (a * a * a * b * a * a * b, "2"), (a * a * a * a * b * a * a * b, "3"), (a * a * a * a * a * b * a * a * b, "4"), (b * a * a * a * b, "3"), (a * b * a * a * a * b, "4"), (a * a * b * a * a * a * b, "5"), (a * a * a * b * a * a * a * b, "6"), (a * a * a * a * b * a * a * a * b, "2"), (b * a * a * a * a * b * a * b * a * b, "7"), (a * b * a * a * a * a * b * a * b * a * b, "9"), (a * a * b * a * a * a * a * b * a * b * a * b, "11"), (a * a * a * b * a * a * a * a * b * a * b * a * b, "8"), (a * a * a * a * b * a * a * a * a * b * a * b * a * b, "10"), (b * a * a * a * a * b * a * b, "12"), (a * b * a * a * a * a * b * a * b, "12"), (a * a * b * a * a * a * a * b * a * b, "12"), (a * a * a * b * a * a * a * a * b * a * b, "12"), (a * a * a * a * b * a * a * a * a * b * a * b, "12"), (b * a * b * a * a * a * a * b, "12"), (a * b * a * b * a * a * a * a * b, "12"), (a * a * b * a * b * a * a * a * a * b, "12"), (a * a * a * b * a * b * a * a * a * a * b, "12"), (a * a * a * a * b * a * b * a * a * a * a * b, "12"), (b * a * a * b * a * b, "10"), (a * b * a * a * b * a * b, "7"), (a * a * b * a * a * b * a * b, "9"), (a * a * a * b * a * a * b * a * b, "11"), (a * a * a * a * b * a * a * b * a * b, "8"), ]: z1 = g(z) z1 = 0.98 * z1 disc.show_label(z1, label) #pts0.append(z1) #disc.show_point(z1, [red], radius=0.02) disc.fini() disc.save("brings-curve")