Contents

# Operators and functions for type POLYHEDRON

&<
```&<(P1::POLYHEDRON, P2::POLYHEDRON)::boolean
&>(P2::POLYHEDRON, P1::POLYHEDRON)::boolean
P1 &< P2
P2 &> P1
```

Test whether P1 is strictly contained in P2. Both polyhedra must lie in the same ambient space.

Contrary to the Maple comparison operators, this functions directly returns a boolean value. Hence there is no need to apply evalb.

Examples
 emptypolyhedron(1) &< fullpolyhedron(1);
true
 emptypolyhedron(1) &< fullpolyhedron(2);
Error, (in POLYHEDRON[`&<=`]) arguments must lie in the same space
&<=
```&<=(P1::POLYHEDRON, P2::POLYHEDRON)::boolean
&>=(P2::POLYHEDRON, P1::POLYHEDRON)::boolean
P1 &<= P2
P2 &>= P1
```

Test whether P1 is contained in P2. Both cones must lie in the same ambient space.

Contrary to the Maple comparison operators, this functions directly returns a boolean value. Hence there is no need to apply evalb.

&<>
```&<>(P1::POLYHEDRON, P2::POLYHEDRON)::boolean
P1 &<> P2
```

Test whether P1 and P2 represent different polyhedra, considered as subsets of Euclidean space. This is not the same as comparing P1 and P2 as Maple expressions, see the discussion under CONE[&=]

One can compare polyhedra lying in different ambient spaces. The result is always true.

&=
```&=(P1::POLYHEDRON, P2::POLYHEDRON)::boolean
P1 &= P2
```

Test whether P1 and P2 represent the same cone, considered as subset of Euclidean space. This is not the same as comparing P1 and P2 as Maple expressions, see the discussion under CONE[&=]

One can compare polyhedra lying in different ambient spaces. The result is always false.

Contrary to the Maple comparison operators, this functions directly returns a boolean value. Hence there is no need to apply evalb.

&x
```&x(P1::POLYHEDRON, ...)::POLYHEDRON
P1 &x P2
```

The Cartesian product of the given polyhedra, lying in the Cartesian product of their ambient spaces.

Examples
 P := cube(1) &x cube(2);
P := POLYTOPE(3,3,8,6)
 P &= cube(3);
true
 &x(cube(1)\$4) &= cube(4);
true
Without any arguments, the function must be called like this:
 POLYHEDRON[`&x`]();
POLYTOPE(0,0,1,1)
affinehull
```affinehull(arg1::{vec, ray, line, POLYHEDRON}, ...)::POLYHEDRON
```

The affine hull of the given arguments, considered as POLYHEDRON.

ambientdim
```ambientdim(P::POLYHEDRON)::nonnegint
```

The dimension of the space in which P lies.

arecompatible
```arecompatible(P1::POLYHEDRON, P2::POLYHEDRON)::boolean
arecompatible(P1::POLYHEDRON, P2::POLYHEDRON, P::name)::boolean
```

Two polyhedra are compatible if their intersection is a common face of both. If P1 and P2 are compatible and a third argument P is given, it receives the intersection (of type POLYHEDRON).

barycenter
```barycenter(P::POLYTOPE1)::vec
```

The barycentre (center of gravity, centroid) of the non-empty polytope P.

boundary
```boundary(P::POLYHEDRON1)::PCOMPLEX
```

The polyhedral complex of all proper faces of the non-empty polyhedron P.

codim
```codim(P::POLYHEDRON)::nonnegint
```

The codimension of P is that of its affine hull. This is ambientdim(P)+1 if P is empty.

contains
```contains(P::POLYHEDRON, arg2::{vec, line, ray, POLYHEDRON})::boolean
contains(arg1::{affhspace, affhplane, POLYHEDRON}, arg2::{POLYHEDRON, vec})::boolean
```

The first form returns true if P contains the vector, line, ray or cone arg2, and false otherwise. The second form yields true if the polyhedron or vector arg2 is contained in the halfspace, hyperplane or polyhedron arg1, and false otherwise. If both arguments are polyhedra, one may also use the relational operators &<= and &>=.

Note that rays and lines do not determine polyhedra, but only directions. Hence if contains(P, ray(v)) or contains(P, line(v)) return true, then for any point of P the ray (respectively, line) through this point is contained in P.

