Ask Your Question

Computing the volume of a polytope that is not full-dimensional

asked 2013-11-26 11:29:09 +0200

Samsa gravatar image

Let us assume we are given a polytope in $\mathbb{R}^d$ which is $k$-dimensional. How can we compute its $k$-dimensional volume in Sage?

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2013-12-04 06:51:26 +0200

slelievre gravatar image

I would do the following:

  1. Translate the polytope to have one vertex at the origin. This way it lives in a $k$-dimensional vector subspace, not only affine subspace.

  2. Find an orthonormal basis of this subspace.

  3. Express the polytope in that basis.

  4. Now work in $\mathbb{R}^k$ and find the volume of the polytope.

edit flag offensive delete link more

answered 2019-08-27 22:24:47 +0200

jipilab gravatar image

There is a simple way to do so directly in Sage:

sage: p = polytopes.permutahedron(4); p
A 3-dimensional polyhedron in ZZ^4 defined as the convex hull of 24 vertices

Naturally, it is lower dimensional, so its volume is zero:

sage: p.volume()

But, changing the measure to 'induced', we can directly compute the Lebesgue measure inside of the affine hull, without doing any transformation:

sage: p.volume(measure='induced')

The .volume method can use different algorithms and other measures (for example for lattice polytopes) whose performance may vary, you can check the accessible algorithms by typing p.volume? and read the documentation for more details.

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


Asked: 2013-11-26 11:29:09 +0200

Seen: 663 times

Last updated: Aug 27 '19