Opened 10 years ago

Closed 8 years ago

#10445 closed enhancement (fixed)

A Polyhedron should have a "is_simplicial" method.

Reported by: jplabbe Owned by: mhampton
Priority: minor Milestone: sage-5.7
Component: geometry Keywords: simplicial, polytope
Cc: mhampton, novoselt Merged in: sage-5.7.beta3
Authors: Frédéric Chapoton Reviewers: Andrey Novoseltsev
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Description

Presently, one can not ask if a polytope is simplicial (cf. http://en.wikipedia.org/wiki/Simplicial_polytope for the definition).

I would like to have something like:

sage: p = polytopes.n_cube(3)
sage: p.is_simplicial() <-------------
False <-------------------------------
sage: q = polytopes.n_simplex(5)
sage: q.is_simplicial() <-------------
True <--------------------------------

Attachments (1)

trac_10445_is_simplicial_fc.patch (2.3 KB) - added by chapoton 8 years ago.

Download all attachments as: .zip

Change History (12)

comment:1 Changed 10 years ago by jplabbe

  • Summary changed from A Polyhedron should have a "is_simplicial" to A Polyhedron should have a "is_simplicial" method.

comment:2 Changed 10 years ago by novoselt

  • Cc novoselt added

comment:3 follow-up: Changed 10 years ago by mhampton

Wow, I thought we had already done that at some point. Here's a first attempt:

def is_simplicial(self):
        """
        Tests if a polytope is simplicial, i.e. every facet is a simplex.

        EXAMPLES::

            sage: p = Polyhedron([[0,0,0],[1,0,0],[0,1,0],[0,0,1]])
            sage: p.is_simplicial()
            True
            sage: p2 = Polyhedron([[1, 1, 1], [-1, 1, 1], [1, -1, 1], [-1, -1, 1], [1, 1, -1]])
            sage: p2.is_simplicial()
            False
        """
        for f in self.facial_incidences():
            if len(f) != self.dim():
                return False
        return True

Should non-compact polyhedra be simplicial if they have simplicial facets?

comment:4 Changed 10 years ago by mhampton

Oops, sorry, went a little too fast there. Here's one that might actually work:

def is_simplicial(pq):
    """
    Tests if a polytope is simplicial, i.e. every facet is a simplex.

    EXAMPLES::

        sage: p = Polyhedron([[0,0,0],[1,0,0],[0,1,0],[0,0,1]])
        sage: p.is_simplicial()
        True
        sage: p2 = Polyhedron([[1, 1, 1], [-1, 1, 1], [1, -1, 1], [-1, -1, 1], [1, 1, -1]])
        sage: p2.is_simplicial()
        False
    """
    for f in pq.facial_incidences():
        if len(f[1]) != pq.dim():
            return False
    return True

comment:5 in reply to: ↑ 3 Changed 10 years ago by novoselt

Replying to mhampton:

Should non-compact polyhedra be simplicial if they have simplicial facets?

What exactly do you mean by facets here? Do you include unbounded ones?

There is a standard notion of a simplicial cone which means that its dimension is equal to the number of edges. I think is_simplicial for arbitrary polyhedra should either adhere to this or raise NotImplementedError for all unbounded polyhedra. I guess the right generalization is to say that it is simplicial in the projective space.

comment:6 Changed 8 years ago by chapoton

  • Authors set to Frédéric Chapoton
  • Status changed from new to needs_review

comment:7 Changed 8 years ago by novoselt

  • Status changed from needs_review to needs_work
  • Work issues set to unbounded case

I think my 2-year old comment still has to be taken into account.

Changed 8 years ago by chapoton

comment:8 Changed 8 years ago by chapoton

  • Status changed from needs_work to needs_review

I have added a NotImplementedError? for unbounded polyhedra

comment:9 Changed 8 years ago by novoselt

  • Reviewers set to Andrey Novoseltsev
  • Status changed from needs_review to positive_review

comment:10 Changed 8 years ago by jdemeyer

  • Work issues unbounded case deleted

comment:11 Changed 8 years ago by jdemeyer

  • Merged in set to sage-5.7.beta3
  • Resolution set to fixed
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.