containsrelint
```containsrelint(P::POLYHEDRON, v::vec)::boolean
```

Decides whether the vector v is contained in the relative interior of P.

convert/CONE
```convert(P::POLYHEDRON, CONE)::CONE
```

Internally, a POLYHEDRON is stored as the CONE given by its homogenization. This function returns the internal representation P as a CONE. Accordingly, the dimension and ambient dimension go up by one.

Note that the precise result depends on which coordinate is the additional one used for the homogenization.

convert/POLYHEDRON
```convert(P::POLYHEDRON, POLYHEDRON)::POLYHEDRON
```

This function transforms its argument to be strictly of type POLYHEDRON. For a true POLYHEDRON this is the identity operation. But if P is a CELL, then all additional information is lost.

convhull
```convhull(arg1::{vec, ray, POLYHEDRON, CONE}, ...)::POLYHEDRON
```

The convex hull of the given points, rays, lines, polyhedra and/or cones. This is the smallest polyhedron containing all of them. The arguments must lie in the same ambient space. Each CONE C in the argument list will be transformed to a POLYHEDRON, as by convert(C, affine). At least one argument must be given. If you have a possibly empty sequence of arguments in d-space, simply add emptypolytope(d). If no affine point is given, but rays and/or lines, a warning is issued and the empty polyhedron is returned.

Examples
 P1 := convhull([-1, 0], [1, 0], [0, 1], [1/2, 0]); vertices(P1); hspaces(P1);
P1 := POLYTOPE(2,2,3,3)
[[-1, 0], [1, 0], [0, 1]]
[[0, -1] <= 0, [1, 1] <= 1, [-1, 1] <= 1]
 P2 := convhull(P1, posorthant(2), ray([2, -1])); vertices(P2), rays(P2); hspaces(P2);
P2 := POLYHEDRON(2,2,0,[1, 2],[2])
[[-1, 0]], [[0, 1], [2, -1]]
[[-1, -2] <= 1, [-1, 0] <= 1]
 P3 := convhull(P2, line([1, -2])); vertices(P3), rays(P3), lines(P3); hspaces(P3);
P3 := POLYHEDRON(2,2,1,[1, 1],[1])
[[0, -2]], [[0, 1]], [[1, -2]]
[[-2, -1] <= 2]
 convhull(emptypolytope(2), ray([1, 1]), line([0, 1]));
Warning, no affine point specified
POLYTOPE(2,-1,0,0)
corners
```corners(P::POLYHEDRON)::list(PFACE)
```

The list of rank 1 faces of P. They correspond to the entries of vertices(C) (in the same order), but are of type PFACE. This function is similar to facets. See also vertices and PFACE[rank].

crosspolytope
```crosspolytope(n::nonnegint)::POLYTOPE__0
crosspolytope(n::nonnegint, c::rational)::POLYTOPE__0
```

The polytope in n-space with vertices, the c-fold multiples of the canonical basis vectors and their negatives. If c is not given, it is taken to be 1. These polytopes are dual to the n-dimensional cubes. A 3-dimensional crosspolytope is called an octahedron. The 0-dimensional crosspolytope is the origin in 0-space. See cube.

cube
```cube(n::nonnegint)::POLYTOPE__0
cube(n::nonnegint, c::rational)::POLYTOPE__0
```

The n-dimensional hypercube (lying in n-space) whose vertices have coordinates c and -c. If c is not given, it is taken to be 1. The 0-dimensional cube is the origin in 0-space. The n-dimensional hypercube is dual to the n-dimensional crosspolytope.

cyclicpolytope
```cyclicpolytope(d::posint, n::posint)::POLYTOPE
```

A cyclic polytope, generated by n points on the moment curve in d-space.

dim
```dim(P::POLYHEDRON)::integer
```

The dimension of P is that of its affine hull. This is -1 if P is empty.

distance
```distance(P::POLYHEDRON, v::vec)::{nonnegative, pos_infinity}
distance(P::POLYHEDRON, v::vec, w::name)::{nonnegative, pos_infinity}
```

The Euclidean distance between P and the point v. This is 0 if P contains v, and infinity if P is empty. If P is non-empty and a third argument is given, it receives the proximum of v in P. See proximum for information about the algorithm used.

draw
```draw(P::POLYTOPE)
draw(P::POLYTOPE, opt)
```

