Relative Homology¶
Relative homology is currently only supported for the bats.SimplicialComplex
type.
[1]:
import bats
[2]:
def print_cpx(X):
for k in range(X.maxdim() + 1):
print("{}: {} cells".format(k, X.ncells(k)))
[3]:
X = bats.SimplicialComplex()
X.add_recursive((0,1,2))
print_cpx(X)
0: 3 cells
1: 3 cells
2: 1 cells
[4]:
A = bats.SimplicialComplex()
A.add_recursive((0,1))
A.add_recursive((1,2))
A.add_recursive((0,2))
print_cpx(A)
0: 3 cells
1: 3 cells
Build the relative chain complex \(C_\ast(X, A)\)
[5]:
CXA = bats.Chain(X,A,bats.F2())
[6]:
RXA = bats.reduce(CXA)
[7]:
for k in range(RXA.maxdim()+1):
print("dim H_{}: {}".format(k, RXA.hdim(k)))
dim H_0: 0
dim H_1: 0
dim H_2: 1
Induced Maps¶
If we have a map \(f:X\to Y\), \(A\subseteq X\) and \(B\subseteq Y\) with \(f(A) \subseteq B\), then we can compute an induced map on relative homology.
[8]:
Y = bats.SimplicialComplex()
Y.add_recursive((0,1,2))
Y.add_recursive((1,2,3))
print_cpx(Y)
0: 4 cells
1: 5 cells
2: 2 cells
[9]:
B = bats.SimplicialComplex()
B.add_recursive((1,2,3))
B.add_recursive((0,1))
B.add_recursive((0,2))
print_cpx(B)
0: 4 cells
1: 5 cells
2: 1 cells
Let’s now compute Homology
[10]:
CYB = bats.Chain(Y, B, bats.F2())
RYB = bats.reduce(CYB)
[11]:
for k in range(RYB.maxdim()+1):
print("dim H_{}: {}".format(k, RYB.hdim(k)))
dim H_0: 0
dim H_1: 0
dim H_2: 1
We’ll use the inclusion map \(X\to Y\).
[12]:
f = bats.SimplicialMap(X, Y)
[13]:
F = bats.Chain(f, X, A, Y, B, bats.F2())
[22]:
for k in range(3):
print("induced map in dimension {}".format(k))
Ftil = bats.InducedMap(F, RXA, RYB,k)
print(Ftil.tolist())
induced map in dimension 0
[]
induced map in dimension 1
[]
induced map in dimension 2
[[1]]
We see that the induced map is an isomorphism in all dimensions (the first two dimension have 0-dimensional homology).
[ ]: