Finite cubical complexes#

AUTHORS:

  • John H. Palmieri (2009-08)

This module implements the basic structure of finite cubical complexes. For full mathematical details, see Kaczynski, Mischaikow, and Mrozek [KMM2004], for example.

Cubical complexes are topological spaces built from gluing together cubes of various dimensions; the collection of cubes must be closed under taking faces, just as with a simplicial complex. In this context, a “cube” means a product of intervals of length 1 or length 0 (degenerate intervals), with integer endpoints, and its faces are obtained by using the nondegenerate intervals: if \(C\) is a cube – a product of degenerate and nondegenerate intervals – and if \([i,i+1]\) is the \(k\)-th nondegenerate factor, then \(C\) has two faces indexed by \(k\): the cubes obtained by replacing \([i, i+1]\) with \([i, i]\) or \([i+1, i+1]\).

So to construct a space homeomorphic to a circle as a cubical complex, we could take for example the four line segments in the plane from \((0,2)\) to \((0,3)\) to \((1,3)\) to \((1,2)\) to \((0,2)\). In Sage, this is done with the following command:

sage: S1 = CubicalComplex([([0,0], [2,3]), ([0,1], [3,3]),
....:                      ([0,1], [2,2]), ([1,1], [2,3])]); S1
Cubical complex with 4 vertices and 8 cubes
>>> from sage.all import *
>>> S1 = CubicalComplex([([Integer(0),Integer(0)], [Integer(2),Integer(3)]), ([Integer(0),Integer(1)], [Integer(3),Integer(3)]),
...                      ([Integer(0),Integer(1)], [Integer(2),Integer(2)]), ([Integer(1),Integer(1)], [Integer(2),Integer(3)])]); S1
Cubical complex with 4 vertices and 8 cubes

The argument to CubicalComplex is a list of the maximal “cubes” in the complex. Each “cube” can be an instance of the class Cube or a list (or tuple) of “intervals”, and an “interval” is a pair of integers, of one of the two forms \([i, i]\) or \([i, i+1]\). So the cubical complex S1 above has four maximal cubes:

sage: len(S1.maximal_cells())
4
sage: sorted(S1.maximal_cells())
[[0,0] x [2,3], [0,1] x [2,2], [0,1] x [3,3], [1,1] x [2,3]]
>>> from sage.all import *
>>> len(S1.maximal_cells())
4
>>> sorted(S1.maximal_cells())
[[0,0] x [2,3], [0,1] x [2,2], [0,1] x [3,3], [1,1] x [2,3]]

The first of these, for instance, is the product of the degenerate interval \([0,0]\) with the unit interval \([2,3]\): this is the line segment in the plane from \((0,2)\) to \((0,3)\). We could form a topologically equivalent space by inserting some degenerate simplices:

sage: S1.homology()                                                                 # needs sage.modules
{0: 0, 1: Z}
sage: X = CubicalComplex([([0,0], [2,3], [2]), ([0,1], [3,3], [2]),
....:                     ([0,1], [2,2], [2]), ([1,1], [2,3], [2])])
sage: X.homology()                                                                  # needs sage.modules
{0: 0, 1: Z}
>>> from sage.all import *
>>> S1.homology()                                                                 # needs sage.modules
{0: 0, 1: Z}
>>> X = CubicalComplex([([Integer(0),Integer(0)], [Integer(2),Integer(3)], [Integer(2)]), ([Integer(0),Integer(1)], [Integer(3),Integer(3)], [Integer(2)]),
...                     ([Integer(0),Integer(1)], [Integer(2),Integer(2)], [Integer(2)]), ([Integer(1),Integer(1)], [Integer(2),Integer(3)], [Integer(2)])])
>>> X.homology()                                                                  # needs sage.modules
{0: 0, 1: Z}

Topologically, the cubical complex X consists of four edges of a square in \(\RR^3\): the same unit square as S1, but embedded in \(\RR^3\) with \(z\)-coordinate equal to 2. Thus X is homeomorphic to S1 (in fact, they’re “cubically equivalent”), and this is reflected in the fact that they have isomorphic homology groups.

Note

This class derives from GenericCellComplex, and so inherits its methods. Some of those methods are not listed here; see the Generic Cell Complex page instead.

class sage.topology.cubical_complex.Cube(data)[source]#

Bases: SageObject

Define a cube for use in constructing a cubical complex.

“Elementary cubes” are products of intervals with integer endpoints, each of which is either a unit interval or a degenerate (length 0) interval; for example,

\[[0,1] \times [3,4] \times [2,2] \times [1,2]\]

is a 3-dimensional cube (since one of the intervals is degenerate) embedded in \(\RR^4\).

Parameters:

data – list or tuple of terms of the form (i,i+1) or (i,i) or (i,) – the last two are degenerate intervals.

Returns:

an elementary cube

Each cube is stored in a standard form: a tuple of tuples, with a nondegenerate interval [j,j] represented by (j,j), not (j,). (This is so that for any interval I, I[1] will produce a value, not an IndexError.)

EXAMPLES:

sage: from sage.topology.cubical_complex import Cube
sage: C = Cube([[1,2], [5,], [6,7], [-1, 0]]); C
[1,2] x [5,5] x [6,7] x [-1,0]
sage: C.dimension() # number of nondegenerate intervals
3
sage: C.nondegenerate_intervals()  # indices of these intervals
[0, 2, 3]
sage: C.face(1, upper=False)
[1,2] x [5,5] x [6,6] x [-1,0]
sage: C.face(1, upper=True)
[1,2] x [5,5] x [7,7] x [-1,0]
sage: Cube(()).dimension()  # empty cube has dimension -1
-1
>>> from sage.all import *
>>> from sage.topology.cubical_complex import Cube
>>> C = Cube([[Integer(1),Integer(2)], [Integer(5),], [Integer(6),Integer(7)], [-Integer(1), Integer(0)]]); C
[1,2] x [5,5] x [6,7] x [-1,0]
>>> C.dimension() # number of nondegenerate intervals
3
>>> C.nondegenerate_intervals()  # indices of these intervals
[0, 2, 3]
>>> C.face(Integer(1), upper=False)
[1,2] x [5,5] x [6,6] x [-1,0]
>>> C.face(Integer(1), upper=True)
[1,2] x [5,5] x [7,7] x [-1,0]
>>> Cube(()).dimension()  # empty cube has dimension -1
-1
alexander_whitney(dim)[source]#

Subdivide this cube into pairs of cubes.

This provides a cubical approximation for the diagonal map \(K \to K \times K\).