This functions draws the polytope P, which must be of dimension 2 or 3. It is a synonym for PLOT(plotdata(P)) (if P is lies in 2-space) or PLOT3D(plotdata(P)) (if P is lies in 3-space). The optional second argument can be a plot option or a list of plot options. See plotdata and plot[options].

Examples
 draw(cube(3));
dual
```dual(P::POLYHEDRON)::POLYHEDRON
```

The dual polyhedron of P. This is the set of all points whose scalar product with all points of P is >= -1. See also polar.

Examples
 dual(cube(2)) &= crosspolytope(2);
true
 dual(emptypolytope(3)) &= fullpolyhedron(3);
true
The bidual of a polyhedron P is the convex hull of P and the origin.
 P := dual(dual(convhull([3]))); vertices(P);
P := POLYTOPE(1,1,2,2)
[[3], [0]]
emptypolyhedron
```emptypolyhedron(n::nonnegint)::POLYTOPE
```

Same as emptypolytope.

emptypolytope
```emptypolytope(n::nonnegint)::POLYTOPE
```

The empty polytope in n-space.

facefan
```facefan(P::POLYHEDRON0)::FAN
```

The face fan of P. If P is bounded, this is the set of cones (with apex, the origin) generated by the proper faces of P. If P is unbounded, then its face fan contains additional cones, coming from the faces at infinity. More precisely, one adds the recession cone of P, see recession. The face fan is dual to the normal fan, see normalfan.

Examples
 F := facefan(cube(2)); map(rays, maximal(F));
F := FAN(2,0,[0, 4])
[[[-1, -1], [-1, 1]], [[-1, -1], [1, -1]], [[-1, 1], [1, 1]], [[1, -1], [1, 1]]]
 F := facefan(convhull([0, 0])); map(rays, maximal(F));
F := FAN(2,0,[0, 0])
[[]]
 P := fullpolyhedron(1) &x cube(1); F := facefan(P); map(rays, maximal(F)); map(lines, maximal(F));
P := POLYHEDRON(2,2,1,[2, 0],[1])
F := FAN(2,1,[0, 2])
[[[0, 1]], [[0, -1]]]
[[[1, 0]], [[1, 0]]]
faces
```faces(P::POLYHEDRON)::Array(list(PFACE))
```

An Array indexed from -1 to ambientdim(P). The k-th entry is a list of all k-dimensional faces of P. See also ambientdim.

Warning: polyhedra may have a huge number of faces!

Examples
 faces(cube(2));
Array(-1 .. 2,{-1 = [PFACE(0,4)], 0 = [PFACE(1,2), PFACE(1,2), PFACE(1,2), PFACE(1,2)], 1 = [PFACE(2,1), PFACE(2,1), PFACE(2,1), PFACE(2,1)], 2 = [PFACE(4,0)]},datatype = anything,storage = rectangular,order = Fortran_order)
 faces(fullpolyhedron(2));
Array(-1 .. 2,{-1 = [PFACE(0,1)], 0 = [], 1 = [], 2 = [PFACE(1,0)]},datatype = anything,storage = rectangular,order = Fortran_order)
facets
```facets(P::POLYHEDRON)::list(PFACE)
```

A list of the facets of P. The order corresponds to that of hspaces(P), i.e., facets(P)[i] is the facet induced by intersecting P with the hyperplane defined by hspaces(P)[i]. See hspaces.

flagf
```flagf(P::CONE, S::set(integer))::nonnegint
```

The entry of the flag f-vector of P corresponding to S. See PCOMPLEX[flagf].

flagh
```flagf(P::CONE, S::set(integer))::integer
```

The entry of the flag h-vector of P corresponding to S. See PCOMPLEX[flagh].

fullpolyhedron
```fullpolyhedron(n::integer)::POLYHEDRON
```

The whole space as full-dimensional polyhedron in affine n-space.

Examples
 fullpolyhedron(0) &= emptypolytope(0);
false
fvector
```fvector(P::POLYHEDRON)::Array(nonnegint)
```

The f-vector of P counts the number of faces of P of the various dimensions. See PCOMPLEX[fvector].

genhvector
```genhvector(P::POLYHEDRON1)::Array
```

Same as genhvector(normalfan(P)). See FAN[genhvector].

hplanes
```hplanes(P::POLYHEDRON)::list(vec)
```

