[GAP Forum] Alignment problem for printing tables
Alexander Konovalov
alexk at mcs.st-andrews.ac.uk
Tue Apr 27 22:56:08 BST 2010
Dear Sandeep, dear Forum,
On 22 Apr 2010, at 06:55, Sandeep Murthy wrote:
> Hi.
>
> I've written a simple GAP program that prints a table of information
> in 3 columns for a given group:
>
> 1st column - shows distinct orders of proper subgroups realized by the group
> 2nd column - shows the number of distinct subgroups of the group of the
> order given
> by column 1
> 3rd column - shows a representative conjugacy class of the subgroup
>
> So the output for the the alternating group Alt(5) currently prints out
> like this:
>
> Order Number Of Subgroups Subgroup Conjugacy
> Class
> -------- ----------------- ----------------------------
>
> 2 15
> Group([ (2,3)(4,5) ])
> 3 10
> Group([ (3,4,5) ])
> 4 5
> Group([ (2,3)(4,5), (2,4)(3,5) ])
> 5 6
> Group([ (1,2,3,4,5) ])
> 6 10
> Group([ (3,4,5), (1,2)(4,5) ])
> 10 6
> Group([ (1,2,3,4,5), (2,5)(3,4) ])
> 12 5
> Group([ (2,3)(4,5), (2,4)(3,5), (3,4,5) ])
>
> Entries of column 1 and 2 are aligned with the headers, but the problem is
> that
> the third column entries are not aligned with the header. I tried to give
> each
> conjugacy class a string name, and then offset the print function exactly
> so that the
> name is aligned with the header, but the String( object ) methods doesn't
> seem to work
> for elements of ConjugacyClassesSubgroups( group ).
>
> Anyone have any suggestions?
>
> Sincerely, Sandeep.
If I am understanding this correctly, you want to say that String applied to
a conjugacy class of subgroups produces the output that is superfluous for
your purposes (see below). Could you apply String to a representative of a
conjugacy class? Then it will probably return a string containing exactly
what you need:
gap> G:=AlternatingGroup(5);
Alt( [ 1 .. 5 ] )
gap> cc:=ConjugacyClassesSubgroups(G);
[ Group( () )^G, Group( [ (2,3)(4,5) ] )^G, Group( [ (3,4,5) ] )^G,
Group( [ (2,3)(4,5), (2,4)(3,5) ] )^G, Group( [ (1,2,3,4,5) ] )^G,
Group( [ (3,4,5), (1,2)(4,5) ] )^G, Group( [ (1,2,3,4,5), (2,5)(3,4) ] )^G,
Group( [ (2,3)(4,5), (2,4)(3,5), (3,4,5) ] )^G,
AlternatingGroup( [ 1 .. 5 ] )^G ]
gap> String(cc[2]);
"ConjugacyClassSubgroups(AlternatingGroup( [ 1 .. 5 ] ),Group( \n[ (2,3)(4,5) \
] ))"
gap> String(Representative(cc[2]));
"Group( [ (2,3)(4,5) ] )"
Hope this helps,
Alexander
More information about the Forum
mailing list