On Fri, Jul 31, 2009 at 6:47 PM, javier<vengor...@gmail.com> wrote: > If that you want are the cosets you can get them simply using > > cosets = Set([Set([h*g for h in H]) for g in G]) > > or if you want to get a representative of each coset you can then use > > reps = [x[0] for x in cosets]
This will force you to enumerate the elements of the group G, and that's not always a quick thing to do (e.g. what if you're working in the Alternating group on 10 points?). Gap provides RightCosets, CanonicalRightCosetElement and Representative for working with cosets efficiently: ######################## G = gap.AlternatingGroup(4) g = '(1,2,3)' H = gap.Subgroup(G, [g]) rc = gap.RightCosets(G, H) print "Canonical representatives:" for x in gap.List(G): print "H" + str(x) + ":", gap.CanonicalRightCosetElement(H, x) print print "Representatives:" for C in gap.List(rc): print C, ":", gap.Representative(C) ######################## Canonical representatives: H(): () H(1,2)(3,4): (2,4,3) H(1,3)(2,4): (2,3,4) H(1,4)(2,3): (1,2,4) H(2,3,4): (2,3,4) H(1,2,4): (1,2,4) H(1,3,2): () H(1,4,3): (2,4,3) H(2,4,3): (2,4,3) H(1,2,3): () H(1,3,4): (1,2,4) H(1,4,2): (2,3,4) Representatives: RightCoset(Group( [ (1,2,3) ] ),()) : () RightCoset(Group( [ (1,2,3) ] ),(1,2)(3,4)) : (1,2)(3,4) RightCoset(Group( [ (1,2,3) ] ),(1,3)(2,4)) : (1,3)(2,4) RightCoset(Group( [ (1,2,3) ] ),(1,4)(2,3)) : (1,4)(2,3) -- Carlo Hamalainen http://carlo-hamalainen.net --~--~---------~--~----~------------~-------~--~----~ To post to this group, send an email to sage-devel@googlegroups.com To unsubscribe from this group, send an email to sage-devel-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URLs: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---