Filtering Non-abelian groups of fixed order in GAP

220 Views Asked by At

I was learning GAP commands for operations on groups. I needed to consider non-abelian groups for simplicity in computation. The command Filtered is useful to find out abelian groups in the following way:

S:=Filtered(AllSmallGroups(16), G -> IsAbelian(G));

This returns a list of abelian groups of order 16.

However, there is no direct replacement of IsAbelian(G) to IsNonAbelian(G) [wrong command].

I tried to write following:

S:=Filtered(AllSmallGroups(16), G -> IsAbelian(G)=false);

This returned list containing all groups (of order 16). [Edit :This command works actually as suggested in answer by Alexander Konovalov.]

S:=Filtered(AllSmallGroups(16), G -> IsAbelian(G)==false);

This returend an error.

How do I modify above commands to get list of non-abelian groups of order $16$ using filtered (I have idea of getting it by for loop; but I am getting it by Filtered if possible).

1

There are 1 best solutions below

0
On BEST ANSWER

Expanding my comment above to the proper answer:

The input

S:=Filtered(AllSmallGroups(16), G -> IsAbelian(G)=false); 

is syntactically correct, and it actually returns 9 groups (not all 14 groups) of order 16.

The last command from the question gives an error because GAP does not use == for comparison, like some other programming languages, e.g. Python.

Finally, your initial approach first computes all groups of order 16, and then iterates through them to find non-abelian ones. For larger orders, this will use more space to store larger lists of groups, and more time needed first to create a list of all groups, and then to check them one by one. A more efficient way is to use

AllSmallGroups(Size,16,IsAbelian,false); 

which will rely on precomputed properties of groups and will return a list of them without creating a large overhead. For each order, SmallGroupsInformation will tell which properties are precomputed:

gap> SmallGroupsInformation(16);

  There are 14 groups of order 16.
  They are sorted by their ranks. 
     1 is cyclic. 
     2 - 9 have rank 2.
     10 - 13 have rank 3.
     14 is elementary abelian. 

  For the selection functions the values of the following attributes 
  are precomputed and stored:
     IsAbelian, PClassPGroup, RankPGroup, FrattinifactorSize and 
     FrattinifactorId. 

  This size belongs to layer 2 of the SmallGroups library. 
  IdSmallGroup is available for this size. 

When you deal with a property which is not precomputed, it may be useful first to quickly narrow down the selection by using one of the precomputed properties, and then search within the resulting list of groups.

Another memory-saving trick is to use IdsOfAllSmallGroups instead:

gap> IdsOfAllSmallGroups(Size,16,IsAbelian,false);
[ [ 16, 3 ], [ 16, 4 ], [ 16, 6 ], [ 16, 7 ], [ 16, 8 ], [ 16, 9 ], 
  [ 16, 11 ], [ 16, 12 ], [ 16, 13 ] ]

This may prevent running out of memory when a large number of groups is returned in the output.

The GAP Carpentries-style lesson is based around an example of finding groups with some interesting property (namely, groups with an average order of an element being an integer) in the GAP Small Groups Library - I hope you may find there other helpful tips on using it.