ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Thu, 30 May 2024 21:12:02 +0200Rank of Homology Groups?https://ask.sagemath.org/question/77686/rank-of-homology-groups/ 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!
PMWed, 29 May 2024 19:38:56 +0200https://ask.sagemath.org/question/77686/rank-of-homology-groups/Comment by FrédéricC for <p>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.' </p>
<p>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(). </p>
<p>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!</p>
<p>PM</p>
https://ask.sagemath.org/question/77686/rank-of-homology-groups/?comment=77696#post-id-77696See also https://github.com/sagemath/sage/pull/35835Thu, 30 May 2024 07:43:25 +0200https://ask.sagemath.org/question/77686/rank-of-homology-groups/?comment=77696#post-id-77696Comment by WinterStorm7 for <p>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.' </p>
<p>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(). </p>
<p>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!</p>
<p>PM</p>
https://ask.sagemath.org/question/77686/rank-of-homology-groups/?comment=77691#post-id-77691You 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().Wed, 29 May 2024 22:40:11 +0200https://ask.sagemath.org/question/77686/rank-of-homology-groups/?comment=77691#post-id-77691Comment by Max Alekseyev for <p>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.' </p>
<p>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(). </p>
<p>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!</p>
<p>PM</p>
https://ask.sagemath.org/question/77686/rank-of-homology-groups/?comment=77688#post-id-77688Please provide an actual code illustrating the issue.Wed, 29 May 2024 22:17:22 +0200https://ask.sagemath.org/question/77686/rank-of-homology-groups/?comment=77688#post-id-77688Answer by John Palmieri for <p>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.' </p>
<p>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(). </p>
<p>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!</p>
<p>PM</p>
https://ask.sagemath.org/question/77686/rank-of-homology-groups/?answer=77689#post-id-77689You 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]
Wed, 29 May 2024 22:20:32 +0200https://ask.sagemath.org/question/77686/rank-of-homology-groups/?answer=77689#post-id-77689Comment by FrédéricC for <p>You can use the <code>invariants</code> method:</p>
<pre><code>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)
</code></pre>
<p>If you want the rank, count how many zeroes are in this list. If you want the torsion, look at the nonzero entries.</p>
<pre><code>sage: T3.homology(1).invariants().count(0)
6
sage: H
Z x C2
sage: [x for x in H.invariants() if x > 0]
[2]
</code></pre>
https://ask.sagemath.org/question/77686/rank-of-homology-groups/?comment=77701#post-id-77701also one can work over QQ
sage: C=simplicial_complexes.Sphere(4)
sage: h = C.homology(base_ring=QQ)
sage: h[4].dimension()
1Thu, 30 May 2024 21:12:02 +0200https://ask.sagemath.org/question/77686/rank-of-homology-groups/?comment=77701#post-id-77701Comment by WinterStorm7 for <p>You can use the <code>invariants</code> method:</p>
<pre><code>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)
</code></pre>
<p>If you want the rank, count how many zeroes are in this list. If you want the torsion, look at the nonzero entries.</p>
<pre><code>sage: T3.homology(1).invariants().count(0)
6
sage: H
Z x C2
sage: [x for x in H.invariants() if x > 0]
[2]
</code></pre>
https://ask.sagemath.org/question/77686/rank-of-homology-groups/?comment=77690#post-id-77690Ah, thank you this helps a lot!Wed, 29 May 2024 22:38:37 +0200https://ask.sagemath.org/question/77686/rank-of-homology-groups/?comment=77690#post-id-77690