INPUT:

  • dim – integer between 0 and one more than the dimension of this cube

OUTPUT:

  • a list containing triples (coeff, left, right)

This uses the algorithm described by Pilarczyk and Réal [PR2015] on p. 267; the formula is originally due to Serre. Calling this method alexander_whitney is an abuse of notation, since the actual Alexander-Whitney map goes from \(C(K \times L) \to C(K) \otimes C(L)\), where \(C(-)\) denotes the associated chain complex, but this subdivision of cubes is at the heart of it.

EXAMPLES:

sage: from sage.topology.cubical_complex import Cube
sage: C1 = Cube([[0,1], [3,4]])
sage: C1.alexander_whitney(0)
[(1, [0,0] x [3,3], [0,1] x [3,4])]
sage: C1.alexander_whitney(1)
[(1, [0,1] x [3,3], [1,1] x [3,4]), (-1, [0,0] x [3,4], [0,1] x [4,4])]
sage: C1.alexander_whitney(2)
[(1, [0,1] x [3,4], [1,1] x [4,4])]
>>> from sage.all import *
>>> from sage.topology.cubical_complex import Cube
>>> C1 = Cube([[Integer(0),Integer(1)], [Integer(3),Integer(4)]])
>>> C1.alexander_whitney(Integer(0))
[(1, [0,0] x [3,3], [0,1] x [3,4])]
>>> C1.alexander_whitney(Integer(1))
[(1, [0,1] x [3,3], [1,1] x [3,4]), (-1, [0,0] x [3,4], [0,1] x [4,4])]
>>> C1.alexander_whitney(Integer(2))
[(1, [0,1] x [3,4], [1,1] x [4,4])]
dimension()[source]#

The dimension of this cube: the number of its nondegenerate intervals.

EXAMPLES:

sage: from sage.topology.cubical_complex import Cube
sage: C = Cube([[1,2], [5,], [6,7], [-1, 0]])
sage: C.dimension()
3
sage: C = Cube([[1,], [5,], [6,], [-1,]])
sage: C.dimension()
0
sage: Cube([]).dimension()  # empty cube has dimension -1
-1
>>> from sage.all import *
>>> from sage.topology.cubical_complex import Cube
>>> C = Cube([[Integer(1),Integer(2)], [Integer(5),], [Integer(6),Integer(7)], [-Integer(1), Integer(0)]])
>>> C.dimension()
3
>>> C = Cube([[Integer(1),], [Integer(5),], [Integer(6),], [-Integer(1),]])
>>> C.dimension()
0
>>> Cube([]).dimension()  # empty cube has dimension -1
-1
face(n, upper=True)[source]#

The nth primary face of this cube.

Parameters:
  • n – an integer between 0 and one less than the dimension of this cube

  • upper (boolean; optional, default=True) – if True, return the “upper” nth primary face; otherwise, return the “lower” nth primary face.

Returns:

the cube obtained by replacing the nth non-degenerate interval with either its upper or lower endpoint.

EXAMPLES:

sage: from sage.topology.cubical_complex import Cube
sage: C = Cube([[1,2], [5,], [6,7], [-1, 0]]); C
[1,2] x [5,5] x [6,7] x [-1,0]
sage: C.face(0)
[2,2] x [5,5] x [6,7] x [-1,0]
sage: C.face(0, upper=False)
[1,1] x [5,5] x [6,7] x [-1,0]
sage: C.face(1)
[1,2] x [5,5] x [7,7] x [-1,0]
sage: C.face(2, upper=False)
[1,2] x [5,5] x [6,7] x [-1,-1]
sage: C.face(3)
Traceback (most recent call last):
...
ValueError: can only compute the nth face if 0 <= n < dim
>>> from sage.all import *
>>> from sage.topology.cubical_complex import Cube
>>> C = Cube([[Integer(1),Integer(2)], [Integer(5),], [Integer(6),Integer(7)], [-Integer(1), Integer(0)]]); C
[1,2] x [5,5] x [6,7] x [-1,0]
>>> C.face(Integer(0))
[2,2] x [5,5] x [6,7] x [-1,0]
>>> C.face(Integer(0), upper=False)
[1,1] x [5,5] x [6,7] x [-1,0]
>>> C.face(Integer(1))
[1,2] x [5,5] x [7,7] x [-1,0]
>>> C.face(Integer(2), upper=False)
[1,2] x [5,5] x [6,7] x [-1,-1]
>>> C.face(Integer(3))
Traceback (most recent call last):
...
ValueError: can only compute the nth face if 0 <= n < dim
faces()[source]#

The list of faces (of codimension 1) of this cube.

EXAMPLES:

sage: from sage.topology.cubical_complex import Cube
sage: C = Cube([[1,2], [3,4]])
sage: C.faces()
[[2,2] x [3,4], [1,2] x [4,4], [1,1] x [3,4], [1,2] x [3,3]]
>>> from sage.all import *
>>> from sage.topology.cubical_complex import Cube
>>> C = Cube([[Integer(1),Integer(2)], [Integer(3),Integer(4)]])
>>> C.faces()
[[2,2] x [3,4], [1,2] x [4,4], [1,1] x [3,4], [1,2] x [3,3]]
faces_as_pairs()[source]#

The list of faces (of codimension 1) of this cube, as pairs (upper, lower).

EXAMPLES:

sage: from sage.topology.cubical_complex import Cube
sage: C = Cube([[1,2], [3,4]])
sage: C.faces_as_pairs()
[([2,2] x [3,4], [1,1] x [3,4]), ([1,2] x [4,4], [1,2] x [3,3])]
>>> from sage.all import *
>>> from sage.topology.cubical_complex import Cube
>>> C = Cube([[Integer(1),Integer(2)], [Integer(3),Integer(4)]])
>>> C.faces_as_pairs()
[([2,2] x [3,4], [1,1] x [3,4]), ([1,2] x [4,4], [1,2] x [3,3])]
is_face(other)[source]#

Return True iff this cube is a face of other.

EXAMPLES:

sage: from sage.topology.cubical_complex import Cube
sage: C1 = Cube([[1,2], [5,], [6,7], [-1, 0]])
sage: C2 = Cube([[1,2], [5,], [6,], [-1, 0]])
sage: C1.is_face(C2)
False
sage: C1.is_face(C1)
True
sage: C2.is_face(C1)
True
>>> from sage.all import *
>>> from sage.topology.cubical_complex import Cube
>>> C1 = Cube([[Integer(1),Integer(2)], [Integer(5),], [Integer(6),Integer(7)], [-Integer(1), Integer(0)]])
>>> C2 = Cube([[Integer(1),Integer(2)], [Integer(5),], [Integer(6),], [-Integer(1), Integer(0)]])
>>> C1.is_face(C2)
False
>>> C1.is_face(C1)
True
>>> C2.is_face(C1)
True
nondegenerate_intervals()[source]#