A basis of the linear subspace of all vectors whose scalar product with all vectors of P is constant. The normalization is as for lineality spaces, see lines. If P is empty, then the result is the "impossible" equation [0, ..., 0] = 1.

Examples
 P := convhull([1, 0, 3, 2], [4, 1/3, 7, -9]); hplanes(P);
P := POLYTOPE(4,1,2,2)
[[11, 0, 0, 3] = 17, [0, 33, 0, 1] = 2, [0, 0, 11, 4] = 41]
 hplanes(emptypolytope(3));
[[0, 0, 0] = 1]
hspaces
```hspaces(P::POLYHEDRON)::list(vec)
```

This list contains, for each facet f of P, a vector normal to f. The normalization (with respect to hyperplanes in this case) is as for vertices and rays. See hplanes and vertices.

image
```image(P::POLYHEDRON, A::{mat, rational, real_infinity}, v::vec)::POLYHEDRON
```

This gives the image of P under the affine map defined by A and v. Either A or v may be omitted. If A is omitted, it is set to 1, so that P is translated by v; if v is omitted, it is set to the zero vector. If A is a rational number, is interpreted as homothety. If it equals plus or minus infinity, then the result is the whole ambient space, unless P is empty. In this case the result is again an empty polyhedron.

incidencematrix
```incidencematrix(P::POLYHEDRON)::matrix({0,1})
```

The incidence matrix of P. It has one row for each facet of P and one column for each ray or vertex. The ordering is that of hspaces and rays, vertices respectively; the rays precede the vertices. The entry in row i and column j is 1 if the j-th ray or (j-nops(rays(P)))-th vertex is incident to the i-th facet, and 0 otherwise.

intersection
```intersection(arg1::{affhspace, affhplane, POLYHEDRON}, ...)::POLYHEDRON
```

The intersection of the given affine halfspaces, affine hyperplanes and/or polyhedra. This is the largest polyhedron contained in all of them. The arguments must lie in the same ambient space. At least one argument must be given. If you want to intersect a possibly empty sequence of arguments in d-space, simply add fullpolyhedron(d), see fullpolyhedron.

Examples
 P1 := intersection([1, 0] <= 2, [0, 1] >= -3); vertices(P1), rays(P1);
P1 := POLYHEDRON(2,2,0,[1, 2],[2])
[[2, -3]], [[-1, 0], [0, 1]]
 P2 := intersection(P1, [1, -1] <= 3); vertices(P2), rays(P2);
P2 := POLYHEDRON(2,2,0,[2, 2],[3])
[[0, -3], [2, -1]], [[-1, 0], [0, 1]]
 P3 := intersection(P1, [1, -1] >= 3); vertices(P3), rays(P3);
P3 := POLYTOPE(2,2,3,3)
[[2, -3], [0, -3], [2, -1]], []
 P4 := intersection(P1, [1, -1] >= 6); vertices(P4), rays(P4);
P4 := POLYTOPE(2,-1,0,0)
[], []
 P5 := intersection(P1, [1, -1] = 4); vertices(P5), rays(P5);
P5 := POLYTOPE(2,1,2,2)
[[1, -3], [2, -2]], []
isaffine
```isaffine(P::POLYHEDRON)::boolean
```

Test whether P is an affine subspace.

isbounded
```isbounded(P::POLYHEDRON)::boolean
```

Test whether P is bounded, i.e., a polytope. This is equivalent to type(P, POLYTOPE).

isempty
```isempty(P::POLYHEDRON)::boolean
```

Test whether P is empty.

isface
```isface(P1::POLYHEDRON, P2::POLYHEDRON)::boolean
isface(P1::POLYHEDRON, P2::POLYHEDRON, f::name)::boolean
```

Test whether P1 is a face of P2 (regarded as point sets). If this is the case and a third argument is given, it receives the PFACE with domain P2 representing this face. P1 and P2 must lie in the same ambient space.

Examples
 P1 := convhull([1, 1], [1, -1]);
P1 := POLYTOPE(2,1,2,2)
 isface(P1, cube(2), f);
true
 f; vertices(f);
PFACE(2,1)
[[1, -1], [1, 1]]
isfulldim
```isfulldim(P::POLYHEDRON)::boolean
```

Test whether P is full-dimensional.

islinear
```islinear(P::POLYHEDRON)::boolean
```

