gap> G:=DihedralGroup(20);
<pc group of size 20 with 3 generators>
gap> Elements(G);
[ <identity> of ..., f1, f2, f3, f1*f2, f1*f3, f2*f3, f3^2, f1*f2*f3, f1*f3^2, f2*f3^2, f3^3, f1*f2*f3^2, f1*f3^3, f2*f3^3, f3^4, f1*f2*f3^3, f1*f3^4, f2*f3^4, f1*f2*f3^4 ]
I am trying to do some calculations on elements of G, say the order of (f1*f2*f3).
I don't know how to access elements of G using the comments directly.
I tried to assign f3:=Elements(G)[3]; which worked but when group size is large (say $500, 1000$), knowing which index of the list corresponds to which index, have no clue.
Thanks in advance
You can use
AssignGeneratorVariables(see here), for example:but with care - for a new group you'd have to call it again, otherwise they will still refer to the old group.
Actually,
AssignGeneratorVariablesis only usable for small examples, when you can write indices by hand. Better practices would rely on the approaches, mentioned in comments above.As a small example to demonstrate capabilities, just to give a flavour of how it could look like, let's calculate how
f1conjugates generators of the groupG:The above calculation may print the output nicely, but on the other hand it's not usable. A better approach could be to save it to a list, which then can be used in other calculations. That can be done using
doloops as well, but also may be written using a more compact notation: