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

Commit

Permalink
implement facets
Browse files Browse the repository at this point in the history
  • Loading branch information
sophiasage committed Sep 5, 2019
1 parent bdf4b23 commit 3362dc1
Showing 1 changed file with 49 additions and 3 deletions.
52 changes: 49 additions & 3 deletions src/sage/geometry/polyhedron/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Base class for polyhedra
"""

#*****************************************************************************
# ****************************************************************************
# Copyright (C) 2008 Marshall Hampton <hamptonio@gmail.com>
# Copyright (C) 2011 Volker Braun <vbraun.name@gmail.com>
# Copyright (C) 2015 Jean-Philippe Labbe <labbe at math.huji.ac.il>
Expand All @@ -12,7 +12,7 @@
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
# https://www.gnu.org/licenses/
#*****************************************************************************
# *****************************************************************************

from __future__ import division, print_function, absolute_import

Expand Down Expand Up @@ -4936,7 +4936,7 @@ def faces(self, face_dimension):
A tuple of
:class:`~sage.geometry.polyhedron.face.PolyhedronFace`. See
:mod:`~sage.geometry.polyhedron.face` for details. The order
random but fixed.
is random but fixed.
EXAMPLES:
Expand Down Expand Up @@ -5008,6 +5008,52 @@ def faces(self, face_dimension):
return tuple()
return tuple(fl[index])

def facets(self):
r"""
Return the facets of the polyhedron.
A facet of a `d`-dimensional polyhedron is a face of dimension
`d-1`.
OUTPUT:
A tuple of
:class:`~sage.geometry.polyhedron.face.PolyhedronFace`. See
:mod:`~sage.geometry.polyhedron.face` for details. The order
is random but fixed.
EXAMPLES:
Here we find the eight three-dimensional facets of the
four-dimensional hypercube::
sage: p = polytopes.hypercube(4)
sage: p.facets()
(A 3-dimensional face of a Polyhedron in ZZ^4 defined as the convex hull of 8 vertices,
A 3-dimensional face of a Polyhedron in ZZ^4 defined as the convex hull of 8 vertices,
A 3-dimensional face of a Polyhedron in ZZ^4 defined as the convex hull of 8 vertices,
A 3-dimensional face of a Polyhedron in ZZ^4 defined as the convex hull of 8 vertices,
A 3-dimensional face of a Polyhedron in ZZ^4 defined as the convex hull of 8 vertices,
A 3-dimensional face of a Polyhedron in ZZ^4 defined as the convex hull of 8 vertices,
A 3-dimensional face of a Polyhedron in ZZ^4 defined as the convex hull of 8 vertices,
A 3-dimensional face of a Polyhedron in ZZ^4 defined as the convex hull of 8 vertices)
This is the same result as explicitly finding the
three-dimensional faces::
sage: dim = p.dimension()
sage: p.faces(dim-1)
(A 3-dimensional face of a Polyhedron in ZZ^4 defined as the convex hull of 8 vertices,
A 3-dimensional face of a Polyhedron in ZZ^4 defined as the convex hull of 8 vertices,
A 3-dimensional face of a Polyhedron in ZZ^4 defined as the convex hull of 8 vertices,
A 3-dimensional face of a Polyhedron in ZZ^4 defined as the convex hull of 8 vertices,
A 3-dimensional face of a Polyhedron in ZZ^4 defined as the convex hull of 8 vertices,
A 3-dimensional face of a Polyhedron in ZZ^4 defined as the convex hull of 8 vertices,
A 3-dimensional face of a Polyhedron in ZZ^4 defined as the convex hull of 8 vertices,
A 3-dimensional face of a Polyhedron in ZZ^4 defined as the convex hull of 8 vertices)
"""
return self.faces(self.dimension()-1)

@cached_method
def f_vector(self):
r"""
Expand Down

0 comments on commit 3362dc1

Please sign in to comment.