Dear GAP Forum,
Nicola Sottocornola asked:
this is my question. I've defined a group G by generators and relations.
1) How can I obtain all the elements g in G s.t. g^2=u?
First of all it should be understood that in general the word problem
for a finitely presented group is algorithmically unsolvable, that is,
it is not possible to answer a question like this for an arbitrary
finitely presented group. If however the finitely presented group is
in fact finite there are trial and error methods, in particular the
so-called Todd-Coxeter method, to find a faithful permutation
representation of the finitely presented group and using this (behind
the back of the user) GAP can deal with a question like this (of course
only if the group is not only finite but small enough).
Here is an example how this can be done (the presentation used is a
presentation for the generalised quaternion group of order 16) and as
you see GAP does in fact show you only words in the generators of the
finitely presented group and not what is happening behind the scene.
gap> F := FreeGroup( "a", "b" ); <free group on the generators [ a, b ]> gap> a := F.1;; b := F.2;; gap> G := F / [ a^8, b^4, a^4*b^-2, b^-1*a*b*a ]; <fp group on the generators [ a, b ]> gap> a := G.1;; b := G.2;; gap> Size( G ); 16 gap> elts := AsSortedList( G ); [ <identity ...>, a, b, a^2, a*b, a^7*b, a^4, a^3, a^2*b, a^5, a^6*b, a^4*b, a^3*b, a^6, a^5*b, a^7 ] gap> u := b^2; b^2 gap> result := Filtered( elts, g -> g^2 = u ); [ b, a^2, a*b, a^7*b, a^2*b, a^6*b, a^4*b, a^3*b, a^6, a^5*b ]
Hope this answers the question,