Code from the Sage notebook code_from_the_article.ipynb of [AAH18]

In [1]:
import itertools

def build_adj_dodec(sheet, pent):
    i = sheet;
    dodec_adj_base = 12*[None]
    dodec_adj_base[0] = [(i,1),(i,2),(i,3),(i,4),(i,5)]
    dodec_adj_base[1] = [(i,0),(i+1,5),(i+4,10),(i-4,9),(i-1,2)]
    dodec_adj_base[2] = [(i-1,3),(i,0),(i+1,1),(i-2,9),(i,8)]
    dodec_adj_base[3] = [(i+4,7),(i-1,4),(i,0),(i+1,2),(i+2,8)]
    dodec_adj_base[4] = [(i-4,7),(i-2,11),(i-1,5),(i,0),(i+1,3)]
    dodec_adj_base[5] = [(i+1,4),(i,11),(i+2,10),(i-1,1),(i,0)]
    dodec_adj_base[6] = [(i,7),(i,8),(i,9),(i,10),(i,11)]
    dodec_adj_base[7] = [(i,6),(i+1,11),(i+4,4),(i-4,3),(i-1,8)]
    dodec_adj_base[8] = [(i-1,9),(i,6),(i+1,7),(i-2,3),(i,2)]
    dodec_adj_base[9] = [(i+4,1),(i-1,10),(i,6),(i+1,8),(i+2,2)]
    dodec_adj_base[10] = [(i-4,1),(i-2,5),(i-1,11),(i,6),(i+1,9)]
    dodec_adj_base[11] = [(i+1,10),(i,5),(i+2,4),(i-1,7),(i,6)]
    prelim_adj = [dodec_adj_base[pent%12][(k+2*i)%5] for k in range(5)]
    return [[item[0]%10, item[1]%12] for item in prelim_adj]

def double_pent_top(): #gives the list of all pentagons with horizontal base
    odd_array = [range(1,10,2), range(7,12) + [0]]
    even_array = [range(0,9,2), range(1,7)]
    return list(itertools.product(*odd_array)) + list(itertools.product(*even_array))

def double_pent(): #gives list of 60 double pentagons
    return [[top,build_adj_dodec(top[0],top[1])[4]] for top in double_pent_top()]

def perm_odd(abcd):
    top_list = double_pent_top()
    double_list = double_pent()
    bot_list = [tri[1] for tri in double_list]
    total = []
    i = 0
    perm_a_sub = []
    perm_a = []
    while len(total) < 55:
        total += perm_a_sub
        total.sort()
        if len(total) != 0:
            i_list = [j for j in range(len(total)) if j != total[j]]
            if i_list == []:
                i = len(total)
            else:
                i = i_list[0]
        perm_a_sub = []
        while i not in perm_a_sub:
            perm_a_sub += [i]
            i = bot_list.index(build_adj_dodec(top_list[i][0],top_list[i][1])[abcd])
        perm_a.append(tuple(perm_a_sub))
    return perm_a

Code from Section 5

Section 5.1: The Dodecahedron

The following code takes the permutations derived above and generates a subgroup of S_60 isomorphic to the rotation group of the dodecahedron.

In [2]:
GMon_dodec = PermutationGroup([perm_odd(1), perm_odd(2)])
GMon_dodec.order()
Out[2]:
60

Section 5.2: The Bolza Surface

The following code generates the permutations in S_48 that generate the monodromy group given by the cover of the unfolding the Bolza surface to the regular octagon.

In [3]:
def build_adj_8_3(sheet, octagon):
    i = sheet;
    oct_8_3_adj_base = 6*[None]
    oct_8_3_adj_base[0] = [[i,4],[i-1,3],[i-4,2],[i+2,5]]*2
    oct_8_3_adj_base[1] = [[i,2],[i+1,3],[i,4],[i,5]]*2
    oct_8_3_adj_base[2] = [[i,1],[i-1,5],[i-4,0],[i+2,3]]*2
    oct_8_3_adj_base[3] = [[i-1,1],[i-2,2],[i+1,0],[i,4]]*2
    oct_8_3_adj_base[4] = [[i,0],[i+1,5],[i,1],[i,3]]*2
    oct_8_3_adj_base[5] = [[i-1,4],[i-2,0],[i+1,2],[i,1]]*2
    prelim_adj = [oct_8_3_adj_base[octagon%6][(k-i)%8] for k in range(8)]
    return [[item[0]%8, item[1]%6] for item in prelim_adj]

def octagons():
    return list(itertools.product(*[range(8), range(6)]))

def perm_oct(abcd):
    oct_list = octagons()
    total = []
    i = 0
    perm_a_sub = []
    perm_a = []
    while len(total) < 46:
        total += perm_a_sub
        total.sort()
        if len(total) != 0:
            i_list = [j for j in range(len(total)) if j != total[j]]
            if i_list == []:
                i = len(total)
            else:
                i = i_list[0]
        perm_a_sub = []
        while i not in perm_a_sub:
            perm_a_sub += [i]
            i = oct_list.index(tuple(build_adj_8_3(oct_list[i][0], oct_list[i][1])[abcd]))
        perm_a.append(tuple(perm_a_sub))
    return perm_a

The following code takes the permutations derived above and generates a subgroup of S_48 isomorphic to the rotation group of the Bolza surface.

In [4]:
GMon_8_3 = PermutationGroup([perm_oct(0), perm_oct(1), perm_oct(2), perm_oct(3)])
GMon_8_3.order()
Out[4]:
48