Test whether P is a linear subspace.

ispointed
```ispointed(P::POLYHEDRON)::boolean
```

Test whether P is pointed. A polyhedron is pointed if it contains no line, i.e., if it is empty or has a face of dimension 0.

issimplex
```issimplex(P::POLYHEDRON)::boolean
```

Test whether P is a simplex, that is, the convex hull of dim(P)+1 points.

issimple
```issimple(P::POLYHEDRON)::boolean
```

Test whether P is simple. A polyhedron is simple if it is full-dimensional and each proper face f is the intersection of exactly dim(f) facets. This is dual to issimplicial1.

issimplicial
```issimplicial(P::POLYHEDRON)::boolean
```

Test whether P is simplicial. We call a polyhedron P simplicial if it is pointed and has exactly dim(P)+1 vertices and rays. This is not what is usually called simplicial. See ispointed, issimplex and issimplicial1.

Examples
 P := convert(posorthant(2), affine); issimplicial(P);
P := POLYHEDRON(2,2,0,[1, 2],[2])
true
issimplicial1
```issimplicial1(P::POLYHEDRON)::boolean
```

Test whether P is simplicial in codimension 1, that is, whether C is pointed and all its facets are simplicial (in the sense of issimplicial). (The second condition implies the first unless P is an affine subspace.) This is what is usually called a "simplicial" polyhedron (at least for polytopes). See ispointed, issimple and issimplicial.

join
```join(P1::POLYHEDRON, ...)::POLYHEDRON
```

To compute the join of the given polyhedra, they are canonically embedded into the Cartesian product of their ambient spaces, and then their convex hull is taken. This is dual to the Cartesian product &x.

Attention: In many textbooks one assumes that the polyhedra are first translated such that the origin is in the relative interior of each. This is not the case here.

Examples
 P := join(cube(1), cube(1)); vertices(P);
P := POLYTOPE(2,2,4,4)
[[-1, 0], [1, 0], [0, -1], [0, 1]]
 join(P, P) &= crosspolytope(4);
true
Without any arguments, the function must be called in the long form:
 POLYHEDRON[join]();
POLYTOPE(0,0,1,1)
lines
```lines(P::POLYHEDRON)::{list(vec), FAIL}
```

A basis of the lineality space of P, or FAIL if P is empty. The basis is normalized as for cones, see CONE[lines]. Like there, two polyhedra P1 and P2 have the same lineality space if and only lines(P1) and lines(P2) are identical.

maximal
```maximal(P::POLYHEDRON)::PFACE
```

This function returns the maximal element of the face lattice of P, i.e., P itself, considered as an element of its face lattice.

minimal
```minimal(P::POLYHEDRON)::PFACE
```

This function returns the minimal element of the face lattice of P, i.e., the empty face of P.

minkowskisum
```minkowskisum(P1::POLYHEDRON, ...)::POLYHEDRON
```

The Minkowski sum of the given polyhedra. All polyhedra must lie in the same ambient space. At least one argument must be given. The implementation uses the Cayley trick.

Examples
 P := minkowskisum(convhull([0, 0], [0, 1]), convhull([0, 0], [1, 0])); vertices(P);
P := POLYTOPE(2,2,4,4)
[[0, 0], [0, 1], [1, 0], [1, 1]]
newtonpolytope
```newtonpolytope(p, X::list)::POLYTOPE
```

A Laurent polynomial in some indeterminates is a polynomial in these indeterminates and their inverses. The Newton polytope of the Laurent polynomial p with respect to the list of indeterminates X is the convex hull of the exponents of all monomials appearing in p. For instance, the exponent of -x^2/y with respect to [x, y] is [2, -1], and [0, -1, 2] with respect to [z, y, x]. The coefficients of p must be of type complex(numeric).

Examples
 P := newtonpolytope(x^2-I*x*y, [x, y]); vertices(P);
P := POLYTOPE(2,1,2,2)
[[1, 1], [2, 0]]
 P := newtonpolytope((x+2/y)^3, [x, y, z]); vertices(P);
P := POLYTOPE(3,1,2,2)
[[0, -3, 0], [3, 0, 0]]
 P := newtonpolytope(0, [x, y]); vertices(P);
P := POLYTOPE(2,-1,0,0)
[]
normalfan
```normalfan(P:POLYHEDRON1)::FAN
```

