When working with group cosets in MAGMA is there a way of treating the cosets as subsets of the overlying group. Specifically I have a group $G$ and subgroups $H$ and $K$ . I wish to look at the intersection of a pair of cosets $Hh$ and $Kk$ for some $h,k\in G$ , but am unable to perform such operations in MAGMA when they are considered as cosets.
As far as I can see, the only way to do that directly with cosets $ C1$ and $C2$ of $G$ is
$\{ x : x\ {\rm in}\ G\ \ x\ {\rm in}\ C1\ {\rm and}\ x\ {\rm in}\ C2 \}$
which looks very inefficient, because it is iterating over all of $G$.
I would suggest first find a right transversal $T$ of $H \cap K$ in $H$, and then search through $T$ looking for an element $t \in T$ with $thk^{1} \in K$. If you find such a $t$, then the intersection is the coset $(H \cap K)th$, and otherwise it is empty.

$\begingroup$ Thanks for that. I was using a similar kind of approach and looping through the cosets of the two groups. $\endgroup$ – dward1996 Apr 3 '12 at 8:45
Well, this is trivial in GAP. Here is an example:
gap> G:=SymmetricGroup(7);;
gap> H:=Stabilizer(G,1);;
gap> K:=SylowSubgroup(G,2);;
gap> c1:=RightCoset(H,(1,2));;
gap> c2:=RightCoset(K,(1,2,3));;
gap> Intersection(c1,c2);
[ (1,2,3), (1,2,3)(5,6), (1,2,3,4), (1,2,3,4)(5,6) ]
gap>
By the way, GAP is free, unlike Magma...

1$\begingroup$ Thanks. I was trying to avoid using GAP for now, as I'm only just getting the hang of MAGMA, but it appears that it is worth investing the time to learn the language. $\endgroup$ – dward1996 Apr 3 '12 at 8:45

$\begingroup$ IMHO, GAP language is easier to use, in particular it's much less strict in the ways it handles types of data. And you can read (and modify, if needed) the GAP source code if you're really stuck :) $\endgroup$ – Dima Pasechnik Apr 3 '12 at 17:06

$\begingroup$ Just out of interest are there any other good sources for learning GAP other than the GAP manuals (gapsystem.org/Doc/manuals.html)? $\endgroup$ – dward1996 Apr 4 '12 at 8:38

1$\begingroup$ gapsystem.org/Doc/Learning/learning.html contains quite a few links to tutorials, examples, etc. gapsystem.org/Doc/forumarchive.html (GAP Forum) is a mailing list you can subscribe to. $\endgroup$ – Dima Pasechnik Apr 4 '12 at 14:09