3
$\begingroup$

How can I list the sizes of centers of groups of order $288$ in GAP? By GAP we know that there are $1045$ groups of this order by the command below:

G:=AllSmallGroups(288);;

I want to obtain Size(Center(G[i])) for $i = 1, \dots, 1045$ , respectively.

In fact I want to compute the difference between values of Size(Center(G[i])) and NrConjugacyClasses of corresponding G[i], for $i = 1, \dots, 1045$.

  • 1
    What is stopping you?2017-01-02
  • 1
    By looping over all of the 1045 groups, I would guess?2017-01-02
  • 1
    If this is just about how to make GAP do this, then it is not a very good fit for this site, but I would suggest you look up the List function.2017-01-02
  • 0
    It is time-consuming. I want a command or program which shows the list immediately. Like List(G,NrConjugacyClasses).2017-01-02
  • 0
    Does this really take more than a few minutes?2017-01-02
  • 0
    @Tobias Kildetoft: In fact I want to compute the difference between values of NrConjugacyClasses of G[i] and Size(Center(G[i])) for i=1,...,1045, which is time-consuming. Is there a function to compute this?2017-01-02
  • 2
    Computing that difference took about 10-20 second on my 5-year old laptop.2017-01-02
  • 0
    How do you compute that? with which commands? Would you please send me the commands you use?2017-01-02
  • 0
    As I said, just use the List command.2017-01-02
  • 0
    You can use the `List` command in the same way: `List(G,x->Size(Center(x)));` The `x->` is short hand notation for a 1-argument function.2017-01-02

1 Answers 1

4

This is the way I do; I don't know more shortcult commands (but there are)!

G:=AllSmallGroups(288);;
l:=[ ];;
for i in [1..Size(G)] do
    Add(l, Size(Center(G[i])));
od;
l;
  • 0
    This is pretty much what the command List does (thought it might be implemented in a way that works slightly faster).2017-01-02
  • 0
    yes; I have never practised it, but I have heard of it, so said "I don't know" but "there are!"2017-01-02
  • 0
    @p Groups: It didn't work on my laptop. There is no output with this function.2017-01-02
  • 0
    @M.R. Right, you need to ask it to output the list is has generated.2017-01-02
  • 0
    @Tobias Kildetoft: I am amateur in GAP. Would you please tell me how can i see the output?2017-01-02
  • 0
    type this thing- l;2017-01-02
  • 0
    This is not what I want. This is the set of values that appear in the set of sizes of centers of G[i]. But what I need is the list of sizes of centers of corresponding G[i], respectively. In fact I want to compute the difference between values of Size(Center(G[i])) and NrConjugacyClasses of corresponding G[i] for i=1,...,1045.2017-01-02
  • 0
    @M.R. Then subtract one from the other. They are listed in the same order as the groups by construction.2017-01-02
  • 0
    This is the output: gap> G:=AllSmallGroups(288);; gap> l:=[ ];; gap> for i in [1..Size(G)] do > AddSet(l, Size(Center(G[i])));od; gap> l; [ 1, 2, 3, 4, 6, 8, 12, 16, 18, 24, 36, 48, 72, 288 ]2017-01-02
  • 2
    @M.R. Ohh, actually, you should use Add instead of AddSet to get what I just said2017-01-02
  • 0
    What do you want then? Doesn't it answer's your question?2017-01-02
  • 0
    @Beginner: I have the set of NrConjugacyClasses of G[i] and the set of sizes of centers of G[i]. I need the subtraction of elements of these two sets.2017-01-02
  • 0
    @M.R. Did you understand how those sets were computed? From that it is pretty straightforward to get what you need.2017-01-02
  • 2
    gap> for i in [1..Size(G)] do ..... gap> a:=NrConjugacyClasses(G[i]); ..... b:=Size(Center(G[i]));.... AddSet( l , [ i, a, b, a-b ] );.... fi;.... od; [I have written commands with gap of dots; these dots should not be considered in program. I think you will understood this modification of program of pGroups.)2017-01-02
  • 0
    @Beginner. Thank You.2017-01-02
  • 1
    Note that shorter code may not be the most efficient one, especially if `NrSmallGroups(n)` is very large. You can iterate like `for i in [1..NrSmallGroups(n)] do g:=SmallGroup(n,i); ... od`. Also sometimes `SmallGroupsInformation` gives useful insights into how the groups of a given order are arranged in the library. I suggest to look at [Software Carpentry lesson on GAP](http://alex-konovalov.github.io/gap-lesson/05-small-groups/) for some sample code.2017-01-02
  • 0
    @ Alexander Konovalov. The link was very useful. Thank you for it.2017-01-03