The normal fan of P. If P is bounded, then its normal fan contains for each face of dimension d >= 0 a cone of codimension d. More precisely, one translates P such that it contains the origin, and takes the face fan of the dual, see facefan. This definition also applies to unbounded polyhedra.

Examples
 F := normalfan(cube(2)); map(rays, maximal(F));
F := FAN(2,0,[0, 4])
[[[1, 0], [0, 1]], [[0, 1], [-1, 0]], [[1, 0], [0, -1]], [[0, -1], [-1, 0]]]
 normalfan(convhull([2, 3]));
FAN(2,2,[0, 1])
The normal fan of a Cartesian product is the Cartesian product of the normal fans.
 P1 := cube(2); P2 := convhull([1]);
P1 := POLYTOPE(2,2,4,4)
P2 := POLYTOPE(1,0,1,1)
 normalfan(P1 &x P2) &= (normalfan(P1) &x normalfan(P2));
true
permutahedron
```permutahedron(d::nonnegint)::POLYTOPE
```

The d-dimensional permutahedron, whose coordinates are all ordered d-tuples of the set {1..d+1}.

plotdata
```plotdata(P::POLYTOPE)
plotdata(P::POLYTOPE, opt)
```

This function returns the arguments for the PLOT or PLOT3D data structure giving a graphical representation of P. One can use it instead of draw if one wants to combine several polytopes in the same drawing. The optional second argument can be a plot option or a list of plot options, see plot[options].

polar
```polar(P::POLYHEDRON)::POLYHEDRON
```

The polar polyhedron of P is the negative of its dual.

preimage
```preimage(P::POLYHEDRON, A::{mat, rational, real_infinity}, v::vec)::POLYHEDRON
```

The preimage of P under the affine map defined by A and v. Either argument may be omitted, as for image. See also the description of mat for details on how to specify maps to 0-dimensional space.

proximum
```proximum(P::POLYHEDRON1, v::vec)::vec
proximum(P::POLYHEDRON1, v::vec, d::name)::vec
```

The proximum of v in the non-empty polytope P, i.e., the point in P closest to v. If a third argument is given, it receives the distance between P and v. The algorithm is based on P. Wolfe, Finding the nearest point in a polytope, Math. Programming 11 (1976), 128–149.

randompolytope
```randompolytope(d::nonnegint, n::nonnegint, k::posint)::POLYTOPE
```

A polytope in d-space generated by n randomly chosen points with integral coordinates between -k and k.

rays
```rays(P::POLYHEDRON)::list(vec)
```

If P is pointed, then its rays are its unbounded 1-dimensional faces. If P contains lines, then its vertices are only determined modulo the lineality space. Representatives are chosen as for cones; they are uniquely defined up to order. See lines, CONE[rays].

Examples
 rays(cube(2));
[]
 P := convhull(line([0, -6, 10]), ray([1/3, 1, 1/5]), [-7, 8, -9]);
P := POLYHEDRON(3,2,1,[1, 1],[1])
 lines(P); rays(P);
[[0, 3, -5]]
[[5, 0, 28]]
```readpoly(fn::string)::POLYHEDRON1
```

Returns the polyhedron defined by the polymake file fn (with added suffix ".poly"). See writepoly for an example.

If the description given in the file is incomplete, an error occurs. This happens for example if the file only contains a combinatorial description of the polyhedron without geometric information. The file is not checked for consistency. Corrupted files may therefore cause Convex to produce wrong results.

A lot of polytopes can be found in polymake's polytope database.

recession
```recession(P::POLYHEDRON1)::CONE
```

The recession cone of P. This is the largest cone (with apex the origin) a translate of which is contained in P. In other words, it is the intersection of the homogenization of P with the hyperplane at infinity.

Examples
 C := posorthant(2); P := convert(C, affine, [2, 3]);
C := CONE(2,2,0,2,2)
P := POLYHEDRON(2,2,0,[1, 2],[2])
 vertices(P); rays(C);
[[2, 3]]
[[1, 0], [0, 1]]
 recession(P) &= C;
true
relint
```relint(::POLYHEDRON1)::vec
```

A point in the relative interior of P.

Examples
 relint(convhull([0, 0], [1, 1]));
[1/2, 1/2]
skeleton
```skeleton(P::POLYHEDRON, k::integer)::PCOMPLEX
```

