Conjugacy classes of groups#

This module implements a wrapper of GAP’s ConjugacyClass function.

There are two main classes, ConjugacyClass and ConjugacyClassGAP. All generic methods should go into ConjugacyClass, whereas ConjugacyClassGAP should only contain wrappers for GAP functions. ConjugacyClass contains some fallback methods in case some group cannot be defined as a GAP object.

Todo

  • Implement a non-naive fallback method for computing all the elements of the conjugacy class when the group is not defined in GAP, as the one in Butler’s paper.

  • Define a sage method for gap matrices so that groups of matrices can use the quicker GAP algorithm rather than the naive one.

EXAMPLES:

Conjugacy classes for groups of permutations:

sage: G = SymmetricGroup(4)
sage: g = G((1,2,3,4))
sage: G.conjugacy_class(g)                                                          # needs sage.combinat
Conjugacy class of cycle type [4] in Symmetric group of order 4! as a permutation group
>>> from sage.all import *
>>> G = SymmetricGroup(Integer(4))
>>> g = G((Integer(1),Integer(2),Integer(3),Integer(4)))
>>> G.conjugacy_class(g)                                                          # needs sage.combinat
Conjugacy class of cycle type [4] in Symmetric group of order 4! as a permutation group

Conjugacy classes for groups of matrices:

sage: F = GF(5)
sage: gens = [matrix(F,2,[1,2, -1, 1]), matrix(F,2, [1,1, 0,1])]
sage: H = MatrixGroup(gens)
sage: h = H(matrix(F,2,[1,2, -1, 1]))
sage: H.conjugacy_class(h)
Conjugacy class of [1 2]
[4 1] in Matrix group over Finite Field of size 5 with 2 generators (
[1 2]  [1 1]
[4 1], [0 1]
)
>>> from sage.all import *
>>> F = GF(Integer(5))
>>> gens = [matrix(F,Integer(2),[Integer(1),Integer(2), -Integer(1), Integer(1)]), matrix(F,Integer(2), [Integer(1),Integer(1), Integer(0),Integer(1)])]
>>> H = MatrixGroup(gens)
>>> h = H(matrix(F,Integer(2),[Integer(1),Integer(2), -Integer(1), Integer(1)]))
>>> H.conjugacy_class(h)
Conjugacy class of [1 2]
[4 1] in Matrix group over Finite Field of size 5 with 2 generators (
[1 2]  [1 1]
[4 1], [0 1]
)
class sage.groups.conjugacy_classes.ConjugacyClass(group, element)[source]#

Bases: Parent

Generic conjugacy classes for elements in a group.

This is the default fall-back implementation to be used whenever GAP cannot handle the group.

EXAMPLES:

sage: G = SymmetricGroup(4)
sage: g = G((1,2,3,4))
sage: ConjugacyClass(G,g)
Conjugacy class of (1,2,3,4) in Symmetric group of order 4! as a
permutation group
>>> from sage.all import *
>>> G = SymmetricGroup(Integer(4))
>>> g = G((Integer(1),Integer(2),Integer(3),Integer(4)))
>>> ConjugacyClass(G,g)
Conjugacy class of (1,2,3,4) in Symmetric group of order 4! as a
permutation group
an_element()[source]#

Return a representative of self.

EXAMPLES:

sage: G = SymmetricGroup(3)
sage: g = G((1,2,3))
sage: C = ConjugacyClass(G,g)
sage: C.representative()
(1,2,3)
>>> from sage.all import *
>>> G = SymmetricGroup(Integer(3))
>>> g = G((Integer(1),Integer(2),Integer(3)))
>>> C = ConjugacyClass(G,g)
>>> C.representative()
(1,2,3)
is_rational()[source]#

Check if self is rational (closed for powers).

EXAMPLES:

sage: G = SymmetricGroup(4)
sage: g = G((1,2,3,4))
sage: c = ConjugacyClass(G,g)
sage: c.is_rational()
False
>>> from sage.all import *
>>> G = SymmetricGroup(Integer(4))
>>> g = G((Integer(1),Integer(2),Integer(3),Integer(4)))
>>> c = ConjugacyClass(G,g)
>>> c.is_rational()
False
is_real()[source]#

Check if self is real (closed for inverses).

EXAMPLES:

