plotting 3d polytope in R^4

I'm trying to plot the following polytope on the cloud:

P=Polyhedron(vertices=[[0, 1, 0, 4] , [0, 1, 1, 3] , [3, 1, 1, 0] , [3, 1, 0, 1] , [0, 3, 0, 2] , [0, 3, 1, 1] , [1, 0, 0, 4] , [1, 0, 1, 3] , [3, 0, 1, 1] , [3, 0, 0, 2] , [1, 3, 1, 0] , [1, 3, 0, 1]])
P.plot()


This is a polytope living in R^4, but in fact the sum of the coordinates of each vertex is 5, so it is a 3D polytope. In some cases, sage gives me a nice 3D view of how the polytope looks like, but in this case it gives me something that doesn't even looks convex, so it is not the right projection. I would like to know what is going on and try to solve this issue, so I appreciate ideas on how to correct this, and where to look at on the code.

edit retag close merge delete

Maybe setting projection_direction when calling the plot method could help.

( 2016-11-23 15:55:18 -0500 )edit

I tried different projection directions, and always the plot seems to have the same non-convexity issues. I guess there is something wrong with these projections.

( 2016-11-29 17:47:24 -0500 )edit

Sort by » oldest newest most voted

You can let your polytope live in its affine hull, which is 3-dimensional:

sage: P.affine_hull().plot()

more

1

The documentation of affine_hull should be more specific telling what is the output polyhedron, and in which sense it is the same as the original one. As I see, in this example it is a projection to the first 3 coordinates, but it is not similar to the original one, but only affinely equivalent.

( 2016-11-29 17:45:53 -0500 )edit