direct product and direct sum of groups

Skip to first unread message

Mattia Villani

Mar 24, 2021, 10:53:06 AMMar 24
to sage-support
How can I calculate the direct product of two groups and/or the direct sum?
For example given:


how do I calculate H+H and HxH?


Mar 24, 2021, 11:59:44 AMMar 24
to sage-support
2021-03-24 14:53:06 UTC, Matt:
Having defined `H`, you can type


then hit the TAB key to see what methods are available.

This reveals the methods `cartesian_product`
and `direct_product`, are they what you need?

sage: G.<x, y> = FreeGroup()
sage: H = G.quotient([x*y])

sage: H.cartesian_product(H)
The Cartesian product of
(Finitely presented group < x, y | x*y >,
 Finitely presented group < x, y | x*y >)

sage: H.direct_product(H)
Finitely presented group < a, b, c, d |
    a*b, c*d, a^-1*c^-1*a*c, a^-1*d^-1*a*d,
    b^-1*c^-1*b*c, b^-1*d^-1*b*d >

Dima Pasechnik

Mar 24, 2021, 2:44:01 PMMar 24
to sage-support
careful here, FreeGroup is not Abelian, you'll want to add commuting relations
for all its generators.

You might prefer AbelianGroup() to begin with.

> --
> You received this message because you are subscribed to the Google Groups "sage-support" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to
> To view this discussion on the web visit
Reply all
Reply to author
0 new messages