sage: G = SymmetricGroup(4)
sage: g = G((1,2,3,4))
sage: c = ConjugacyClass(G,g)
sage: c.is_real()
True
>>> from sage.all import *
>>> G = SymmetricGroup(Integer(4))
>>> g = G((Integer(1),Integer(2),Integer(3),Integer(4)))
>>> c = ConjugacyClass(G,g)
>>> c.is_real()
True
list()[source]#

Return a list with all the elements of self.

EXAMPLES:

Groups of permutations:

sage: G = SymmetricGroup(3)
sage: g = G((1,2,3))
sage: c = ConjugacyClass(G,g)
sage: L = c.list()
sage: Set(L) == Set([G((1,3,2)), G((1,2,3))])
True
>>> from sage.all import *
>>> G = SymmetricGroup(Integer(3))
>>> g = G((Integer(1),Integer(2),Integer(3)))
>>> c = ConjugacyClass(G,g)
>>> L = c.list()
>>> Set(L) == Set([G((Integer(1),Integer(3),Integer(2))), G((Integer(1),Integer(2),Integer(3)))])
True
representative()[source]#

Return a representative of self.

EXAMPLES:

sage: G = SymmetricGroup(3)
sage: g = G((1,2,3))
sage: C = ConjugacyClass(G,g)
sage: C.representative()
(1,2,3)
>>> from sage.all import *
>>> G = SymmetricGroup(Integer(3))
>>> g = G((Integer(1),Integer(2),Integer(3)))
>>> C = ConjugacyClass(G,g)
>>> C.representative()
(1,2,3)
set()[source]#

Return the set of elements of the conjugacy class.

EXAMPLES:

Groups of permutations:

sage: G = SymmetricGroup(3)
sage: g = G((1,2))
sage: C = ConjugacyClass(G,g)
sage: S = [(2,3), (1,2), (1,3)]
sage: C.set() == Set(G(x) for x in S)
True
>>> from sage.all import *
>>> G = SymmetricGroup(Integer(3))
>>> g = G((Integer(1),Integer(2)))
>>> C = ConjugacyClass(G,g)
>>> S = [(Integer(2),Integer(3)), (Integer(1),Integer(2)), (Integer(1),Integer(3))]
>>> C.set() == Set(G(x) for x in S)
True

Groups of matrices over finite fields:

sage: F = GF(5)
sage: gens = [matrix(F,2,[1,2, -1, 1]), matrix(F,2, [1,1, 0,1])]
sage: H = MatrixGroup(gens)
sage: h = H(matrix(F,2,[1,2, -1, 1]))
sage: C = ConjugacyClass(H,h)
sage: S = [[[3, 2], [2, 4]], [[0, 1], [2, 2]], [[3, 4], [1, 4]],\
      [[0, 3], [4, 2]], [[1, 2], [4, 1]], [[2, 1], [2, 0]],\
      [[4, 1], [4, 3]], [[4, 4], [1, 3]], [[2, 4], [3, 0]],\
      [[1, 4], [2, 1]], [[3, 3], [3, 4]], [[2, 3], [4, 0]],\
      [[0, 2], [1, 2]], [[1, 3], [1, 1]], [[4, 3], [3, 3]],\
      [[4, 2], [2, 3]], [[0, 4], [3, 2]], [[1, 1], [3, 1]],\
      [[2, 2], [1, 0]], [[3, 1], [4, 4]]]
sage: C.set() == Set(H(x) for x in S)
True
>>> from sage.all import *
>>> F = GF(Integer(5))
>>> gens = [matrix(F,Integer(2),[Integer(1),Integer(2), -Integer(1), Integer(1)]), matrix(F,Integer(2), [Integer(1),Integer(1), Integer(0),Integer(1)])]
>>> H = MatrixGroup(gens)
>>> h = H(matrix(F,Integer(2),[Integer(1),Integer(2), -Integer(1), Integer(1)]))
>>> C = ConjugacyClass(H,h)
>>> S = [[[Integer(3), Integer(2)], [Integer(2), Integer(4)]], [[Integer(0), Integer(1)], [Integer(2), Integer(2)]], [[Integer(3), Integer(4)], [Integer(1), Integer(4)]],\
      [[0, 3], [4, 2]], [[1, 2], [4, 1]], [[2, 1], [2, 0]],\
      [[4, 1], [4, 3]], [[4, 4], [1, 3]], [[2, 4], [3, 0]],\
      [[1, 4], [2, 1]], [[3, 3], [3, 4]], [[2, 3], [4, 0]],\
      [[0, 2], [1, 2]], [[1, 3], [1, 1]], [[4, 3], [3, 3]],\
      [[4, 2], [2, 3]], [[0, 4], [3, 2]], [[1, 1], [3, 1]],\
      [[2, 2], [1, 0]], [[3, 1], [4, 4]]]