This is the same as PCOMPLEX[skeleton](pcomplex(P), k).

stdsimplex
```stdsimplex(n::nonnegint)::POLYTOPE0
```

The n-dimensional standard simplex with vertices, the origin and the canonical basis vectors of n-space.

support
```support(P::POLYHEDRON, v1::vec, ...)::PFACE
```

The supporting face of the vectors v1, ... in P. This is the smallest face of P containing all the given vectors. If no such face exists, the value FAIL is returned.

Examples
 P := cube(2); f := support(P, [1, 1], [1, -1]); vertices(f);
P := POLYTOPE(2,2,4,4)
f := PFACE(2,1)
[[1, -1], [1, 1]]
 f := support(P, [1, 1]); vertices(f);
f := PFACE(1,2)
[[1, 1]]
 f := support(P, [2, 0]);
f := FAIL
Without any vector, the function gives the minimal (= empty) face of P:
 f := support(P);
f := PFACE(0,4)
surface
```surface(P::POLYHEDRON)::{nonnegative, pos_infinity}
```

The Euclidean surface of P. This is the sum of the areas of the facets if P is full-dimensional and bounded, 2*volume(maximal(P)) if it is bounded and of codimension 1, infinity if it is unbounded and of codimension at most 1, and 0 otherwise.

traverse
```traverse(P::POLYHEDRON, g::procedure)
```

This is the same as traverse(pcomplex(P), g), see PCOMPLEX[traverse].

traverse2
```traverse2(P::POLYHEDRON, g::procedure, g2::procedure)
```

This is the same as traverse2(pcomplex(P), g, g2), see PCOMPLEX[traverse2].

vertices
```vertices(P::POLYHEDRON)::list(vec)
```

If P is pointed, then its vertices are its 0-dimensional faces. If P contains lines, then its vertices are only determined modulo the lineality space. The representatives are chosen such that the coordinates corresponding to the pivot columns of lines(P) are zero. (The pivot columns of lines(P) are those which are linearly independent from the preceding columns.) Note that this determines vertices(P) up to order of the rows. See also lines.

Examples
 P := convhull(line([0, -6, 10]), ray([1/3, 1, 1/5]), [-7, 8, -9]);
P := POLYHEDRON(3,2,1,[1, 1],[1])
 lines(P); vertices(P);
[[0, 3, -5]]
[[-7, 0, 13/3]]
 vertices(emptypolytope(2));
[]
volume
```volume(P::POLYHEDRON)::{nonnegative, pos_infinity}
```

The Euclidean volume of P. This is 0 if P is not full-dimensional, and infinity if it is full-dimensional, but not bounded.

writepoly
```writepoly(P::POLYHEDRON1, fn::string)
writepoly(P::POLYHEDRON1, fn::string, desc::string)
```

Saves the polyhedron P in polymake format to the file fn (with added suffix ".poly"). P must be pointed and non-empty. The file contains the following sections: AMBIENT_DIM, DIM, N_VERTICES, N_FACETS, VERTICES, FACETS, AFFINE_HULL, VERTICES_IN_FACETS and FAR_FACE. If the optional argument desc is given, this string is added as DESCRIPTION section. If the file already exists, it will be overwritten!

Examples
 writepoly(cube(3), "cube", "a 3-dimensional cube");
Now the contents of the file "cube.poly" is the following:
```# created by the Maple package `Convex' version pre1.2.0

DESCRIPTION
a 3-dimensional cube

AMBIENT_DIM
3

DIM
3

N_VERTICES
8

N_FACETS
6

VERTICES
1 -1 -1 -1
1 1 -1 -1
1 -1 1 -1
1 1 1 -1
1 -1 -1 1
1 1 -1 1
1 -1 1 1
1 1 1 1

FACETS
1 -1 0 0
1 0 0 -1
1 0 -1 0
1 1 0 0
1 0 1 0
1 0 0 1

AFFINE_HULL

VERTICES_IN_FACETS
{ 1 3 5 7 }
{ 4 5 6 7 }
{ 2 3 6 7 }
{ 0 2 4 6 }
{ 0 1 4 5 }
{ 0 1 2 3 }

FAR_FACE
{ }
```
We use the file to define a new polyhedron:
 P := readpoly("cube"); P &= cube(3);
P := POLYTOPE(3,3,8,6)
true