The setup I give here is only examplary but shows how I want to use MappedWord in diverse contexts. I have
$S$ : A finite symmetric group with generators $s_1$ and $s_2$
$H$ : a known subgroup of $S$ generated by $h_1$ and $h_2$
$G$ : a group generated by two $120 \times 120$ matrices generated by $phi$ and $psi$ isomorphic to $S$ with corresponding generators.
I want to transfer the generators $h_i$ expressed as words in $s_i$ to $G$ using following code:
gap> F := FreeGroup("a","b");;
gap> AssignGeneratorVariables(F);;
#I Assigned the global variables [ a, b ]
gap> epi := EpimorphismFromFreeGroup(S:names := ["a","b"]);;
gap> wrd := PreImagesRepresentative(epi, (1,4)(2,5));
a*b^-1*a*b*a^-2*(a^-1*b^-1)^2*a^-2
gap> sigma := MappedWord(wrd,[a,b],[phi, psi]);
Error, no method found! For debugging hints type ?Recovery from NoMethod
...
gap> #But this works if I type in the word by hand (or ctrl+C, ctrl+V):
gap> sigma := MappedWord(a*b^-1*a*b*a^-2*(a^-1*b^-1)^2*a^-2,[a,b],[phi,psi]);;
This is ok if I work in a manual session but I don't know how to use MappedWord this way in a script.
If you call
EpimorphismFromFreeGroup, GAP creates a new free group, regardless how the generators are called. You can verify this by testingwhich will return
false.So what you should do is to ensure the generators are of the source of
epi, either by reordering the commands and changingF:or make
epia map fromF:Then everything should be fine.