{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Code from the Sage notebook code_from_the_article.ipynb of [AAH18]" ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "import itertools\n", "\n", "def build_adj_dodec(sheet, pent):\n", " i = sheet;\n", " dodec_adj_base = 12*[None]\n", " dodec_adj_base[0] = [(i,1),(i,2),(i,3),(i,4),(i,5)]\n", " dodec_adj_base[1] = [(i,0),(i+1,5),(i+4,10),(i-4,9),(i-1,2)]\n", " dodec_adj_base[2] = [(i-1,3),(i,0),(i+1,1),(i-2,9),(i,8)]\n", " dodec_adj_base[3] = [(i+4,7),(i-1,4),(i,0),(i+1,2),(i+2,8)]\n", " dodec_adj_base[4] = [(i-4,7),(i-2,11),(i-1,5),(i,0),(i+1,3)]\n", " dodec_adj_base[5] = [(i+1,4),(i,11),(i+2,10),(i-1,1),(i,0)]\n", " dodec_adj_base[6] = [(i,7),(i,8),(i,9),(i,10),(i,11)]\n", " dodec_adj_base[7] = [(i,6),(i+1,11),(i+4,4),(i-4,3),(i-1,8)]\n", " dodec_adj_base[8] = [(i-1,9),(i,6),(i+1,7),(i-2,3),(i,2)]\n", " dodec_adj_base[9] = [(i+4,1),(i-1,10),(i,6),(i+1,8),(i+2,2)]\n", " dodec_adj_base[10] = [(i-4,1),(i-2,5),(i-1,11),(i,6),(i+1,9)]\n", " dodec_adj_base[11] = [(i+1,10),(i,5),(i+2,4),(i-1,7),(i,6)]\n", " prelim_adj = [dodec_adj_base[pent%12][(k+2*i)%5] for k in range(5)]\n", " return [[item[0]%10, item[1]%12] for item in prelim_adj]\n", "\n", "def double_pent_top(): #gives the list of all pentagons with horizontal base\n", " odd_array = [range(1,10,2), range(7,12) + [0]]\n", " even_array = [range(0,9,2), range(1,7)]\n", " return list(itertools.product(*odd_array)) + list(itertools.product(*even_array))\n", "\n", "def double_pent(): #gives list of 60 double pentagons\n", " return [[top,build_adj_dodec(top[0],top[1])[4]] for top in double_pent_top()]\n", "\n", "def perm_odd(abcd):\n", " top_list = double_pent_top()\n", " double_list = double_pent()\n", " bot_list = [tri[1] for tri in double_list]\n", " total = []\n", " i = 0\n", " perm_a_sub = []\n", " perm_a = []\n", " while len(total) < 55:\n", " total += perm_a_sub\n", " total.sort()\n", " if len(total) != 0:\n", " i_list = [j for j in range(len(total)) if j != total[j]]\n", " if i_list == []:\n", " i = len(total)\n", " else:\n", " i = i_list[0]\n", " perm_a_sub = []\n", " while i not in perm_a_sub:\n", " perm_a_sub += [i]\n", " i = bot_list.index(build_adj_dodec(top_list[i][0],top_list[i][1])[abcd])\n", " perm_a.append(tuple(perm_a_sub))\n", " return perm_a" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Code from Section 5" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Section 5.1: The Dodecahedron" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The following code takes the permutations derived above and generates a subgroup of S_60 isomorphic to the rotation group of the dodecahedron." ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "60" ] }, "execution_count": 2, "metadata": {}, "output_type": "execute_result" } ], "source": [ "GMon_dodec = PermutationGroup([perm_odd(1), perm_odd(2)])\n", "GMon_dodec.order()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Section 5.2: The Bolza Surface" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "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." ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [], "source": [ "def build_adj_8_3(sheet, octagon):\n", " i = sheet;\n", " oct_8_3_adj_base = 6*[None]\n", " oct_8_3_adj_base[0] = [[i,4],[i-1,3],[i-4,2],[i+2,5]]*2\n", " oct_8_3_adj_base[1] = [[i,2],[i+1,3],[i,4],[i,5]]*2\n", " oct_8_3_adj_base[2] = [[i,1],[i-1,5],[i-4,0],[i+2,3]]*2\n", " oct_8_3_adj_base[3] = [[i-1,1],[i-2,2],[i+1,0],[i,4]]*2\n", " oct_8_3_adj_base[4] = [[i,0],[i+1,5],[i,1],[i,3]]*2\n", " oct_8_3_adj_base[5] = [[i-1,4],[i-2,0],[i+1,2],[i,1]]*2\n", " prelim_adj = [oct_8_3_adj_base[octagon%6][(k-i)%8] for k in range(8)]\n", " return [[item[0]%8, item[1]%6] for item in prelim_adj]\n", "\n", "def octagons():\n", " return list(itertools.product(*[range(8), range(6)]))\n", "\n", "def perm_oct(abcd):\n", " oct_list = octagons()\n", " total = []\n", " i = 0\n", " perm_a_sub = []\n", " perm_a = []\n", " while len(total) < 46:\n", " total += perm_a_sub\n", " total.sort()\n", " if len(total) != 0:\n", " i_list = [j for j in range(len(total)) if j != total[j]]\n", " if i_list == []:\n", " i = len(total)\n", " else:\n", " i = i_list[0]\n", " perm_a_sub = []\n", " while i not in perm_a_sub:\n", " perm_a_sub += [i]\n", " i = oct_list.index(tuple(build_adj_8_3(oct_list[i][0], oct_list[i][1])[abcd]))\n", " perm_a.append(tuple(perm_a_sub))\n", " return perm_a" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The following code takes the permutations derived above and generates a subgroup of S_48 isomorphic to the rotation group of the Bolza surface." ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "48" ] }, "execution_count": 4, "metadata": {}, "output_type": "execute_result" } ], "source": [ "GMon_8_3 = PermutationGroup([perm_oct(0), perm_oct(1), perm_oct(2), perm_oct(3)])\n", "GMon_8_3.order()" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "SageMath 8.2", "language": "", "name": "sagemath" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 2 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython2", "version": "2.7.14" } }, "nbformat": 4, "nbformat_minor": 2 }