The list of indices of nondegenerate intervals of this cube.

EXAMPLES:

sage: from sage.topology.cubical_complex import Cube
sage: C = Cube([[1,2], [5,], [6,7], [-1, 0]])
sage: C.nondegenerate_intervals()
[0, 2, 3]
sage: C = Cube([[1,], [5,], [6,], [-1,]])
sage: C.nondegenerate_intervals()
[]
>>> from sage.all import *
>>> from sage.topology.cubical_complex import Cube
>>> C = Cube([[Integer(1),Integer(2)], [Integer(5),], [Integer(6),Integer(7)], [-Integer(1), Integer(0)]])
>>> C.nondegenerate_intervals()
[0, 2, 3]
>>> C = Cube([[Integer(1),], [Integer(5),], [Integer(6),], [-Integer(1),]])
>>> C.nondegenerate_intervals()
[]
product(other)[source]#

Cube obtained by concatenating the underlying tuples of the two arguments.

Parameters:

other – another cube

Returns:

the product of self and other, as a Cube

EXAMPLES:

sage: from sage.topology.cubical_complex import Cube
sage: C = Cube([[1,2], [3,]])
sage: D = Cube([[4], [0,1]])
sage: C.product(D)
[1,2] x [3,3] x [4,4] x [0,1]
>>> from sage.all import *
>>> from sage.topology.cubical_complex import Cube
>>> C = Cube([[Integer(1),Integer(2)], [Integer(3),]])
>>> D = Cube([[Integer(4)], [Integer(0),Integer(1)]])
>>> C.product(D)
[1,2] x [3,3] x [4,4] x [0,1]

You can also use __add__ or + or __mul__ or *:

sage: D * C
[4,4] x [0,1] x [1,2] x [3,3]
sage: D + C * C
[4,4] x [0,1] x [1,2] x [3,3] x [1,2] x [3,3]
>>> from sage.all import *
>>> D * C
[4,4] x [0,1] x [1,2] x [3,3]
>>> D + C * C
[4,4] x [0,1] x [1,2] x [3,3] x [1,2] x [3,3]
tuple()[source]#

The tuple attached to this cube.

EXAMPLES:

sage: from sage.topology.cubical_complex import Cube
sage: C = Cube([[1,2], [5,], [6,7], [-1, 0]])
sage: C.tuple()
((1, 2), (5, 5), (6, 7), (-1, 0))
>>> from sage.all import *
>>> from sage.topology.cubical_complex import Cube
>>> C = Cube([[Integer(1),Integer(2)], [Integer(5),], [Integer(6),Integer(7)], [-Integer(1), Integer(0)]])
>>> C.tuple()
((1, 2), (5, 5), (6, 7), (-1, 0))
class sage.topology.cubical_complex.CubicalComplex(maximal_faces=None, maximality_check=True)[source]#

Bases: GenericCellComplex

Define a cubical complex.

Parameters:
  • maximal_faces – set of maximal faces

  • maximality_check (boolean; optional, default: True) – see below

Returns:

a cubical complex

maximal_faces should be a list or tuple or set (or anything which may be converted to a set) of “cubes”: instances of the class Cube, or lists or tuples suitable for conversion to cubes. These cubes are the maximal cubes in the complex.

In addition, maximal_faces may be a cubical complex, in which case that complex is returned. Also, maximal_faces may instead be any object which has a _cubical_ method (e.g., a simplicial complex); then that method is used to convert the object to a cubical complex.

If maximality_check is True, check that each maximal face is, in fact, maximal. In this case, when producing the internal representation of the cubical complex, omit those that are not. It is highly recommended that this be True; various methods for this class may fail if faces which are claimed to be maximal are in fact not.

EXAMPLES:

The empty complex, consisting of one cube, the empty cube:

sage: CubicalComplex()
Cubical complex with 0 vertices and 1 cube
>>> from sage.all import *
>>> CubicalComplex()
Cubical complex with 0 vertices and 1 cube

A “circle” (four edges connecting the vertices (0,2), (0,3), (1,2), and (1,3)):

sage: S1 = CubicalComplex([([0,0], [2,3]), ([0,1], [3,3]),
....:                      ([0,1], [2,2]), ([1,1], [2,3])]); S1
Cubical complex with 4 vertices and 8 cubes
sage: S1.homology()                                                             # needs sage.modules
{0: 0, 1: Z}
>>> from sage.all import *
>>> S1 = CubicalComplex([([Integer(0),Integer(0)], [Integer(2),Integer(3)]), ([Integer(0),Integer(1)], [Integer(3),Integer(3)]),
...                      ([Integer(0),Integer(1)], [Integer(2),Integer(2)]), ([Integer(1),Integer(1)], [Integer(2),Integer(3)])]); S1
Cubical complex with 4 vertices and 8 cubes
>>> S1.homology()                                                             # needs sage.modules
{0: 0, 1: Z}

A set of five points and its product with S1:

sage: pts = CubicalComplex([([0],), ([3],), ([6],), ([-12],), ([5],)])
sage: pts
Cubical complex with 5 vertices and 5 cubes
sage: pts.homology()                                                            # needs sage.modules
{0: Z x Z x Z x Z}
sage: X = S1.product(pts); X
Cubical complex with 20 vertices and 40 cubes
sage: X.homology()                                                              # needs sage.modules
{0: Z x Z x Z x Z, 1: Z^5}
>>> from sage.all import *
>>> pts = CubicalComplex([([Integer(0)],), ([Integer(3)],), ([Integer(6)],), ([-Integer(12)],), ([Integer(5)],)])
>>> pts
Cubical complex with 5 vertices and 5 cubes
>>> pts.homology()                                                            # needs sage.modules
{0: Z x Z x Z x Z}
>>> X = S1.product(pts); X
Cubical complex with 20 vertices and 40 cubes
>>> X.homology()                                                              # needs sage.modules
{0: Z x Z x Z x Z, 1: Z^5}

Converting a simplicial complex to a cubical complex:

sage: S2 = simplicial_complexes.Sphere(2)
sage: C2 = CubicalComplex(S2)
sage: all(C2.homology(n) == S2.homology(n) for n in range(3))                   # needs sage.modules
True
>>> from sage.all import *
>>> S2 = simplicial_complexes.Sphere(Integer(2))
>>> C2 = CubicalComplex(S2)
>>> all(C2.homology(n) == S2.homology(n) for n in range(Integer(3)))                   # needs sage.modules
True

You can get the set of maximal cells or a dictionary of all cells:

sage: X.maximal_cells() # random: order may depend on the version of Python
{[0,0] x [2,3] x [-12,-12], [0,1] x [3,3] x [5,5], [0,1] x [2,2] x [3,3], [0,1] x [2,2] x [0,0], [0,1] x [3,3] x [6,6], [1,1] x [2,3] x [0,0], [0,1] x [2,2] x [-12,-12], [0,0] x [2,3] x [6,6], [1,1] x [2,3] x [-12,-12], [1,1] x [2,3] x [5,5], [0,1] x [2,2] x [5,5], [0,1] x [3,3] x [3,3], [1,1] x [2,3] x [3,3], [0,0] x [2,3] x [5,5], [0,1] x [3,3] x [0,0], [1,1] x [2,3] x [6,6], [0,1] x [2,2] x [6,6], [0,0] x [2,3] x [0,0], [0,0] x [2,3] x [3,3], [0,1] x [3,3] x [-12,-12]}
sage: sorted(X.maximal_cells())
[[0,0] x [2,3] x [-12,-12],
 [0,0] x [2,3] x [0,0],
 [0,0] x [2,3] x [3,3],
 [0,0] x [2,3] x [5,5],
 [0,0] x [2,3] x [6,6],
 [0,1] x [2,2] x [-12,-12],
 [0,1] x [2,2] x [0,0],
 [0,1] x [2,2] x [3,3],
 [0,1] x [2,2] x [5,5],
 [0,1] x [2,2] x [6,6],
 [0,1] x [3,3] x [-12,-12],
 [0,1] x [3,3] x [0,0],
 [0,1] x [3,3] x [3,3],
 [0,1] x [3,3] x [5,5],
 [0,1] x [3,3] x [6,6],
 [1,1] x [2,3] x [-12,-12],
 [1,1] x [2,3] x [0,0],
 [1,1] x [2,3] x [3,3],
 [1,1] x [2,3] x [5,5],
 [1,1] x [2,3] x [6,6]]
sage: S1.cells()
{-1: set(),
 0: {[0,0] x [2,2], [0,0] x [3,3], [1,1] x [2,2], [1,1] x [3,3]},
 1: {[0,0] x [2,3], [0,1] x [2,2], [0,1] x [3,3], [1,1] x [2,3]}}
>>> from sage.all import *
>>> X.maximal_cells() # random: order may depend on the version of Python
{[0,0] x [2,3] x [-12,-12], [0,1] x [3,3] x [5,5], [0,1] x [2,2] x [3,3], [0,1] x [2,2] x [0,0], [0,1] x [3,3] x [6,6], [1,1] x [2,3] x [0,0], [0,1] x [2,2] x [-12,-12], [0,0] x [2,3] x [6,6], [1,1] x [2,3] x [-12,-12], [1,1] x [2,3] x [5,5], [0,1] x [2,2] x [5,5], [0,1] x [3,3] x [3,3], [1,1] x [2,3] x [3,3], [0,0] x [2,3] x [5,5], [0,1] x [3,3] x [0,0], [1,1] x [2,3] x [6,6], [0,1] x [2,2] x [6,6], [0,0] x [2,3] x [0,0], [0,0] x [2,3] x [3,3], [0,1] x [3,3] x [-12,-12]}
>>> sorted(X.maximal_cells())
[[0,0] x [2,3] x [-12,-12],
 [0,0] x [2,3] x [0,0],
 [0,0] x [2,3] x [3,3],
 [0,0] x [2,3] x [5,5],
 [0,0] x [2,3] x [6,6],
 [0,1] x [2,2] x [-12,-12],
 [0,1] x [2,2] x [0,0],
 [0,1] x [2,2] x [3,3],
 [0,1] x [2,2] x [5,5],
 [0,1] x [2,2] x [6,6],
 [0,1] x [3,3] x [-12,-12],
 [0,1] x [3,3] x [0,0],
 [0,1] x [3,3] x [3,3],
 [0,1] x [3,3] x [5,5],
 [0,1] x [3,3] x [6,6],
 [1,1] x [2,3] x [-12,-12],
 [1,1] x [2,3] x [0,0],
 [1,1] x [2,3] x [3,3],
 [1,1] x [2,3] x [5,5],
 [1,1] x [2,3] x [6,6]]
>>> S1.cells()
{-1: set(),
 0: {[0,0] x [2,2], [0,0] x [3,3], [1,1] x [2,2], [1,1] x [3,3]},
 1: {[0,0] x [2,3], [0,1] x [2,2], [0,1] x [3,3], [1,1] x [2,3]}}

Chain complexes, homology, and cohomology:

sage: T = S1.product(S1); T
Cubical complex with 16 vertices and 64 cubes
sage: T.chain_complex()                                                         # needs sage.modules
Chain complex with at most 3 nonzero terms over Integer Ring
sage: T.homology(base_ring=QQ)                                                  # needs sage.modules
{0: Vector space of dimension 0 over Rational Field,
 1: Vector space of dimension 2 over Rational Field,
 2: Vector space of dimension 1 over Rational Field}
sage: RP2 = cubical_complexes.RealProjectivePlane()
sage: RP2.cohomology(dim=[1, 2], base_ring=GF(2))                               # needs sage.modules
{1: Vector space of dimension 1 over Finite Field of size 2,
 2: Vector space of dimension 1 over Finite Field of size 2}
>>> from sage.all import *
>>> T = S1.product(S1); T
Cubical complex with 16 vertices and 64 cubes
>>> T.chain_complex()                                                         # needs sage.modules
Chain complex with at most 3 nonzero terms over Integer Ring
>>> T.homology(base_ring=QQ)                                                  # needs sage.modules
{0: Vector space of dimension 0 over Rational Field,
 1: Vector space of dimension 2 over Rational Field,
 2: Vector space of dimension 1 over Rational Field}
>>> RP2 = cubical_complexes.RealProjectivePlane()
>>> RP2.cohomology(dim=[Integer(1), Integer(2)], base_ring=GF(Integer(2)))                               # needs sage.modules
{1: Vector space of dimension 1 over Finite Field of size 2,
 2: Vector space of dimension 1 over Finite Field of size 2}

Joins are not implemented:

