Ask Your Question

Computing projection of a polyhedron

asked 2019-10-03 02:08:37 +0200

Max Alekseyev gravatar image

How to compute the projection of a given polyhedron onto a given smaller-dimensional plane?

E.g., the projection of Polyhedron(vertices=[(-1,-1), (1,3), (5,-2)]) onto the line $y=x$.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2019-10-26 00:17:43 +0200

jipilab gravatar image

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...

edit flag offensive delete link more


In sage 9.1 one can skip the third part by just multiplying the matrix with the polyhedron: proj_mat*P.

Jonathan Kliem gravatar imageJonathan Kliem ( 2020-08-24 08:18:30 +0200 )edit

The following answer should give you a step by step guide:

In particular how to obtain the matrix that induces a projection to an affine span.

Jonathan Kliem gravatar imageJonathan Kliem ( 2020-08-25 10:59:18 +0200 )edit

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


Asked: 2019-10-03 02:08:37 +0200

Seen: 420 times

Last updated: Oct 26 '19