4.2 Conjugacy classes

You can compute conjugacy classes of a finite group using Sage ``natively'':

sage: G = PermutationGroup(['(1,2,3)', '(1,2)(3,4)', '(1,7)'])
sage: CG = G.conjugacy_classes_representatives()
sage: gamma = CG[2]
sage: CG; gamma
[(), (1,2), (1,2)(3,4), (1,2,3), (1,2,3)(4,7), (1,2,3,4), (1,2,3,4,7)]
(1,2)(3,4)

You can use the Sage-GAP interface.

sage: gap.eval("G := Group((1,2)(3,4),(1,2,3))")
'Group([ (1,2)(3,4), (1,2,3) ])'
sage: gap.eval("CG := ConjugacyClasses(G)")
'[ ()^G, (1,2)(3,4)^G, (1,2,3)^G, (1,2,4)^G ]'
sage: gap.eval("gamma := CG[3]")
'(1,2,3)^G'
sage: gap.eval("g := Representative(gamma)")
'(1,2,3)'

Or, here's another (more ``pythonic'') way to do this type of computation:

sage: G = gap.Group('[(1,2,3), (1,2)(3,4), (1,7)]')
sage: CG = G.ConjugacyClasses()
sage: gamma = CG[2]
sage: g = gamma.Representative()
sage: CG; gamma; g
[ ConjugacyClass( SymmetricGroup( [ 1, 2, 3, 4, 7 ] ), () ), 
  ConjugacyClass( SymmetricGroup( [ 1, 2, 3, 4, 7 ] ), (1,2) ), 
  ConjugacyClass( SymmetricGroup( [ 1, 2, 3, 4, 7 ] ), (1,2)(3,4) ), 
  ConjugacyClass( SymmetricGroup( [ 1, 2, 3, 4, 7 ] ), (1,2,3) ), 
  ConjugacyClass( SymmetricGroup( [ 1, 2, 3, 4, 7 ] ), (1,2,3)(4,7) ), 
  ConjugacyClass( SymmetricGroup( [ 1, 2, 3, 4, 7 ] ), (1,2,3,4) ), 
  ConjugacyClass( SymmetricGroup( [ 1, 2, 3, 4, 7 ] ), (1,2,3,4,7) ) ]
ConjugacyClass( SymmetricGroup( [ 1, 2, 3, 4, 7 ] ), (1,2) )
(1,2)

See About this document... for information on suggesting changes.