I have been asked how to compute lower dimensional volumes in polymake. There is no direct method yet; so here is an example indicating a workaround:
Let's take a polytope in a hyperplane.
Code: Select all
polytope > $poly_in_hyperplane=new Polytope(POINTS=>[[1,1,0],[1,0,1]]);
We compute its (d-1)-dimensional volume (here: length of an edge) by computing the d-dimensional volume of a pyramid (here: area of a triangle).
Code: Select all
polytope > $point_outside_hyperplane=new Vector([1,0,0]);
polytope > $pyramid=new Polytope(POINTS=>$poly_in_hyperplane->VERTICES/$point_outside_hyperplane);
We need to know/compute the distance of the point to the hyperplane. Here it is natural that a square root shows up.
Code: Select all
polytope > $height=1/2 * (new QuadraticExtension(0,1,2)); # 1/2 sqrt(2)
Now reverting the volume formula for a pyramid yields the desired answer:
Code: Select all
polytope > print 2 * $pyramid->VOLUME / $height;
0+1r2
A seemingly simpler way would be to take a prism rather than a pyramid. While this might simplify some formula, it is computationally much more expensive. The reason is that volume computation uses triangulations. The triangulations of a pyramid are in correspondence with the triangulations of its base, while for prisms the triangulations always get more messy.