Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

One possibility is the following.

First create the desired transformation as a matrix.

sage: nf = QuadraticField(2)
sage: sqrt2 = nf.gen()
sage: proj_mat = matrix(nf,[[sqrt2/2,sqrt2/2],[sqrt2/2,sqrt2/2]])

Then, create your polyhedron

sage: P = Polyhedron(vertices=[(-1,-1), (1,3), (5,-2)])

One then just need to apply the transformation on each vertices of the polyhedron and take the result back to a polyhedron.

sage: Pproj = Polyhedron(vertices = (proj_mat*P.vertices_matrix()).columns())
sage: Pproj
A 1-dimensional polyhedron in (Number Field in a with defining polynomial x^2 - 2)^2 defined as the convex hull of 2 vertices
sage: Pproj.vertices_list()
[[-a, -a], [2*a, 2*a]]

Currently, projections (or other linear transformations) are not implemented better than as above...