Understanding group structure using GAP My question is regarding how to understand structure of group using GAP. Using StructureDescription(G), GAP gives some information like it is direct product or semidirect product of some well known groups but information is usually incomplete. For example I want to know group structure of SmallGroup(64,238). It is semidirect product of $\text{Q}_8$ with $\text{Q}_8$. How to get using GAP what is automorphism used in semidirect product or in other words how to get finite presentation of group.
 A: Once you have the group, first find the normal subgroup. It needs to be of order 8, its isomorphism type and the one of the factor should be that of Q8 (which is [8,4]), and it needs to have a complement
gap> g:=SmallGroup(64,238);
<pc group of size 64 with 6 generators>
gap> IdGroup(QuaternionGroup(8));
[ 8, 4 ]
gap> n:=Filtered(NormalSubgroups(g),x->Size(x)=8 and not IsAbelian(x)
> and IdGroup(x)=[8,4] and IdGroup(g/x)=[8,4]    
> and Length(ComplementClassesRepresentatives(g,x))>0);
[ Group([ f2*f6, f4*f6, f5 ]), Group([ f2*f6, f4, f5 ]),     
  Group([ f2, f4*f6, f5 ]), Group([ f2, f4, f5 ]) ]

There are four possible normal subgroups, I just pick one of them. Similarly just one complement (other choices could give you other actions)
gap> n:=n[1];
Group([ f2*f6, f4*f6, f5 ])
gap> c:=ComplementClassesRepresentatives(g,n);
[ <pc group with 3 generators>, <pc group with 3 generators>, [...]
gap> c:=c[1];
<pc group with 3 generators>

To get a presentation, start with one for $Q_8$ (and turn on pretty-print) for words and establish isomorphisms to normal subgroup and complement.
gap> f:=FreeGroup("i","j","k");    
<free group on the generators [ i, j, k ]>
gap> rels:=ParseRelators(f,"i22=j2=k2=ijk,i^4");
[ k^2*j^-2, i^22*j^-2, i*j*k*j^-2, i^4 ]
gap> q:=f/rels;
<fp group on the generators [ i, j, k ]>
gap> Size(q);
8
gap> SetReducedMultiplication(q);
gap> iso1:=IsomorphismGroups(q,n);
[ i, j, k ] -> [ f2*f6, f4*f6, f2*f4 ]
gap> iso2:=IsomorphismGroups(q,c);
[ i, j, k ] -> [ f1, f3, f1*f3 ]

What is left is to describe the automorphism action for the 3 complement generators on the normal subgroup, here at the example of $i$:
gap> AssignGeneratorVariables(q);                               
gap> imgs:=List(GeneratorsOfGroup(q),x->PreImagesRepresentative(iso1,
> ImagesRepresentative(iso1,x)^ImagesRepresentative(iso2,i # also do for j,k
> )));
[ i^-1, j, k^-1 ]

So the presentation will include relations such as: (using generators in,jn,kn and ic,jc,kc):
$$in^{ic}=in^{-1}, jn^{ic}=jn, kn^{ic}=kn^{-1}$$
and so on.
