Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

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