![]() | 1 | initial version |
You can use the invariants
method:
sage: K = simplicial_complexes.KleinBottle()
sage: H = K.homology(1)
sage: H.invariants()
(2, 0)
sage: T3 = simplicial_complexes.SurfaceOfGenus(3)
sage: T3.homology(1)
Z^6
sage: T3.homology(1).invariants()
(0, 0, 0, 0, 0, 0)
If you want the rank, count how many zeroes are in this list. If you want the torsion, look at the nonzero entries.
sage: T3.homology(1).invariants().count(0)
6
sage: H
Z x C2
sage: [x for x in H.invariants() if x > 0]
[2]