Ask Your Question
0

Computing projection of a polyhedron

asked 2019-10-02 19:08:37 -0600

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
1

answered 2019-10-25 17:17:43 -0600

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

Comments

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 01:18:30 -0600 )edit

The following answer should give you a step by step guide: https://ask.sagemath.org/question/354...

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

Jonathan Kliem gravatar imageJonathan Kliem ( 2020-08-25 03:59:18 -0600 )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

Stats

Asked: 2019-10-02 19:08:37 -0600

Seen: 98 times

Last updated: Oct 25 '19