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, 11 Nov 2021 20:47:22 +0100Implementing Subgroupshttps://ask.sagemath.org/question/59688/implementing-subgroups/I created my own implementation of a specific group, inheriting from Group, following the pattern in the tutorial here:
https://doc.sagemath.org/html/en/thematic_tutorials/coercion_and_categories.html
I can construct elements, multiply them and find inverses.
My group is infinite, but I know that any finitely generated subgroup is finite. I'd like to have something where I can do:
sage: G = myGroup()
sage: g_1,g_2,g3 = some elements of G
sage: G2 = G.subgroup([g1,g2])
sage: g3 in G2
True/False
sage: G2.order()
35
sage: G2.list_elements()
...
My question is, do I have to implement this all "from scratch", or can sage already do most if this if I've implemented the multiplication? How do I make it work with the category framework, so G1 is a group, and has a cannonical conversion to G? (if that is the right thing to want.)
Thu, 11 Nov 2021 17:15:36 +0100https://ask.sagemath.org/question/59688/implementing-subgroups/Comment by Max Alekseyev for <p>I created my own implementation of a specific group, inheriting from Group, following the pattern in the tutorial here: </p>
<p><a href="https://doc.sagemath.org/html/en/thematic_tutorials/coercion_and_categories.html">https://doc.sagemath.org/html/en/them...</a></p>
<p>I can construct elements, multiply them and find inverses.</p>
<p>My group is infinite, but I know that any finitely generated subgroup is finite. I'd like to have something where I can do:</p>
<pre><code>sage: G = myGroup()
sage: g_1,g_2,g3 = some elements of G
sage: G2 = G.subgroup([g1,g2])
sage: g3 in G2
True/False
sage: G2.order()
35
sage: G2.list_elements()
...
</code></pre>
<p>My question is, do I have to implement this all "from scratch", or can sage already do most if this if I've implemented the multiplication? How do I make it work with the category framework, so G1 is a group, and has a cannonical conversion to G? (if that is the right thing to want.)</p>
https://ask.sagemath.org/question/59688/implementing-subgroups/?comment=59694#post-id-59694It'd help first to see how all this works for some standard group, before translating to a custom implementation.Thu, 11 Nov 2021 20:47:22 +0100https://ask.sagemath.org/question/59688/implementing-subgroups/?comment=59694#post-id-59694