Ask Your Question

Translating a polygon into a fundamental domain

asked 2013-03-27 15:48:53 +0100

DrNick gravatar image


I have a polygon (defined, say, via polygon()) that I'm thinking of as filled in with some color. I'd like to understand its image on the quotient of $\mathbb{R}^2$ mod $\mathbb{Z}^2$ by seeing this image in a fundamental domain like the unit square with corners (0,0), (1,0), (0,1), (1,1).

Put differently, I want to translate (by a lattice point) each point in and on the polygon into this square and see what the result looks like.

Is there a reasonable way to do this in SAGE?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2013-03-29 07:26:31 +0100

vdelecroix gravatar image


polygon is just a function for plotting. In order to be able to solve your problem you should use Polyhedron as in

sage: P = Polyhedron(vertices=[(0,0),(1.3,2.2),(0.7,1)])
sage: P.plot()

image description

Then you compute a bounding box for your polyhderon

sage: xmin = min(x for x,y in P.vertices_list())
sage: xmax = max(x for x,y in P.vertices_list())
sage: ymin = min(y for x,y in P.vertices_list())
sage: ymax = max(y for x,y in P.vertices_list())

And for each square fundamental domain within your bounding box you compute the intersection of P with the square and store the translates:

sage: L = []
sage: for i in xrange(xmin,xmax+1):
...     for j in xrange(ymin,ymax+1):
...       K = P.intersection(Polyhedron(vertices=[(i,j),(i+1,j),(i+1,j+1),(i,j+1)]))
...       if K.dim() == 2:
...         L.append(K.translation((-i,-j)))

Then you can plot each pieces into a fundamental domain:

sage: n = len(L)
sage: colors = rainbow(n,'rgbtuple')
sage: sum((L[i].plot(color=colors[i]) for i in xrange(n)), Graphics())

image description


edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools


Asked: 2013-03-27 15:48:53 +0100

Seen: 352 times

Last updated: Mar 29 '13