sage: S1.join(S1)
Traceback (most recent call last):
...
NotImplementedError: joins are not implemented for cubical complexes
>>> from sage.all import *
>>> S1.join(S1)
Traceback (most recent call last):
...
NotImplementedError: joins are not implemented for cubical complexes

Therefore, neither are cones or suspensions.

alexander_whitney(cube, dim_left)[source]#

Subdivide cube in this cubical complex into pairs of cubes.

See Cube.alexander_whitney() for more details. This method just calls that one.

INPUT:

  • cube – a cube in this cubical complex

  • dim – integer between 0 and one more than the dimension of this cube

OUTPUT: a list containing triples (coeff, left, right)

EXAMPLES:

sage: C = cubical_complexes.Cube(3)
sage: c = list(C.n_cubes(3))[0]; c
[0,1] x [0,1] x [0,1]
sage: C.alexander_whitney(c, 1)
[(1, [0,1] x [0,0] x [0,0], [1,1] x [0,1] x [0,1]),
 (-1, [0,0] x [0,1] x [0,0], [0,1] x [1,1] x [0,1]),
 (1, [0,0] x [0,0] x [0,1], [0,1] x [0,1] x [1,1])]
>>> from sage.all import *
>>> C = cubical_complexes.Cube(Integer(3))
>>> c = list(C.n_cubes(Integer(3)))[Integer(0)]; c
[0,1] x [0,1] x [0,1]
>>> C.alexander_whitney(c, Integer(1))
[(1, [0,1] x [0,0] x [0,0], [1,1] x [0,1] x [0,1]),
 (-1, [0,0] x [0,1] x [0,0], [0,1] x [1,1] x [0,1]),
 (1, [0,0] x [0,0] x [0,1], [0,1] x [0,1] x [1,1])]
algebraic_topological_model(base_ring=None)[source]#

Algebraic topological model for this cubical complex with coefficients in base_ring.

The term “algebraic topological model” is defined by Pilarczyk and Réal [PR2015].

INPUT:

  • base_ring – coefficient ring (default: QQ). Must be a field.

Denote by \(C\) the chain complex associated to this cubical complex. The algebraic topological model is a chain complex \(M\) with zero differential, with the same homology as \(C\), along with chain maps \(\pi: C \to M\) and \(\iota: M \to C\) satisfying \(\iota \pi = 1_M\) and \(\pi \iota\) chain homotopic to \(1_C\). The chain homotopy \(\phi\) must satisfy

  • \(\phi \phi = 0\),

  • \(\pi \phi = 0\),

  • \(\phi \iota = 0\).

Such a chain homotopy is called a chain contraction.

OUTPUT: a pair consisting of

  • chain contraction phi associated to \(C\), \(M\), \(\pi\), and \(\iota\)

  • the chain complex \(M\)

Note that from the chain contraction phi, one can recover the chain maps \(\pi\) and \(\iota\) via phi.pi() and phi.iota(). Then one can recover \(C\) and \(M\) from, for example, phi.pi().domain() and phi.pi().codomain(), respectively.

EXAMPLES:

sage: # needs sage.modules
sage: RP2 = cubical_complexes.RealProjectivePlane()
sage: phi, M = RP2.algebraic_topological_model(GF(2))
sage: M.homology()
{0: Vector space of dimension 1 over Finite Field of size 2,
 1: Vector space of dimension 1 over Finite Field of size 2,
 2: Vector space of dimension 1 over Finite Field of size 2}
sage: T = cubical_complexes.Torus()
sage: phi, M = T.algebraic_topological_model(QQ)
sage: M.homology()
{0: Vector space of dimension 1 over Rational Field,
 1: Vector space of dimension 2 over Rational Field,
 2: Vector space of dimension 1 over Rational Field}
>>> from sage.all import *
>>> # needs sage.modules
>>> RP2 = cubical_complexes.RealProjectivePlane()
>>> phi, M = RP2.algebraic_topological_model(GF(Integer(2)))
>>> M.homology()
{0: Vector space of dimension 1 over Finite Field of size 2,
 1: Vector space of dimension 1 over Finite Field of size 2,
 2: Vector space of dimension 1 over Finite Field of size 2}
>>> T = cubical_complexes.Torus()
>>> phi, M = T.algebraic_topological_model(QQ)
>>> M.homology()
{0: Vector space of dimension 1 over Rational Field,
 1: Vector space of dimension 2 over Rational Field,
 2: Vector space of dimension 1 over Rational Field}
cells(subcomplex=None)[source]#

The cells of this cubical complex, in the form of a dictionary: the keys are integers, representing dimension, and the value associated to an integer d is the list of d-cells.

If the optional argument subcomplex is present, then return only the faces which are not in the subcomplex.

Parameters:

subcomplex (a cubical complex; optional, default None) – a subcomplex of this cubical complex

Returns:

cells of this complex not contained in subcomplex

Return type:

dictionary

EXAMPLES:

sage: S2 = cubical_complexes.Sphere(2)
sage: sorted(S2.cells()[2])
[[0,0] x [0,1] x [0,1],
 [0,1] x [0,0] x [0,1],
 [0,1] x [0,1] x [0,0],
 [0,1] x [0,1] x [1,1],
 [0,1] x [1,1] x [0,1],
 [1,1] x [0,1] x [0,1]]
>>> from sage.all import *
>>> S2 = cubical_complexes.Sphere(Integer(2))
>>> sorted(S2.cells()[Integer(2)])
[[0,0] x [0,1] x [0,1],
 [0,1] x [0,0] x [0,1],
 [0,1] x [0,1] x [0,0],
 [0,1] x [0,1] x [1,1],
 [0,1] x [1,1] x [0,1],
 [1,1] x [0,1] x [0,1]]
chain_complex(subcomplex=None, augmented=False, verbose=False, check=False, dimensions=None, base_ring=Integer Ring, cochain=False)[source]#

The chain complex associated to this cubical complex.

Parameters:
  • dimensions – if None, compute the chain complex in all dimensions. If a list or tuple of integers, compute the chain complex in those dimensions, setting the chain groups in all other dimensions to zero. NOT IMPLEMENTED YET: this function always returns the entire chain complex

  • base_ring (optional, default ZZ) – commutative ring

  • subcomplex (optional, default empty) – a subcomplex of this cubical complex. Compute the chain complex relative to this subcomplex.

  • augmented (boolean; optional, default: False) – If True, return the augmented chain complex (that is, include a class in dimension \(-1\) corresponding to the empty cell). This is ignored if dimensions is specified.

  • cochain (boolean; optional, default: False) – If True, return the cochain complex (that is, the dual of the chain complex).

  • verbose (boolean; optional, default: False) – If True, print some messages as the chain complex is computed.

  • check (boolean; optional, default: False) – If True, make sure that the chain complex is actually a chain complex: the differentials are composable and their product is zero.

