load('http://math.uchicago.edu/~ronen/sage/triangulated_surface.sage')

#Create an L-shaped table of discriminant disc
disc = 12
[TS,K,mD,pl] = LTable(disc)
show(TS.show(),aspect_ratio=1,title='TS', frame=True) #One can simply multiply TS by a matrix in GL_2(K)
mat = matrix( [[ 2,1 ], [ 1,1 ]])
TSn = TS*mat
show(TSn.show(),aspect_ratio=1,title='TSn') #One can easily give a delaunay triangulation of TSn
TSn = TSn.delaunay()
show(TSn.show(),aspect_ratio=1,title='Delaunay triangulation of TSn') #Compute fundamental domain and generators for SL(TS) by exploring the well-girthed spine
print "\n\n ===== Exploring the well-girthed spine ===== \n\n"
load('http://math.uchicago.edu/~ronen/sage/wg_spine.sage')
wg = wg_spine(TS)
wg.explore_spine()
print "\n\n ===== Generators for SL(TS) ====== \n"
for m in wg.SL_gens:
print m,","
print "\n\n ===== Fundamental domain vertices for SL(TS) ====== \n"
print wg.fundamental_domain_verts()

===== Exploring the well-girthed spine ===== [wg_spine.explore_wg_spine] Warning: TS appears to have multiple Delaunay triangulations. This may cause problems. If TS is an L-shaped table, you should be fine. You can also try replacing TS with TS*mat for a matrix mat. Verts: 1 Edges: 0 Open edges: 3 SL gens: 0 Depth: 1.53565945799 Verts: 2 Edges: 1 Open edges: 4 SL gens: 0 Depth: 1.0 Verts: 3 Edges: 2 Open edges: 5 SL gens: 0 Depth: 1.38566416984 Verts: 3 Edges: 3 Open edges: 3 SL gens: 1 Depth: 1.53565945799 Verts: 3 Edges: 4 Open edges: 1 SL gens: 2 Depth: 5.52500506126 ======== FINISHED ========== Verts: 3 Edges: 5 Open edges: 0 SL gens: 3 ===== Generators for SL(TS) ====== [ 1 0] [-1/6*mD - 1 1] , [1 3] [0 1] , [ mD + 3 -2*mD - 3] [2/3*mD + 2 -mD - 3] , ===== Fundamental domain vertices for SL(TS) ====== [-1/2*mD, 1/2*mD - 3, 0, -1/2*mD + 3, +Infinity]
wg.spine.show(title='Well-girthed Spine') # display a graph isomorphic to the well-girthed spine
show(wg.draw_spine_H(),title='Fundamental domain for SL(TS)') # display a lift of the spine and a fundamental domain in H  