Ask Your Question
1

Can the base ring of a polyhedron be restricted?

asked 2016-08-18 03:03:20 +0100

done_with_fish gravatar image

updated 2016-08-18 04:42:33 +0100

I have a polyhedron P with rational vertices

sage: A = matrix([[1,0,0],[1,0,2],[1,1,1],[1,3/2,0]])
sage: A
[  1   0   0]
[  1   0   2]
[  1   1   1]
[  1 3/2   0]
sage: P = Polyhedron(A)
sage: P
A 2-dimensional polyhedron in QQ^3 defined as the convex hull  of 4 vertices

If we scale P by a factor of two, then we get a lattice polytope.

sage: (2*P).is_lattice_polytope()
True

However, the base ring of P is still QQ

sage: (2*P).parent()
Polyhedra in QQ^3

Since 2*P is a lattice polytope it seems like it should be possible to restrict the base ring of 2*P to ZZ. Is this possible?

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
1

answered 2016-08-18 14:09:07 +0100

tmonteil gravatar image

updated 2016-08-18 14:12:44 +0100

I could not find any change_ring method or similar, but you can to the following by changing the ring of the vertices (note the transpose since the vertices are given as columns not rows):

sage: R  = Polyhedron((2*P).vertices_matrix().transpose().change_ring(ZZ))
sage: R
A 2-dimensional polyhedron in ZZ^3 defined as the convex hull of 4 vertices
sage: 2*P
A 2-dimensional polyhedron in QQ^3 defined as the convex hull of 4 vertices
sage: R == 2*P
True
edit flag offensive delete link more

Comments

Thanks for the tip. It seems like sage should automatically change the ring to ZZ whenever P is a lattice polytope.

done_with_fish gravatar imagedone_with_fish ( 2016-08-18 21:31:30 +0100 )edit
1

answered 2017-10-09 14:34:08 +0100

jipilab gravatar image

updated 2017-10-09 14:34:58 +0100

The current difference between the base ring QQ and ZZ for polyhedron objects in Sage is not quite big nor quite well defined...

A polytope (a compact polyhedron) may have all vertices with integer coordinates, so that it could be called a "Lattice polytope", but its H-representation may still contain rational numbers. Of course, it is possible to multiply all coefficients in the H-representation by a certain integer factor to get an integral H-representation, but this is not automatically done in Sage.

The tickets Add .change_ring() method for polyhedra and Add .change_backend() method for polyhedra will then make it possible to apply the desired changes on the base ring and backend, if possible.

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

1 follower

Stats

Asked: 2016-08-18 03:03:20 +0100

Seen: 420 times

Last updated: Oct 09 '17