Note

If subcomplex is nonempty, then the argument augmented has no effect: the chain complex relative to a nonempty subcomplex is zero in dimension \(-1\).

EXAMPLES:

sage: # needs sage.modules
sage: S2 = cubical_complexes.Sphere(2)
sage: S2.chain_complex()
Chain complex with at most 3 nonzero terms over Integer Ring
sage: Prod = S2.product(S2); Prod
Cubical complex with 64 vertices and 676 cubes
sage: Prod.chain_complex()
Chain complex with at most 5 nonzero terms over Integer Ring
sage: Prod.chain_complex(base_ring=QQ)
Chain complex with at most 5 nonzero terms over Rational Field
sage: C1 = cubical_complexes.Cube(1)
sage: S0 = cubical_complexes.Sphere(0)
sage: C1.chain_complex(subcomplex=S0)
Chain complex with at most 1 nonzero terms over Integer Ring
sage: C1.homology(subcomplex=S0)
{0: 0, 1: Z}
>>> from sage.all import *
>>> # needs sage.modules
>>> S2 = cubical_complexes.Sphere(Integer(2))
>>> S2.chain_complex()
Chain complex with at most 3 nonzero terms over Integer Ring
>>> Prod = S2.product(S2); Prod
Cubical complex with 64 vertices and 676 cubes
>>> Prod.chain_complex()
Chain complex with at most 5 nonzero terms over Integer Ring
>>> Prod.chain_complex(base_ring=QQ)
Chain complex with at most 5 nonzero terms over Rational Field
>>> C1 = cubical_complexes.Cube(Integer(1))
>>> S0 = cubical_complexes.Sphere(Integer(0))
>>> C1.chain_complex(subcomplex=S0)
Chain complex with at most 1 nonzero terms over Integer Ring
>>> C1.homology(subcomplex=S0)
{0: 0, 1: Z}

Check that Issue #32203 has been fixed:

sage: # needs sage.modules
sage: Square = CubicalComplex([([0,1],[0,1])])
sage: EdgesLTR = CubicalComplex([([0,0],[0,1]),([0,1],[1,1]),([1,1],[0,1])])
sage: EdgesLBR = CubicalComplex([([0,0],[0,1]),([0,1],[0,0]),([1,1],[0,1])])
sage: Square.homology(subcomplex=EdgesLTR)[2] == Square.homology(subcomplex=EdgesLBR)[2]
True
>>> from sage.all import *
>>> # needs sage.modules
>>> Square = CubicalComplex([([Integer(0),Integer(1)],[Integer(0),Integer(1)])])
>>> EdgesLTR = CubicalComplex([([Integer(0),Integer(0)],[Integer(0),Integer(1)]),([Integer(0),Integer(1)],[Integer(1),Integer(1)]),([Integer(1),Integer(1)],[Integer(0),Integer(1)])])
>>> EdgesLBR = CubicalComplex([([Integer(0),Integer(0)],[Integer(0),Integer(1)]),([Integer(0),Integer(1)],[Integer(0),Integer(0)]),([Integer(1),Integer(1)],[Integer(0),Integer(1)])])
>>> Square.homology(subcomplex=EdgesLTR)[Integer(2)] == Square.homology(subcomplex=EdgesLBR)[Integer(2)]
True
cone()[source]#

The cone on this cubical complex.

NOT IMPLEMENTED

The cone is the complex formed by taking the join of the original complex with a one-point complex (that is, a 0-dimensional cube). Since joins are not implemented for cubical complexes, neither are cones.

EXAMPLES:

sage: C1 = cubical_complexes.Cube(1)
sage: C1.cone()
Traceback (most recent call last):
...
NotImplementedError: cones are not implemented for cubical complexes
>>> from sage.all import *
>>> C1 = cubical_complexes.Cube(Integer(1))
>>> C1.cone()
Traceback (most recent call last):
...
NotImplementedError: cones are not implemented for cubical complexes
connected_sum(other)[source]#

Return the connected sum of self with other.

Parameters:

other – another cubical complex

Returns:

the connected sum self # other

Warning

This does not check that self and other are manifolds, only that their facets all have the same dimension. Since a (more or less) random facet is chosen from each complex and then glued together, this method may return random results if applied to non-manifolds, depending on which facet is chosen.

EXAMPLES:

sage: T = cubical_complexes.Torus()
sage: S2 = cubical_complexes.Sphere(2)
sage: T.connected_sum(S2).cohomology() == T.cohomology()                    # needs sage.modules
True
sage: RP2 = cubical_complexes.RealProjectivePlane()
sage: T.connected_sum(RP2).homology(1)                                      # needs sage.modules
Z x Z x C2
sage: RP2.connected_sum(RP2).connected_sum(RP2).homology(1)                 # needs sage.modules
Z x Z x C2
>>> from sage.all import *
>>> T = cubical_complexes.Torus()
>>> S2 = cubical_complexes.Sphere(Integer(2))
>>> T.connected_sum(S2).cohomology() == T.cohomology()                    # needs sage.modules
True
>>> RP2 = cubical_complexes.RealProjectivePlane()
>>> T.connected_sum(RP2).homology(Integer(1))                                      # needs sage.modules
Z x Z x C2
>>> RP2.connected_sum(RP2).connected_sum(RP2).homology(Integer(1))                 # needs sage.modules
Z x Z x C2
disjoint_union(other)[source]#

The disjoint union of this cubical complex with another one.

Parameters:

right – the other cubical complex (the right-hand factor)

Algorithm: first embed both complexes in d-dimensional Euclidean space. Then embed in (1+d)-dimensional space, calling the new axis \(x\), and putting the first complex at \(x=0\), the second at \(x=1\).

EXAMPLES:

sage: S1 = cubical_complexes.Sphere(1)
sage: S2 = cubical_complexes.Sphere(2)
sage: S1.disjoint_union(S2).homology()                                      # needs sage.modules
{0: Z, 1: Z, 2: Z}
>>> from sage.all import *
>>> S1 = cubical_complexes.Sphere(Integer(1))
>>> S2 = cubical_complexes.Sphere(Integer(2))
>>> S1.disjoint_union(S2).homology()                                      # needs sage.modules
{0: Z, 1: Z, 2: Z}
graph()[source]#

