Macaulay2 » Documentation
Packages » Polyhedra :: volume
next | previous | forward | backward | up | index | toc

# volume -- computes the volume of a polytope

- Usage:
    `v = volume P`
- Inputs:
  - P, a convex polyhedron, , which must be compact
- Outputs:
  - v, a rational number

## Description

volume computes the volume of a polytope. To do this, it triangulates the polytope first. The volume of a simplex is |det(v_1-v_0,..,v_n-v_0)|/n!, where v_0,..,v_n are the vertices of the simplex.

    i1 : P = crossPolytope 3

    o1 = P

    o1 : Polyhedron

    i2 : volume P

         4
    o2 = -
         3

    o2 : QQ

## Ways to use volume:

- `volume(Polyhedron)`

## For the programmer

The object volume is a method function.

The source of this document is in /build/macaulay2-88fgJW/macaulay2-1.25.11+ds/M2/Macaulay2/packages/Polyhedra/documentation/old_documentation.m2:2244:0.