ASKSAGE: Sage Q&A Forum - Individual question feedhttp://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Sat, 26 Mar 2011 07:07:48 -0500Calculate Right Cosetshttp://ask.sagemath.org/question/8024/calculate-right-cosets/How do I get sage to list the right cosets for the group G = GL2(F3) and the subgroup H consisting of the upper triangular matrices with 1 on the main diagonal?Fri, 25 Mar 2011 11:58:22 -0500http://ask.sagemath.org/question/8024/calculate-right-cosets/Answer by benjaminfjones for <p>How do I get sage to list the right cosets for the group G = GL2(F3) and the subgroup H consisting of the upper triangular matrices with 1 on the main diagonal?</p>
http://ask.sagemath.org/question/8024/calculate-right-cosets/?answer=12227#post-id-12227You can construct `GL(2, F3)` in Sage using:
G=GL(2,GF(3))
See the reference manual for more about what you can do with a general linear group in Sage:
[http://www.sagemath.org/doc/reference/sage/groups/matrix_gps/general_linear.html](http://www.sagemath.org/doc/reference/sage/groups/matrix_gps/general_linear.html)
As for cosets in Sage, some groups have this implemented, like the permutation groups:
H = PermutationGroup([(1,2),(1,2,3)])
P = H.subgroup([(2,3)])
H.cosets(P, side='right')
[[(), (2,3)], [(1,2), (1,2,3)], [(1,3,2), (1,3)]
But this isn't implemented directly in Sage for groups like the general linear group over a finite field. You could input `GL(2, F3)` into Sage as a permutation group (this is a good exercise perhaps) and use the `cosets` method.
%gap
# define general linear group
G := GL(2,3);;
P := NiceObject(G);
Print(P,"\n");
# define upper triangular subgroup
g1 := [[Z(3),0*Z(3)],[0*Z(3),Z(3)]];;
g2 := [[Z(3),Z(3)],[0*Z(3),Z(3)]];;
M := Group(g1,g2);;
MP := NiceObject(M);
Print(MP);
Group( [ (4,7)(5,8)(6,9), (2,7,6)(3,4,8) ] )
Group( [ (2,3)(4,7)(5,9)(6,8), (2,3)(4,9,6,7,5,8) ] )
Then in Sage:
G = PermutationGroup([ [(4,7),(5,8),(6,9)], [(2,7,6),(3,4,8)] ])
H = G.subgroup( [[(2,3),(4,7),(5,9),(6,8)], [(2,3),(4,9,6,7,5,8)]] )
G.cosets(H, side='right')
Of course you could do all of that directly in GAP (through Sage or not) if you want and it will be much faster for larger groups.Sat, 26 Mar 2011 07:07:48 -0500http://ask.sagemath.org/question/8024/calculate-right-cosets/?answer=12227#post-id-12227