>>> C.set() == Set(H(x) for x in S)
True

It is not implemented for infinite groups:

sage: a = matrix(ZZ,2,[1,1,0,1])
sage: b = matrix(ZZ,2,[1,0,1,1])
sage: G = MatrixGroup([a,b])        # takes 1s
sage: g = G(a)
sage: C = ConjugacyClass(G, g)
sage: C.set()
Traceback (most recent call last):
...
NotImplementedError: Listing the elements of conjugacy classes is not implemented for infinite groups! Use the iter function instead.
>>> from sage.all import *
>>> a = matrix(ZZ,Integer(2),[Integer(1),Integer(1),Integer(0),Integer(1)])
>>> b = matrix(ZZ,Integer(2),[Integer(1),Integer(0),Integer(1),Integer(1)])
>>> G = MatrixGroup([a,b])        # takes 1s
>>> g = G(a)
>>> C = ConjugacyClass(G, g)
>>> C.set()
Traceback (most recent call last):
...
NotImplementedError: Listing the elements of conjugacy classes is not implemented for infinite groups! Use the iter function instead.
class sage.groups.conjugacy_classes.ConjugacyClassGAP(group, element)[source]#

Bases: ConjugacyClass

Class for a conjugacy class for groups defined over GAP.

Intended for wrapping GAP methods on conjugacy classes.

INPUT:

  • group – the group in which the conjugacy class is taken

  • element – the element generating the conjugacy class

EXAMPLES:

sage: G = SymmetricGroup(4)
sage: g = G((1,2,3,4))
sage: ConjugacyClassGAP(G,g)
Conjugacy class of (1,2,3,4) in Symmetric group of order 4! as a
permutation group
>>> from sage.all import *
>>> G = SymmetricGroup(Integer(4))
>>> g = G((Integer(1),Integer(2),Integer(3),Integer(4)))
>>> ConjugacyClassGAP(G,g)
Conjugacy class of (1,2,3,4) in Symmetric group of order 4! as a
permutation group
cardinality()[source]#

Return the size of this conjugacy class.

EXAMPLES:

sage: # needs sage.rings.number_field
sage: W = WeylGroup(['C',6])
sage: cc = W.conjugacy_class(W.an_element())
sage: cc.cardinality()
3840
sage: type(cc.cardinality())
<class 'sage.rings.integer.Integer'>
>>> from sage.all import *
>>> # needs sage.rings.number_field
>>> W = WeylGroup(['C',Integer(6)])
>>> cc = W.conjugacy_class(W.an_element())
>>> cc.cardinality()
3840
>>> type(cc.cardinality())
<class 'sage.rings.integer.Integer'>
set()[source]#

Return a Sage Set with all the elements of the conjugacy class.

By default attempts to use GAP construction of the conjugacy class. If GAP method is not implemented for the given group, and the group is finite, falls back to a naive algorithm.

Warning

The naive algorithm can be really slow and memory intensive.

EXAMPLES:

Groups of permutations:

sage: G = SymmetricGroup(4)
sage: g = G((1,2,3,4))
sage: C = ConjugacyClassGAP(G,g)
sage: S = [(1,3,2,4), (1,4,3,2), (1,3,4,2), (1,2,3,4), (1,4,2,3), (1,2,4,3)]
sage: C.set() == Set(G(x) for x in S)
True
>>> from sage.all import *
>>> G = SymmetricGroup(Integer(4))
>>> g = G((Integer(1),Integer(2),Integer(3),Integer(4)))
>>> C = ConjugacyClassGAP(G,g)
>>> S = [(Integer(1),Integer(3),Integer(2),Integer(4)), (Integer(1),Integer(4),Integer(3),Integer(2)), (Integer(1),Integer(3),Integer(4),Integer(2)), (Integer(1),Integer(2),Integer(3),Integer(4)), (Integer(1),Integer(4),Integer(2),Integer(3)), (Integer(1),Integer(2),Integer(4),Integer(3))]
>>> C.set() == Set(G(x) for x in S)
True