Polytopes

This module provides access to polymake, which ‘has been developed since 1997 in the Discrete Geometry group at the Institute of Mathematics of Technische Universitat Berlin. Since 2004 the development is shared with Fachbereich Mathematik, Technische Universitat Darmstadt. The system offers access to a wide variety of algorithms and packages within a common framework. polymake is flexible and continuously expanding. The software supplies C++ and Perl interfaces which make it highly adaptable to individual needs.’

Note

If you have trouble with this module do:

sage: !polymake --reconfigure   # not tested

at the command line.

AUTHORS:

  • Ewgenij Gawrilow, Michael Joswig: main authors of polymake
  • William Stein: Sage interface
class sage.geometry.polytope.Polymake
associahedron(dimension)

Return the Associahedron.

INPUT:

  • dimension – an integer
birkhoff(n)

Return the Birkhoff polytope.

INPUT:

  • n – an integer
cell24()

Return the 24-cell.

EXAMPLES:

sage: polymake.cell24()            # optional - polymake
The 24-cell
convex_hull(points=[])

EXAMPLES:

sage: R.<x,y,z> = PolynomialRing(QQ,3)
sage: f = x^3 + y^3 + z^3 + x*y*z
sage: e = f.exponents()
sage: a = [[1] + list(v) for v in e]
sage: a
[[1, 3, 0, 0], [1, 0, 3, 0], [1, 1, 1, 1], [1, 0, 0, 3]]
sage: n = polymake.convex_hull(a)       # optional - polymake
sage: n                                 # optional - polymake
Convex hull of points [[1, 0, 0, 3], [1, 0, 3, 0], [1, 1, 1, 1], [1, 3, 0, 0]]
sage: n.facets()                        # optional - polymake
[(0, 1, 0, 0), (3, -1, -1, 0), (0, 0, 1, 0)]
sage: n.is_simple()                     # optional - polymake
True
sage: n.graph()                         # optional - polymake
'GRAPH\n{1 2}\n{0 2}\n{0 1}\n\n'
cube(dimension, scale=0)
from_data(data)
rand01(d, n, seed=None)
reconfigure()

Reconfigure polymake.

Remember to run polymake.reconfigure() as soon as you have changed the customization file and/or installed missing software!

class sage.geometry.polytope.Polytope(datafile, desc)

Bases: sage.structure.sage_object.SageObject

Create a polytope.

EXAMPLES:

sage: P = polymake.convex_hull([[1,0,0,0], [1,0,0,1], [1,0,1,0], [1,0,1,1],  [1,1,0,0], [1,1,0,1], [1,1,1,0], [1,1,1,1]])   # optional - polymake

Note

If you have trouble with this module do:

sage: !polymake --reconfigure   # not tested

at the command line.

cmd(cmd)
data()
facets()

Return the facets.

EXAMPLES:

sage: P = polymake.convex_hull([[1,0,0,0], [1,0,0,1], [1,0,1,0], [1,0,1,1],  [1,1,0,0], [1,1,0,1], [1,1,1,0], [1,1,1,1]])   # optional - polymake
sage: P.facets()                            # optional - polymake
[(0, 0, 0, 1), (0, 1, 0, 0), (0, 0, 1, 0), (1, 0, 0, -1), (1, 0, -1, 0), (1, -1, 0, 0)]
graph()
is_simple()

Return True if this polytope is simple.

A polytope is simple if the degree of each vertex equals the dimension of the polytope.

EXAMPLES:

sage: P = polymake.convex_hull([[1,0,0,0], [1,0,0,1], [1,0,1,0], [1,0,1,1],  [1,1,0,0], [1,1,0,1], [1,1,1,0], [1,1,1,1]])        # optional - polymake
sage: P.is_simple()                              # optional - polymake
True

AUTHORS:

  • Edwin O’Shea (2006-05-02): Definition of simple.
n_facets()

EXAMPLES:

sage: P = polymake.convex_hull([[1,0,0,0], [1,0,0,1], [1,0,1,0], [1,0,1,1],  [1,1,0,0], [1,1,0,1], [1,1,1,0], [1,1,1,1]])     # optional - polymake
sage: P.n_facets()                            # optional - polymake
6
vertices()

Return the vertices.

EXAMPLES:

sage: P = polymake.convex_hull([[1,0,0,0], [1,0,0,1], [1,0,1,0], [1,0,1,1],  [1,1,0,0], [1,1,0,1], [1,1,1,0], [1,1,1,1]])     # optional - polymake
sage: P.vertices()                            # optional - polymake
[(1, 0, 0, 0), (1, 0, 0, 1), (1, 0, 1, 0), (1, 0, 1, 1), (1, 1, 0, 0), (1, 1, 0, 1), (1, 1, 1, 0), (1, 1, 1, 1)]
visual()
write(filename)