The polymake backend for polyhedral computations¶
Note
This backend requires polymake.
To install it, type sage -i polymake
in the terminal.
AUTHORS:
Matthias Köppe (2017-03): initial version
- class sage.geometry.polyhedron.backend_polymake.Polyhedron_QQ_polymake(parent, Vrep, Hrep, polymake_polytope=None, **kwds)[source]¶
Bases:
Polyhedron_polymake
,Polyhedron_QQ
Polyhedra over \(\QQ\) with polymake.
INPUT:
Vrep
– list[vertices, rays, lines]
orNone
Hrep
– list[ieqs, eqns]
orNone
EXAMPLES:
sage: p = Polyhedron(vertices=[(0,0),(1,0),(0,1)], # optional - jupymake ....: rays=[(1,1)], lines=[], ....: backend='polymake', base_ring=QQ) sage: TestSuite(p).run() # optional - jupymake
>>> from sage.all import * >>> p = Polyhedron(vertices=[(Integer(0),Integer(0)),(Integer(1),Integer(0)),(Integer(0),Integer(1))], # optional - jupymake ... rays=[(Integer(1),Integer(1))], lines=[], ... backend='polymake', base_ring=QQ) >>> TestSuite(p).run() # optional - jupymake
- class sage.geometry.polyhedron.backend_polymake.Polyhedron_ZZ_polymake(parent, Vrep, Hrep, polymake_polytope=None, **kwds)[source]¶
Bases:
Polyhedron_polymake
,Polyhedron_ZZ
Polyhedra over \(\ZZ\) with polymake.
INPUT:
Vrep
– list[vertices, rays, lines]
orNone
Hrep
– list[ieqs, eqns]
orNone
EXAMPLES:
sage: p = Polyhedron(vertices=[(0,0),(1,0),(0,1)], # optional - jupymake ....: rays=[(1,1)], lines=[], ....: backend='polymake', base_ring=ZZ) sage: TestSuite(p).run() # optional - jupymake
>>> from sage.all import * >>> p = Polyhedron(vertices=[(Integer(0),Integer(0)),(Integer(1),Integer(0)),(Integer(0),Integer(1))], # optional - jupymake ... rays=[(Integer(1),Integer(1))], lines=[], ... backend='polymake', base_ring=ZZ) >>> TestSuite(p).run() # optional - jupymake
- class sage.geometry.polyhedron.backend_polymake.Polyhedron_polymake(parent, Vrep, Hrep, polymake_polytope=None, **kwds)[source]¶
Bases:
Polyhedron_base
Polyhedra with polymake.
INPUT:
parent
–Polyhedra
the parentVrep
– list[vertices, rays, lines]
orNone
; the V-representation of the polyhedron. IfNone
, the polyhedron is determined by the H-representation.Hrep
– list[ieqs, eqns]
orNone
; the H-representation of the polyhedron. IfNone
, the polyhedron is determined by the V-representation.polymake_polytope
– a polymake polytope object
Only one of
Vrep
,Hrep
, orpolymake_polytope
can be different fromNone
.EXAMPLES:
sage: p = Polyhedron(vertices=[(0,0),(1,0),(0,1)], rays=[(1,1)], # optional - jupymake ....: lines=[], backend='polymake') sage: TestSuite(p).run() # optional - jupymake
>>> from sage.all import * >>> p = Polyhedron(vertices=[(Integer(0),Integer(0)),(Integer(1),Integer(0)),(Integer(0),Integer(1))], rays=[(Integer(1),Integer(1))], # optional - jupymake ... lines=[], backend='polymake') >>> TestSuite(p).run() # optional - jupymake
A lower-dimensional affine cone; we test that there are no mysterious inequalities coming in from the homogenization:
sage: P = Polyhedron(vertices=[(1, 1)], rays=[(0, 1)], # optional - jupymake ....: backend='polymake') sage: P.n_inequalities() # optional - jupymake 1 sage: P.equations() # optional - jupymake (An equation (1, 0) x - 1 == 0,)
>>> from sage.all import * >>> P = Polyhedron(vertices=[(Integer(1), Integer(1))], rays=[(Integer(0), Integer(1))], # optional - jupymake ... backend='polymake') >>> P.n_inequalities() # optional - jupymake 1 >>> P.equations() # optional - jupymake (An equation (1, 0) x - 1 == 0,)
The empty polyhedron:
sage: Polyhedron(eqns=[[1, 0, 0]], backend='polymake') # optional - jupymake The empty polyhedron in QQ^2
>>> from sage.all import * >>> Polyhedron(eqns=[[Integer(1), Integer(0), Integer(0)]], backend='polymake') # optional - jupymake The empty polyhedron in QQ^2
It can also be obtained differently:
sage: # optional - jupymake sage: P=Polyhedron(ieqs=[[-2, 1, 1], [-3, -1, -1], [-4, 1, -2]], ....: backend='polymake') sage: P The empty polyhedron in QQ^2 sage: P.Vrepresentation() () sage: P.Hrepresentation() (An equation -1 == 0,)
>>> from sage.all import * >>> # optional - jupymake >>> P=Polyhedron(ieqs=[[-Integer(2), Integer(1), Integer(1)], [-Integer(3), -Integer(1), -Integer(1)], [-Integer(4), Integer(1), -Integer(2)]], ... backend='polymake') >>> P The empty polyhedron in QQ^2 >>> P.Vrepresentation() () >>> P.Hrepresentation() (An equation -1 == 0,)
The full polyhedron:
sage: Polyhedron(eqns=[[0, 0, 0]], backend='polymake') # optional - jupymake A 2-dimensional polyhedron in QQ^2 defined as the convex hull of 1 vertex and 2 lines sage: Polyhedron(ieqs=[[0, 0, 0]], backend='polymake') # optional - jupymake A 2-dimensional polyhedron in QQ^2 defined as the convex hull of 1 vertex and 2 lines
>>> from sage.all import * >>> Polyhedron(eqns=[[Integer(0), Integer(0), Integer(0)]], backend='polymake') # optional - jupymake A 2-dimensional polyhedron in QQ^2 defined as the convex hull of 1 vertex and 2 lines >>> Polyhedron(ieqs=[[Integer(0), Integer(0), Integer(0)]], backend='polymake') # optional - jupymake A 2-dimensional polyhedron in QQ^2 defined as the convex hull of 1 vertex and 2 lines
Quadratic fields work:
sage: V = polytopes.dodecahedron().vertices_list() # needs sage.groups sage.rings.number_field sage: Polyhedron(vertices=V, backend='polymake') # optional - jupymake, needs sage.groups sage.rings.number_field A 3-dimensional polyhedron in (Number Field in sqrt5 with defining polynomial x^2 - 5 with sqrt5 = 2.236067977499790?)^3 defined as the convex hull of 20 vertices
>>> from sage.all import * >>> V = polytopes.dodecahedron().vertices_list() # needs sage.groups sage.rings.number_field >>> Polyhedron(vertices=V, backend='polymake') # optional - jupymake, needs sage.groups sage.rings.number_field A 3-dimensional polyhedron in (Number Field in sqrt5 with defining polynomial x^2 - 5 with sqrt5 = 2.236067977499790?)^3 defined as the convex hull of 20 vertices