Skip to content
This repository was archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
more examples and fix docstring
Browse files Browse the repository at this point in the history
  • Loading branch information
LaisRast committed Jul 23, 2019
1 parent 45bd312 commit 049e27d
Showing 1 changed file with 20 additions and 13 deletions.
33 changes: 20 additions & 13 deletions src/sage/geometry/polyhedron/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -4120,10 +4120,9 @@ def stack(self, face, position=None):

def wedge(self, face, width=1):
r"""
Return the wedge over a ``face`` of ``self``. ``self`` must be a
polytope and ``width`` must be nonzero.
Return the wedge over a ``face`` of the polytope ``self``.
The wedge over a face `F` of a polytope `P` with width `w \not\eq 0`
The wedge over a face `F` of a polytope `P` with width `w \not= 0`
is defined as:
.. MATH::
Expand All @@ -4136,23 +4135,24 @@ def wedge(self, face, width=1):
- ``face`` -- a PolyhedronFace of ``self``, the face which we take
the wedge over
- ``width`` -- a nonzero number (default: ``1``), the width of the
resulting polytope
- ``width`` -- a nonzero number (default: ``1``), indicates how wide
the resulted wedge should be
OUTPUT:
A (bounded) Polyhedron object
EXAMPLES::
sage: P = polytopes.regular_polygon(4)
sage: W1 = wedge(P, P.faces(1)[0]); W1
sage: P_4 = polytopes.regular_polygon(4)
sage: W1 = P_4.wedge(P_4.faces(1)[0]); W1
A 3-dimensional polyhedron in AA^3 defined as the convex hull of 6 vertices
sage: W1.is_simple()
sage: triangular_prism = polytopes.regular_polygon(3).prism()
sage: W1.is_combinatorially_isomorphic(triangular_prism)
True
sage: Q = polytopes.hypersimplex(4,2)
sage: W2 = wedge(Q, Q.faces(2)[0]); W2
sage: W2 = Q.wedge(Q.faces(2)[0]); W2
A 4-dimensional polyhedron in QQ^5 defined as the convex hull of 9 vertices
sage: W2.vertices()
(A vertex at (0, 1, 0, 1, 0),
Expand All @@ -4165,7 +4165,7 @@ def wedge(self, face, width=1):
A vertex at (1, 0, 1, 0, -1),
A vertex at (1, 1, 0, 0, 1))
sage: W3 = wedge(Q, Q.faces(1)[0]); W3
sage: W3 = Q.wedge(Q.faces(1)[0]); W3
A 4-dimensional polyhedron in QQ^5 defined as the convex hull of 10 vertices
sage: W3.vertices()
(A vertex at (0, 1, 0, 1, 0),
Expand All @@ -4179,12 +4179,18 @@ def wedge(self, face, width=1):
A vertex at (0, 1, 1, 0, -1),
A vertex at (1, 1, 0, 0, -2))
sage: C_3_7 = polytopes.cyclic_polytope(3,7)
sage: P_6 = polytopes.regular_polygon(6)
sage: W4 = P_6.wedge(P_6.faces(1)[0])
sage: W4.is_combinatorially_isomorphic(C_3_7.polar())
True
REFERENCES:
For more information, see Chapter 15 of [HoDaCG17]_.
"""
if not self.is_compact():
raise ValueError("polyhedron `self` must be a polytope")
raise ValueError("polyhedron 'self' must be a polytope")

if width == 0:
raise ValueError("the width should be nonzero")
Expand All @@ -4197,10 +4203,11 @@ def wedge(self, face, width=1):
for facet in face.ambient_Hrepresentation():
if facet.is_inequality():
F_Hrep = F_Hrep + facet.vector()
F_Hrep = list(F_Hrep)

L = Polyhedron(rays=[[1],[-1]])
L = Polyhedron(lines=[[1]])
Q = self.product(L)
H = Polyhedron(ieqs=[list(F_Hrep) + [width], list(F_Hrep) + [-width]])
H = Polyhedron(ieqs=[F_Hrep + [width], F_Hrep + [-width]])
return Q.intersection(H)

def lawrence_extension(self, v):
Expand Down

0 comments on commit 049e27d

Please sign in to comment.