# How to list cosets

How can I get sage to list all left and right cosets; for example, all cosets of A4 in S4. From a sample worksheet, I tried evaluating the following, but only got a traceback:

G = SymmetricGroup(3)
a = G("(1,2)")
H = G.subgroup([a])
rc = G.RightCoset(H, side='right'); rc

Traceback (click to the left of this block for traceback) ... AttributeError: 'SymmetricGroup_with_category' object has no attribute 'RightCoset'

edit retag close merge delete

Sort by ยป oldest newest most voted

In Sage 4.6.2, which was just released, you can do

sage: G = SymmetricGroup(3)
sage: a = G("(1,2)")
sage: H = G.subgroup([a])
sage: G.cosets(H, side='right')
[[(), (1,2)], [(2,3), (1,3,2)], [(1,2,3), (1,3)]]


or

sage: G = SymmetricGroup(4)
sage: H = AlternatingGroup(4)
sage: G.cosets(H)
[[(), (2,3,4), (2,4,3), (1,2)(3,4), (1,2,3), (1,2,4), (1,3,2), (1,3,4), (1,3)(2,4), (1,4,2), (1,4,3), (1,4)(2,3)], [(3,4), (2,4), (2,3), (1,2), (1,2,4,3), (1,2,3,4), (1,4,3,2), (1,4), (1,4,2,3), (1,3,4,2), (1,3), (1,3,2,4)]]

more