Opened 11 years ago

Closed 9 years ago

# A Polyhedron should have a "is_simplicial" method.

Reported by: Owned by: jplabbe mhampton minor sage-5.7 geometry simplicial, polytope mhampton, novoselt sage-5.7.beta3 Frédéric Chapoton Andrey Novoseltsev N/A

### 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 <--------------------------------
```

### comment:1 Changed 11 years ago by jplabbe

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

### comment:3 follow-up: ↓ 5 Changed 11 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 11 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 11 years ago by novoselt

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 9 years ago by chapoton

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

### comment:7 Changed 9 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.

### comment:8 Changed 9 years ago by chapoton

• Status changed from needs_work to needs_review

I have added a NotImplementedError? for unbounded polyhedra

### comment:9 Changed 9 years ago by novoselt

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

### comment:10 Changed 9 years ago by jdemeyer

• Work issues unbounded case deleted

### comment:11 Changed 9 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.