shapes.Simplex
- class rewalt.shapes.Simplex
Bases:
ShapeSubclass of
Shapefor oriented simplices.The methods of this class provide a full implementation of the category of simplices, which is generated by the face and degeneracy maps between simplices one dimension apart.
Use
Shape.simplex()to construct.Examples
We create a 1-simplex (arrow), a 2-simplex (triangle), and a 3-simplex (tetrahedron).
>>> arrow = Shape.simplex(1) >>> triangle = Shape.simplex(2) >>> tetra = Shape.simplex(3)
We can then check some of the simplicial relations between degeneracy and face maps.
>>> map1 = triangle.simplex_degeneracy(2).then( ... arrow.simplex_degeneracy(1)) >>> map2 = triangle.simplex_degeneracy(1).then( ... arrow.simplex_degeneracy(1)) >>> assert map1 == map2
>>> map3 = tetra.simplex_face(2).then( ... triangle.simplex_degeneracy(2)) >>> assert map3 == triangle.id()
>>> map4 = tetra.simplex_face(0).then( ... triangle.simplex_degeneracy(2)) >>> map5 = arrow.simplex_degeneracy(1).then( ... triangle.simplex_face(0)) >>> assert map4 == map5
Methods
Returns one of the collapse (degeneracy) maps of the simplex one dimension higher.
simplex_face(k)Returns one of the face inclusion maps of the simplex.
- simplex_face(k)
Returns one of the face inclusion maps of the simplex.
- Parameters
k (
int) – The index of the face map, ranging from0toself.dim.- Returns
simplex_face – The face map.
- Return type
- Raises
ValueError – If the index is out of range.
- simplex_degeneracy(k)
Returns one of the collapse (degeneracy) maps of the simplex one dimension higher.
- Parameters
k (
int) – The index of the degeneracy map, ranging from0toself.dim.- Returns
simplex_degeneracy – The degeneracy map.
- Return type
- Raises
ValueError – If the index is out of range.