Let's create some group as an example:
gap> G:=Group((1,9,6,7,5)(2,10,3,8,4), (1,10,7,8)(2,9,4,6));
Group([ (1,9,6,7,5)(2,10,3,8,4), (1,10,7,8)(2,9,4,6) ])
It has 8 conjugacy classes of elements:
gap> cc:=ConjugacyClasses(G);
[ ()^G, (3,4,9,7)(5,8,6,10)^G, (3,5,9,6)(4,10,7,8)^G, (3,9)(4,7)(5,6)(8,10)^G,
(2,3,9)(4,10,5)(6,8,7)^G, (1,2)(3,4,5,10,9,7,6,8)^G,
(1,2)(3,7,5,8,9,4,6,10)^G, (1,2,3,7,6)(4,8,5,9,10)^G ]
gap> Length(cc);
8
Let's take the 2nd of them:
gap> c:=cc[2];
(3,4,9,7)(5,8,6,10)^G
It contains 180 elements:
gap> Size(c);
180
and you can test membership of group elements in the conjugacy class as follows:
gap> (3,7,9,4)(5,10,6,8) in c;
true
gap> (3,7,6,8) in c;
false
Conjugacy class is not internally represented as a list of its elements - that would be very inefficient (for example, for algorithms that need only representatives of conjugacy classes). But if you need to get a list if all elements of the class, you can get them as follows:
gap> AsList(c);
[ (3,4,9,7)(5,8,6,10), (3,7,9,4)(5,10,6,8), (2,6,9,10)(4,7,8,5),
(2,10,9,6)(4,5,8,7), (2,10,7,5)(3,6,8,9), (2,5,7,10)(3,9,8,6),
(2,3,6,7)(4,9,10,8), (2,7,6,3)(4,8,10,9), (2,9,5,4)(3,8,10,7),
...
(1,9,6,10)(3,7,4,8), (1,10,6,9)(3,8,4,7), (1,3,4,10)(5,6,8,9),
(1,10,4,3)(5,9,8,6), (3,8,9,10)(4,5,7,6), (3,10,9,8)(4,6,7,5) ]
This may be very memory inefficient for large groups, but you can also iterate over its elements as follows:
gap> for x in c do
> Print(x,"\n");
> od;
( 3, 4, 9, 7)( 5, 8, 6,10)
( 3, 7, 9, 4)( 5,10, 6, 8)
...
( 3, 8, 9,10)( 4, 5, 7, 6)
( 3,10, 9, 8)( 4, 6, 7, 5)
without constructing the whole list, and also use enumerator which will give you a list-like behaviour:
gap> enum:=Enumerator(c);
<enumerator of (3,4,9,7)(5,8,6,10)^G>
gap> enum[2];
(3,7,9,4)(5,10,6,8)
gap> Position( enum, (3,7,9,4)(5,10,6,8) );
2
gap> Position( enum, (3,7,6,8) );
fail
also without constructing the whole list.
AsList
works for a conjugacy class, and for a group of order 2592, you should not have problems callingAsList(c)
for a classc
. – Olexandr Konovalov Jan 13 '18 at 22:03Display
quite rarely - it produces more verbose output, and I don't always need it. There are alsoPrint
andView
(for some objects, they may delegate one to another). As you see in my answer, I don't use any of them explicitly, since what GAP uses in read-evaluate-print loop isView
. See http://www.gap-system.org/Manuals/doc/ref/chap6.html#X8074A8387C9DB9A8 – Olexandr Konovalov Jan 15 '18 at 14:22