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()
0
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')
32
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.