The 1-skeleton of this cubical complex, as a graph.

EXAMPLES:

sage: cubical_complexes.Sphere(2).graph()
Graph on 8 vertices
>>> from sage.all import *
>>> cubical_complexes.Sphere(Integer(2)).graph()
Graph on 8 vertices
is_pure()[source]#

True iff this cubical complex is pure: that is, all of its maximal faces have the same dimension.

Warning

This may give the wrong answer if the cubical complex was constructed with maximality_check set to False.

EXAMPLES:

sage: S4 = cubical_complexes.Sphere(4)
sage: S4.is_pure()
True
sage: C = CubicalComplex([([0,0], [3,3]), ([1,2], [4,5])])
sage: C.is_pure()
False
>>> from sage.all import *
>>> S4 = cubical_complexes.Sphere(Integer(4))
>>> S4.is_pure()
True
>>> C = CubicalComplex([([Integer(0),Integer(0)], [Integer(3),Integer(3)]), ([Integer(1),Integer(2)], [Integer(4),Integer(5)])])
>>> C.is_pure()
False
is_subcomplex(other)[source]#

Return True if self is a subcomplex of other.

Parameters:

other – a cubical complex

Each maximal cube of self must be a face of a maximal cube of other for this to be True.

EXAMPLES:

sage: S1 = cubical_complexes.Sphere(1)
sage: C0 = cubical_complexes.Cube(0)
sage: C1 = cubical_complexes.Cube(1)
sage: cyl = S1.product(C1)
sage: end = S1.product(C0)
sage: end.is_subcomplex(cyl)
True
sage: cyl.is_subcomplex(end)
False
>>> from sage.all import *
>>> S1 = cubical_complexes.Sphere(Integer(1))
>>> C0 = cubical_complexes.Cube(Integer(0))
>>> C1 = cubical_complexes.Cube(Integer(1))
>>> cyl = S1.product(C1)
>>> end = S1.product(C0)
>>> end.is_subcomplex(cyl)
True
>>> cyl.is_subcomplex(end)
False

The embedding of the cubical complex is important here:

sage: C2 = cubical_complexes.Cube(2)
sage: C1.is_subcomplex(C2)
False
sage: C1.product(C0).is_subcomplex(C2)
True
>>> from sage.all import *
>>> C2 = cubical_complexes.Cube(Integer(2))
>>> C1.is_subcomplex(C2)
False
>>> C1.product(C0).is_subcomplex(C2)
True

C1 is not a subcomplex of C2 because it’s not embedded in \(\RR^2\). On the other hand, C1 x C0 is a face of C2. Look at their maximal cells:

sage: C1.maximal_cells()
{[0,1]}
sage: C2.maximal_cells()
{[0,1] x [0,1]}
sage: C1.product(C0).maximal_cells()
{[0,1] x [0,0]}
>>> from sage.all import *
>>> C1.maximal_cells()
{[0,1]}
>>> C2.maximal_cells()
{[0,1] x [0,1]}
>>> C1.product(C0).maximal_cells()
{[0,1] x [0,0]}
join(other)[source]#

The join of this cubical complex with another one.

NOT IMPLEMENTED.

Parameters:

other – another cubical complex

EXAMPLES:

sage: C1 = cubical_complexes.Cube(1)
sage: C1.join(C1)
Traceback (most recent call last):
...
NotImplementedError: joins are not implemented for cubical complexes
>>> from sage.all import *
>>> C1 = cubical_complexes.Cube(Integer(1))
>>> C1.join(C1)
Traceback (most recent call last):
...
NotImplementedError: joins are not implemented for cubical complexes
maximal_cells()[source]#

The set of maximal cells (with respect to inclusion) of this cubical complex.

Returns:

Set of maximal cells

This just returns the set of cubes used in defining the cubical complex, so if the complex was defined with no maximality checking, none is done here, either.

EXAMPLES:

sage: interval = cubical_complexes.Cube(1)
sage: interval
Cubical complex with 2 vertices and 3 cubes
sage: interval.maximal_cells()
{[0,1]}
sage: interval.product(interval).maximal_cells()
{[0,1] x [0,1]}
>>> from sage.all import *
>>> interval = cubical_complexes.Cube(Integer(1))
>>> interval
Cubical complex with 2 vertices and 3 cubes
>>> interval.maximal_cells()
{[0,1]}
>>> interval.product(interval).maximal_cells()
{[0,1] x [0,1]}
n_cubes(n, subcomplex=None)[source]#

The set of cubes of dimension n of this cubical complex. If the optional argument subcomplex is present, then return the n-dimensional cubes which are not in the subcomplex.

Parameters:
  • n (integer) – dimension

  • subcomplex (a cubical complex; optional, default None) – a subcomplex of this cubical complex

Returns:

cells in dimension n

Return type:

set

EXAMPLES:

sage: C = cubical_complexes.Cube(3)
sage: C.n_cubes(3)
{[0,1] x [0,1] x [0,1]}
sage: sorted(C.n_cubes(2))
[[0,0] x [0,1] x [0,1],
 [0,1] x [0,0] x [0,1],
 [0,1] x [0,1] x [0,0],
 [0,1] x [0,1] x [1,1],
 [0,1] x [1,1] x [0,1],
 [1,1] x [0,1] x [0,1]]
>>> from sage.all import *
>>> C = cubical_complexes.Cube(Integer(3))
>>> C.n_cubes(Integer(3))
{[0,1] x [0,1] x [0,1]}
>>> sorted(C.n_cubes(Integer(2)))
[[0,0] x [0,1] x [0,1],
 [0,1] x [0,0] x [0,1],
 [0,1] x [0,1] x [0,0],
 [0,1] x [0,1] x [1,1],
 [0,1] x [1,1] x [0,1],
 [1,1] x [0,1] x [0,1]]
n_skeleton(n)[source]#

The n-skeleton of this cubical complex.

Parameters:

n (non-negative integer) – dimension

Returns:

cubical complex

EXAMPLES:

sage: S2 = cubical_complexes.Sphere(2)
sage: C3 = cubical_complexes.Cube(3)
sage: S2 == C3.n_skeleton(2)
True
>>> from sage.all import *
>>> S2 = cubical_complexes.Sphere(Integer(2))
>>> C3 = cubical_complexes.Cube(Integer(3))
>>> S2 == C3.n_skeleton(Integer(2))
True
product(other)[source]#

Return the product of this cubical complex with another one.

Parameters:

other – another cubical complex

