Accessing Elements of Group in GAP

503 Views Asked by At
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

1

There are 1 best solutions below

0
On

You can use AssignGeneratorVariables (see here), for example:

gap> G:=DihedralGroup(20);
<pc group of size 20 with 3 generators>
gap> AssignGeneratorVariables(G);
#I  Assigned the global variables [ f1, f2, f3 ]
gap> Order(f1*f2*f3);
2

but with care - for a new group you'd have to call it again, otherwise they will still refer to the old group.

Actually, AssignGeneratorVariables is 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 f1 conjugates generators of the group G:

gap> G:=DihedralGroup(20);
<pc group of size 20 with 3 generators>
gap> gens:=GeneratorsOfGroup(G);
[ f1, f2, f3 ]
gap> a:=gens[1];
f1
gap> for g in gens do
> Print( g, " -> ", g^a, "\n");
> od;
f1 -> f1
f2 -> f2*f3^4
f3 -> f3^4
gap> 

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 do loops as well, but also may be written using a more compact notation:

gap> s := List(gens, g -> g^a);
[ f1, f2*f3^4, f3^4 ]