Examples of CW complexes

sage.categories.examples.cw_complexes.Example[source]

alias of Surface

class sage.categories.examples.cw_complexes.Surface(bdy=(1, 2, 1, 2))[source]

Bases: UniqueRepresentation, Parent

An example of a CW complex: a (2-dimensional) surface.

This class illustrates a minimal implementation of a CW complex.

EXAMPLES:

sage: from sage.categories.cw_complexes import CWComplexes
sage: X = CWComplexes().example(); X
An example of a CW complex: the surface given by the boundary map (1, 2, 1, 2)

sage: X.category()
Category of finite finite dimensional CW complexes
>>> from sage.all import *
>>> from sage.categories.cw_complexes import CWComplexes
>>> X = CWComplexes().example(); X
An example of a CW complex: the surface given by the boundary map (1, 2, 1, 2)

>>> X.category()
Category of finite finite dimensional CW complexes

We conclude by running systematic tests on this manifold:

sage: TestSuite(X).run()
>>> from sage.all import *
>>> TestSuite(X).run()
class Element(parent, dim, name)[source]

Bases: Element

A cell in a CW complex.

dimension()[source]

Return the dimension of self.

EXAMPLES:

sage: from sage.categories.cw_complexes import CWComplexes
sage: X = CWComplexes().example()
sage: f = X.an_element()
sage: f.dimension()
2
>>> from sage.all import *
>>> from sage.categories.cw_complexes import CWComplexes
>>> X = CWComplexes().example()
>>> f = X.an_element()
>>> f.dimension()
2
an_element()[source]

Return an element of the CW complex, as per Sets.ParentMethods.an_element().

EXAMPLES:

sage: from sage.categories.cw_complexes import CWComplexes
sage: X = CWComplexes().example()
sage: X.an_element()
2-cell f
>>> from sage.all import *
>>> from sage.categories.cw_complexes import CWComplexes
>>> X = CWComplexes().example()
>>> X.an_element()
2-cell f
cells()[source]

Return the cells of self.

EXAMPLES:

sage: from sage.categories.cw_complexes import CWComplexes
sage: X = CWComplexes().example()
sage: C = X.cells()
sage: sorted((d, C[d]) for d in C.keys())
[(0, (0-cell v,)),
 (1, (0-cell e1, 0-cell e2)),
 (2, (2-cell f,))]
>>> from sage.all import *
>>> from sage.categories.cw_complexes import CWComplexes
>>> X = CWComplexes().example()
>>> C = X.cells()
>>> sorted((d, C[d]) for d in C.keys())
[(0, (0-cell v,)),
 (1, (0-cell e1, 0-cell e2)),
 (2, (2-cell f,))]