Ask Your Question

Rank of Homology Groups?

asked 2024-05-29 19:38:56 +0200

WinterStorm7 gravatar image

I'm trying to compute Magnitude Homology, but when compiling and running the code I keep getting the error: 'HomologyGroup_class_with_category' object has no attribute 'rank.'

I've tried other methods for trying to compute the rank of the Homology Groups, but it's the same thing. Not all the typical functions used for Abelian Groups carries over to Homology in sagemath. The only functions I've found that work are .ngens(), .invariants(), .gens(), and .order().

Can someone please explain to me how to find the rank of the Homology groups I'm trying to work with? I'm looking for torsion, so any explanation on how to work with these will be a big help!


edit retag flag offensive close merge delete


Please provide an actual code illustrating the issue.

Max Alekseyev gravatar imageMax Alekseyev ( 2024-05-29 22:17:22 +0200 )edit

You could define any simplicial complex "C" and then ask for C.rank() and this will get you the error. Other functions like C.ngens(), C.invariants(), and C.gens() will work but an error always shows up for C.rank().

WinterStorm7 gravatar imageWinterStorm7 ( 2024-05-29 22:40:11 +0200 )edit
FrédéricC gravatar imageFrédéricC ( 2024-05-30 07:43:25 +0200 )edit

1 Answer

Sort by » oldest newest most voted

answered 2024-05-29 22:20:32 +0200

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)
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)

sage: H
Z x C2
sage: [x for x in H.invariants() if x > 0]
edit flag offensive delete link more


Ah, thank you this helps a lot!

WinterStorm7 gravatar imageWinterStorm7 ( 2024-05-29 22:38:37 +0200 )edit

also one can work over QQ

sage: C=simplicial_complexes.Sphere(4)
sage: h = C.homology(base_ring=QQ)
sage: h[4].dimension()
FrédéricC gravatar imageFrédéricC ( 2024-05-30 21:12:02 +0200 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools


Asked: 2024-05-29 19:38:56 +0200

Seen: 151 times

Last updated: May 29