EXAMPLES:

sage: RP2 = cubical_complexes.RealProjectivePlane()
sage: S1 = cubical_complexes.Sphere(1)
sage: RP2.product(S1).homology()[1] # long time: 5 seconds
Z x C2
>>> from sage.all import *
>>> RP2 = cubical_complexes.RealProjectivePlane()
>>> S1 = cubical_complexes.Sphere(Integer(1))
>>> RP2.product(S1).homology()[Integer(1)] # long time: 5 seconds
Z x C2
suspension(n=1)[source]#

The suspension of this cubical complex.

NOT IMPLEMENTED

Parameters:

n (positive integer; optional, default 1) – suspend this many times

The suspension is the complex formed by taking the join of the original complex with a two-point complex (the 0-sphere). Since joins are not implemented for cubical complexes, neither are suspensions.

EXAMPLES:

sage: C1 = cubical_complexes.Cube(1)
sage: C1.suspension()
Traceback (most recent call last):
...
NotImplementedError: suspensions are not implemented for cubical complexes
>>> from sage.all import *
>>> C1 = cubical_complexes.Cube(Integer(1))
>>> C1.suspension()
Traceback (most recent call last):
...
NotImplementedError: suspensions are not implemented for cubical complexes
wedge(other)[source]#

The wedge (one-point union) of this cubical complex with another one.

Parameters:

right – the other cubical complex (the right-hand factor)

Algorithm: if self is embedded in \(d\) dimensions and other in \(n\) dimensions, embed them in \(d+n\) dimensions: self using the first \(d\) coordinates, other using the last \(n\), translating them so that they have the origin as a common vertex.

Note

This operation is not well-defined if self or other is not path-connected.

EXAMPLES:

sage: S1 = cubical_complexes.Sphere(1)
sage: S2 = cubical_complexes.Sphere(2)
sage: S1.wedge(S2).homology()                                               # needs sage.modules
{0: 0, 1: Z, 2: Z}
>>> from sage.all import *
>>> S1 = cubical_complexes.Sphere(Integer(1))
>>> S2 = cubical_complexes.Sphere(Integer(2))
>>> S1.wedge(S2).homology()                                               # needs sage.modules
{0: 0, 1: Z, 2: Z}
class sage.topology.cubical_complex.CubicalComplexExamples[source]#

Bases: object

Some examples of cubical complexes.

Here are the available examples; you can also type “cubical_complexes.” and hit TAB to get a list:

Sphere
Torus
RealProjectivePlane
KleinBottle
SurfaceOfGenus
Cube

EXAMPLES:

sage: cubical_complexes.Torus()  # indirect doctest
Cubical complex with 16 vertices and 64 cubes
sage: cubical_complexes.Cube(7)
Cubical complex with 128 vertices and 2187 cubes
sage: cubical_complexes.Sphere(7)
Cubical complex with 256 vertices and 6560 cubes
>>> from sage.all import *
>>> cubical_complexes.Torus()  # indirect doctest
Cubical complex with 16 vertices and 64 cubes
>>> cubical_complexes.Cube(Integer(7))
Cubical complex with 128 vertices and 2187 cubes
>>> cubical_complexes.Sphere(Integer(7))
Cubical complex with 256 vertices and 6560 cubes
Cube(n)[source]#

A cubical complex representation of an \(n\)-dimensional cube.

Parameters:

n (non-negative integer) – the dimension

EXAMPLES:

sage: cubical_complexes.Cube(0)
Cubical complex with 1 vertex and 1 cube
sage: cubical_complexes.Cube(3)
Cubical complex with 8 vertices and 27 cubes
>>> from sage.all import *
>>> cubical_complexes.Cube(Integer(0))
Cubical complex with 1 vertex and 1 cube
>>> cubical_complexes.Cube(Integer(3))
Cubical complex with 8 vertices and 27 cubes
KleinBottle()[source]#

A cubical complex representation of the Klein bottle, formed by taking the connected sum of the real projective plane with itself.

EXAMPLES:

sage: cubical_complexes.KleinBottle()
Cubical complex with 42 vertices and 168 cubes
>>> from sage.all import *
>>> cubical_complexes.KleinBottle()
Cubical complex with 42 vertices and 168 cubes
RealProjectivePlane()[source]#

A cubical complex representation of the real projective plane. This is taken from the examples from CHomP, the Computational Homology Project: http://chomp.rutgers.edu/.

EXAMPLES:

sage: cubical_complexes.RealProjectivePlane()
Cubical complex with 21 vertices and 81 cubes
>>> from sage.all import *
>>> cubical_complexes.RealProjectivePlane()
Cubical complex with 21 vertices and 81 cubes
Sphere(n)[source]#

A cubical complex representation of the \(n\)-dimensional sphere, formed by taking the boundary of an \((n+1)\)-dimensional cube.

Parameters:

n (non-negative integer) – the dimension of the sphere

EXAMPLES:

sage: cubical_complexes.Sphere(7)
Cubical complex with 256 vertices and 6560 cubes
>>> from sage.all import *
>>> cubical_complexes.Sphere(Integer(7))
Cubical complex with 256 vertices and 6560 cubes
SurfaceOfGenus(g, orientable=True)[source]#

A surface of genus g as a cubical complex.

Parameters:
  • g (non-negative integer) – the genus

  • orientable (bool, optional, default: True) – whether the surface should be orientable

In the orientable case, return a sphere if \(g\) is zero, and otherwise return a \(g\)-fold connected sum of a torus with itself.

In the non-orientable case, raise an error if \(g\) is zero. If \(g\) is positive, return a \(g\)-fold connected sum of a real projective plane with itself.

EXAMPLES:

sage: cubical_complexes.SurfaceOfGenus(2)
Cubical complex with 32 vertices and 134 cubes
sage: cubical_complexes.SurfaceOfGenus(1, orientable=False)
Cubical complex with 21 vertices and 81 cubes
>>> from sage.all import *
>>> cubical_complexes.SurfaceOfGenus(Integer(2))
Cubical complex with 32 vertices and 134 cubes
>>> cubical_complexes.SurfaceOfGenus(Integer(1), orientable=False)
Cubical complex with 21 vertices and 81 cubes
Torus()[source]#

A cubical complex representation of the torus, obtained by taking the product of the circle with itself.

EXAMPLES:

sage: cubical_complexes.Torus()
Cubical complex with 16 vertices and 64 cubes
>>> from sage.all import *
>>> cubical_complexes.Torus()
Cubical complex with 16 vertices and 64 cubes