# Revision history [back]

Install surface_dynamics and sage-flatsurf following instructions on the

Then launch Sage and follow the

Start by importing flatsurf:

sage: import flatsurf


Say we wish to define a flat surface from a two by one rectangle with opposite sides glued together.

Start by constructing the rectangle with one of these commands:

sage: p = flatsurf.polygons((2, 0), (0, 1), (-2, 0), (0, -1))
sage: p = flatsurf.polygons(vertices=[(0, 0), (2, 0), (2, 1), (0, 1)])


Observe the result:

sage: p
Polygon: (0, 0), (2, 0), (2, 1), (0, 1)


Construct a surface dictionary:

sage: s = Surface_dict(base_ring=p.base_ring())
'A'
sage: s.change_polygon_gluings("A", [("A", (e + 2) % 4) for e in range(4)])
sage: s.change_base_label("A")
sage: s.set_immutable()
sage: s


Construct a translation surface:

sage: from flatsurf import TranslationSurface
sage: t = TranslationSurface(s)
sage: t
TranslationSurface built from 1 polygon
sage: t.plot()
Launched png viewer for Graphics object consisting of 10 graphics primitives


Check that we got a genus one surface:

sage: t.genus()
1


If we constructed a similarity surface by using a different side pairing for the gluings, we might get a genus zero surface.

Install surface_dynamics and sage-flatsurf following instructions on the

Then launch Sage and follow the

Start by importing flatsurf:

sage: import flatsurf


Say we wish to define a flat surface from a two by one rectangle with opposite sides glued together.

Start by constructing the rectangle with one of these commands:

sage: p = flatsurf.polygons((2, 0), (0, 1), (-2, 0), (0, -1))
sage: p = flatsurf.polygons(vertices=[(0, 0), (2, 0), (2, 1), (0, 1)])


Observe the result:

sage: p
Polygon: (0, 0), (2, 0), (2, 1), (0, 1)


Construct a surface dictionary:

sage: from flatsurf import Surface_dict
sage: s = Surface_dict(base_ring=p.base_ring())
'A'
sage: s.change_polygon_gluings("A", [("A", (e + 2) % 4) for e in range(4)])
sage: s.change_base_label("A")
sage: s.set_immutable()
sage: s


Construct a translation surface:

sage: from flatsurf import TranslationSurface
sage: t = TranslationSurface(s)
sage: t
TranslationSurface built from 1 polygon
sage: t.plot()
Launched png viewer for Graphics object consisting of 10 graphics primitives


Check that we got a genus one surface:

sage: t.genus()
1


If we constructed a similarity surface by using a different side pairing for the gluings, we might get a genus zero surface.

Install surface_dynamics and sage-flatsurf following instructions on the

Then launch Sage and follow the

Start by importing flatsurf:

sage: import flatsurf


Say we wish to define a flat surface from a two by one rectangle with opposite sides glued together.

Start by constructing the rectangle with one of these commands:

sage: p = flatsurf.polygons((2, 0), (0, 1), (-2, 0), (0, -1))
sage: p = flatsurf.polygons(vertices=[(0, 0), (2, 0), (2, 1), (0, 1)])


Observe the result:

sage: p
Polygon: (0, 0), (2, 0), (2, 1), (0, 1)


Construct a surface dictionary:

sage: from flatsurf import Surface_dict
sage: s = Surface_dict(base_ring=p.base_ring())
'A'
sage: s.change_polygon_gluings("A", [("A", (e + 2) % 4) for e in range(4)])
sage: s.change_base_label("A")
sage: s.set_immutable()
sage: s


Construct a translation surface:

sage: from flatsurf import TranslationSurface
sage: t = TranslationSurface(s)
sage: t
TranslationSurface built from 1 polygon
sage: t.plot()
Launched png viewer for Graphics object consisting of 10 graphics primitives


Check that we got a genus one surface:

sage: t.genus()
1


If we constructed a similarity surface by using a different side pairing for the gluings, we might get a genus zero surface.

For reference here are the versions that were used in this answer:

sage: print(version())
SageMath version 9.2.beta12, Release Date: 2020-09-06
sage: import surface_dynamics
sage: print(surface_dynamics.version.version)
0.4.4
sage: import flatsurf
sage: print(flatsurf.version.version)
0.3