### Navigation

- index
- modules |
- next |
- previous |
- Combinatorial Geometry »

# Base class for polyhedra over \(\ZZ\)

class `sage.geometry.polyhedron.base_ZZ.``Polyhedron_ZZ`(parent, Vrep, Hrep, **kwds)

  Bases: `sage.geometry.polyhedron.base.Polyhedron_base`

  Base class for Polyhedra over \(\ZZ\)

  TESTS:

      sage: p = Polyhedron([(0,0)], base_ring=ZZ);  p
      A 0-dimensional polyhedron in ZZ^2 defined as the convex hull of 1 vertex
      sage: TestSuite(p).run(skip='_test_pickling')

  `Minkowski_decompositions`()

    Return all Minkowski sums that add up to the polyhedron.

    OUTPUT:

    A tuple consisting of pairs \((X,Y)\) of \(\ZZ\)-polyhedra that add up to `self`. All pairs up to exchange of the summands are returned, that is, \((Y,X)\) is not included if \((X,Y)\) already is.

    EXAMPLES:

        sage: square = Polyhedron(vertices=[(0,0),(1,0),(0,1),(1,1)])
        sage: square.Minkowski_decompositions()
        ((A 0-dimensional polyhedron in ZZ^2 defined as the convex hull of 1 vertex,
          A 2-dimensional polyhedron in ZZ^2 defined as the convex hull of 4 vertices),
         (A 1-dimensional polyhedron in ZZ^2 defined as the convex hull of 2 vertices,
          A 1-dimensional polyhedron in ZZ^2 defined as the convex hull of 2 vertices))

    Example from http://cgi.di.uoa.gr/~amantzaf/geo/

         sage: Q = Polyhedron(vertices=[(4,0), (6,0), (0,3), (4,3)])
         sage: R = Polyhedron(vertices=[(0,0), (5,0), (8,4), (3,2)])
         sage: (Q+R).Minkowski_decompositions()
         ((A 0-dimensional polyhedron in ZZ^2 defined as the convex hull of 1 vertex,
           A 2-dimensional polyhedron in ZZ^2 defined as the convex hull of 7 vertices),
          (A 2-dimensional polyhedron in ZZ^2 defined as the convex hull of 4 vertices,
           A 2-dimensional polyhedron in ZZ^2 defined as the convex hull of 4 vertices),
          (A 1-dimensional polyhedron in ZZ^2 defined as the convex hull of 2 vertices,
           A 2-dimensional polyhedron in ZZ^2 defined as the convex hull of 7 vertices),
          (A 2-dimensional polyhedron in ZZ^2 defined as the convex hull of 5 vertices,
           A 2-dimensional polyhedron in ZZ^2 defined as the convex hull of 4 vertices),
          (A 1-dimensional polyhedron in ZZ^2 defined as the convex hull of 2 vertices,
           A 2-dimensional polyhedron in ZZ^2 defined as the convex hull of 7 vertices),
          (A 2-dimensional polyhedron in ZZ^2 defined as the convex hull of 5 vertices,
           A 2-dimensional polyhedron in ZZ^2 defined as the convex hull of 3 vertices),
          (A 1-dimensional polyhedron in ZZ^2 defined as the convex hull of 2 vertices,
           A 2-dimensional polyhedron in ZZ^2 defined as the convex hull of 7 vertices),
          (A 1-dimensional polyhedron in ZZ^2 defined as the convex hull of 2 vertices,
           A 2-dimensional polyhedron in ZZ^2 defined as the convex hull of 6 vertices))

        sage: [ len(square.dilation(i).Minkowski_decompositions())
        ...     for i in range(6) ]
        [1, 2, 5, 8, 13, 18]
        sage: [ ceil((i^2+2*i-1)/2)+1 for i in range(10) ]
        [1, 2, 5, 8, 13, 18, 25, 32, 41, 50]

  `fibration_generator`(dim)

    Generate the lattice polytope fibrations.

    For the purposes of this function, a lattice polytope fiber is a sub-lattice polytope. Projecting the plane spanned by the subpolytope to a point yields another lattice polytope, the base of the fibration.

    INPUT:

    - `dim` – integer. The dimension of the lattice polytope fiber.

    OUTPUT:

    A generator yielding the distinct lattice polytope fibers of given dimension.

    EXAMPLES:

        sage: P = Polyhedron(toric_varieties.P4_11169().fan().rays(), base_ring=ZZ)
        sage: list( P.fibration_generator(2) )
        [A 2-dimensional polyhedron in ZZ^4 defined as the convex hull of 3 vertices]

  `find_translation`(translated_polyhedron)

    Return the translation vector to `translated_polyhedron`.

    INPUT:

    - `translated_polyhedron` – a polyhedron.

    OUTPUT:

    A \(\ZZ\)-vector that translates `self` to `translated_polyhedron`. A `ValueError` is raised if `translated_polyhedron` is not a translation of `self`, this can be used to check that two polyhedra are not translates of each other.

    EXAMPLES:

        sage: X = polytopes.n_cube(3)
        sage: X.find_translation(X + vector([2,3,5]))
        (2, 3, 5)
        sage: X.find_translation(2*X)
        Traceback (most recent call last):
        ...
        ValueError: polyhedron is not a translation of self

  `has_IP_property`()

    Test whether the polyhedron has the IP property.

    The IP (interior point) property means that

    - `self` is compact (a polytope).
    - `self` contains the origin as an interior point.

    This implies that

    - `self` is full-dimensional.
    - The dual polyhedron is again a polytope (that is, a compact polyhedron), though not necessarily a lattice polytope.

    EXAMPLES:

        sage: Polyhedron([(1,1),(1,0),(0,1)], base_ring=ZZ).has_IP_property()
        False
        sage: Polyhedron([(0,0),(1,0),(0,1)], base_ring=ZZ).has_IP_property()
        False
        sage: Polyhedron([(-1,-1),(1,0),(0,1)], base_ring=ZZ).has_IP_property()
        True

    REFERENCES:

    [PALP] | Maximilian Kreuzer, Harald Skarke: “PALP: A Package for Analyzing Lattice Polytopes with Applications to Toric Geometry” Comput.Phys.Commun. 157 (2004) 87-106 Arxiv math/0204356

  `is_lattice_polytope`()

    Return whether the polyhedron is a lattice polytope.

    OUTPUT:

    `True` if the polyhedron is compact and has only integral vertices, `False` otherwise.

    EXAMPLES:

        sage: polytopes.cross_polytope(3).is_lattice_polytope()
        True
        sage: polytopes.regular_polygon(5).is_lattice_polytope()
        False

  `is_reflexive`()

    EXAMPLES:

        sage: p = Polyhedron(vertices=[(1,0,0),(0,1,0),(0,0,1),(-1,-1,-1)], base_ring=ZZ)
        sage: p.is_reflexive()
        True

  `polar`()

    Return the polar (dual) polytope.

    The polytope must have the IP-property (see `has_IP_property()`), that is, the origin must be an interior point. In particular, it must be full-dimensional.

    OUTPUT:

    The polytope whose vertices are the coefficient vectors of the inequalities of `self` with inhomogeneous term normalized to unity.

    EXAMPLES:

        sage: p = Polyhedron(vertices=[(1,0,0),(0,1,0),(0,0,1),(-1,-1,-1)], base_ring=ZZ)
        sage: p.polar()
        A 3-dimensional polyhedron in ZZ^3 defined as the convex hull of 4 vertices
        sage: type(_)
        <class 'sage.geometry.polyhedron.backend_ppl.Polyhedra_ZZ_ppl_with_category.element_class'>
        sage: p.polar().base_ring()
        Integer Ring

### Navigation

- index
- modules |
- next |
- previous |
- Combinatorial Geometry »