Mix-in Class for GAP-based Groups#

This class adds access to GAP functionality to groups such that parent and element have a gap() method that returns a GAP object for the parent/element.

If your group implementation uses libgap, then you should add GroupMixinLibGAP as the first class that you are deriving from. This ensures that it properly overrides any default methods that just raise NotImplementedError.

class sage.groups.libgap_mixin.GroupMixinLibGAP[source]#

Bases: object

cardinality()[source]#

Implement EnumeratedSets.ParentMethods.cardinality().

EXAMPLES:

sage: G = Sp(4,GF(3))
sage: G.cardinality()
51840

sage: G = SL(4,GF(3))
sage: G.cardinality()
12130560

sage: F = GF(5); MS = MatrixSpace(F,2,2)
sage: gens = [MS([[1,2],[-1,1]]),MS([[1,1],[0,1]])]
sage: G = MatrixGroup(gens)
sage: G.cardinality()
480

sage: G = MatrixGroup([matrix(ZZ,2,[1,1,0,1])])
sage: G.cardinality()
+Infinity

sage: G = Sp(4,GF(3))
sage: G.cardinality()
51840

sage: G = SL(4,GF(3))
sage: G.cardinality()
12130560

sage: F = GF(5); MS = MatrixSpace(F,2,2)
sage: gens = [MS([[1,2],[-1,1]]),MS([[1,1],[0,1]])]
sage: G = MatrixGroup(gens)
sage: G.cardinality()
480

sage: G = MatrixGroup([matrix(ZZ,2,[1,1,0,1])])
sage: G.cardinality()
+Infinity
>>> from sage.all import *
>>> G = Sp(Integer(4),GF(Integer(3)))
>>> G.cardinality()
51840

>>> G = SL(Integer(4),GF(Integer(3)))
>>> G.cardinality()
12130560

>>> F = GF(Integer(5)); MS = MatrixSpace(F,Integer(2),Integer(2))
>>> gens = [MS([[Integer(1),Integer(2)],[-Integer(1),Integer(1)]]),MS([[Integer(1),Integer(1)],[Integer(0),Integer(1)]])]
>>> G = MatrixGroup(gens)
>>> G.cardinality()
480

>>> G = MatrixGroup([matrix(ZZ,Integer(2),[Integer(1),Integer(1),Integer(0),Integer(1)])])
>>> G.cardinality()
+Infinity

>>> G = Sp(Integer(4),GF(Integer(3)))
>>> G.cardinality()
51840

>>> G = SL(Integer(4),GF(Integer(3)))
>>> G.cardinality()
12130560

>>> F = GF(Integer(5)); MS = MatrixSpace(F,Integer(2),Integer(2))
>>> gens = [MS([[Integer(1),Integer(2)],[-Integer(1),Integer(1)]]),MS([[Integer(1),Integer(1)],[Integer(0),Integer(1)]])]
>>> G = MatrixGroup(gens)
>>> G.cardinality()
480

>>> G = MatrixGroup([matrix(ZZ,Integer(2),[Integer(1),Integer(1),Integer(0),Integer(1)])])
>>> G.cardinality()
+Infinity
center()[source]#

Return the center of this group as a subgroup.

OUTPUT: the center as a subgroup

EXAMPLES:

sage: G = SU(3, GF(2))                                                      # needs sage.rings.finite_rings
sage: G.center()                                                            # needs sage.rings.finite_rings
Subgroup with 1 generators (
[a 0 0]
[0 a 0]
[0 0 a]
) of Special Unitary Group of degree 3 over Finite Field in a of size 2^2
sage: GL(2, GF(3)).center()
Subgroup with 1 generators (
[2 0]
[0 2]
) of General Linear Group of degree 2 over Finite Field of size 3
sage: GL(3, GF(3)).center()
Subgroup with 1 generators (
[2 0 0]
[0 2 0]
[0 0 2]
) of General Linear Group of degree 3 over Finite Field of size 3
sage: GU(3, GF(2)).center()                                                 # needs sage.rings.finite_rings
Subgroup with 1 generators (
[a + 1     0     0]
[    0 a + 1     0]
[    0     0 a + 1]
) of General Unitary Group of degree 3 over Finite Field in a of size 2^2

sage: A = Matrix(FiniteField(5), [[2,0,0], [0,3,0], [0,0,1]])
sage: B = Matrix(FiniteField(5), [[1,0,0], [0,1,0], [0,1,1]])
sage: MatrixGroup([A,B]).center()
Subgroup with 1 generators (
[1 0 0]
[0 1 0]
[0 0 1]
) of Matrix group over Finite Field of size 5 with 2 generators (
[2 0 0]  [1 0 0]
[0 3 0]  [0 1 0]
[0 0 1], [0 1 1]
)

sage: GL = groups.matrix.GL(3, ZZ)
sage: GL.center()
Traceback (most recent call last):
...
NotImplementedError: group must be finite
>>> from sage.all import *
>>> G = SU(Integer(3), GF(Integer(2)))                                                      # needs sage.rings.finite_rings
>>> G.center()                                                            # needs sage.rings.finite_rings
Subgroup with 1 generators (
[a 0 0]
[0 a 0]
[0 0 a]
) of Special Unitary Group of degree 3 over Finite Field in a of size 2^2
>>> GL(Integer(2), GF(Integer(3))).center()
Subgroup with 1 generators (
[2 0]
[0 2]
) of General Linear Group of degree 2 over Finite Field of size 3
>>> GL(Integer(3), GF(Integer(3))).center()
Subgroup with 1 generators (
[2 0 0]
[0 2 0]
[0 0 2]
) of General Linear Group of degree 3 over Finite Field of size 3
>>> GU(Integer(3), GF(Integer(2))).center()                                                 # needs sage.rings.finite_rings
Subgroup with 1 generators (
[a + 1     0     0]
[    0 a + 1     0]
[    0     0 a + 1]
) of General Unitary Group of degree 3 over Finite Field in a of size 2^2

>>> A = Matrix(FiniteField(Integer(5)), [[Integer(2),Integer(0),Integer(0)], [Integer(0),Integer(3),Integer(0)], [Integer(0),Integer(0),Integer(1)]])
>>> B = Matrix(FiniteField(Integer(5)), [[Integer(1),Integer(0),Integer(0)], [Integer(0),Integer(1),Integer(0)], [Integer(0),Integer(1),Integer(1)]])
>>> MatrixGroup([A,B]).center()
Subgroup with 1 generators (
[1 0 0]
[0 1 0]
[0 0 1]
) of Matrix group over Finite Field of size 5 with 2 generators (
[2 0 0]  [1 0 0]
[0 3 0]  [0 1 0]
[0 0 1], [0 1 1]
)

>>> GL = groups.matrix.GL(Integer(3), ZZ)
>>> GL.center()
Traceback (most recent call last):
...
NotImplementedError: group must be finite
centralizer(g)[source]#

Return the centralizer of g in self.

EXAMPLES:

sage: G = groups.matrix.GL(2, 3)
sage: g = G([[1,1], [1,0]])
sage: C = G.centralizer(g); C
Subgroup with 3 generators (
[1 1]  [2 0]  [2 1]
[1 0], [0 2], [1 1]
) of General Linear Group of degree 2 over Finite Field of size 3
sage: C.order()
8

sage: S = G.subgroup([G([[2,0],[0,2]]), G([[0,1],[2,0]])]); S
Subgroup with 2 generators (
[2 0]  [0 1]
[0 2], [2 0]
) of General Linear Group of degree 2 over Finite Field of size 3
sage: G.centralizer(S)
Subgroup with 3 generators (
[2 0]  [0 1]  [2 2]
[0 2], [2 0], [1 2]
) of General Linear Group of degree 2 over Finite Field of size 3
sage: G = GL(3,2)
sage: all(G.order() == G.centralizer(x).order() * G.conjugacy_class(x).cardinality()
....:     for x in G)
True
sage: H = groups.matrix.Heisenberg(2)
sage: H.centralizer(H.an_element())
Traceback (most recent call last):
...
NotImplementedError: group must be finite
>>> from sage.all import *
>>> G = groups.matrix.GL(Integer(2), Integer(3))
>>> g = G([[Integer(1),Integer(1)], [Integer(1),Integer(0)]])
>>> C = G.centralizer(g); C
Subgroup with 3 generators (
[1 1]  [2 0]  [2 1]
[1 0], [0 2], [1 1]
) of General Linear Group of degree 2 over Finite Field of size 3
>>> C.order()
8

>>> S = G.subgroup([G([[Integer(2),Integer(0)],[Integer(0),Integer(2)]]), G([[Integer(0),Integer(1)],[Integer(2),Integer(0)]])]); S
Subgroup with 2 generators (
[2 0]  [0 1]
[0 2], [2 0]
) of General Linear Group of degree 2 over Finite Field of size 3
>>> G.centralizer(S)
Subgroup with 3 generators (
[2 0]  [0 1]  [2 2]
[0 2], [2 0], [1 2]
) of General Linear Group of degree 2 over Finite Field of size 3
>>> G = GL(Integer(3),Integer(2))
>>> all(G.order() == G.centralizer(x).order() * G.conjugacy_class(x).cardinality()
...     for x in G)
True
>>> H = groups.matrix.Heisenberg(Integer(2))
>>> H.centralizer(H.an_element())
Traceback (most recent call last):
...
NotImplementedError: group must be finite
character(values)[source]#

Return a group character from values, where values is a list of the values of the character evaluated on the conjugacy classes.

INPUT:

  • values – a list of values of the character

OUTPUT: a group character

EXAMPLES:

sage: G = MatrixGroup(AlternatingGroup(4))
sage: G.character([1]*len(G.conjugacy_classes_representatives()))           # needs sage.rings.number_field
Character of Matrix group over Integer Ring with 12 generators
>>> from sage.all import *
>>> G = MatrixGroup(AlternatingGroup(Integer(4)))
>>> G.character([Integer(1)]*len(G.conjugacy_classes_representatives()))           # needs sage.rings.number_field
Character of Matrix group over Integer Ring with 12 generators
sage: G = GL(2,ZZ)
sage: G.character([1,1,1,1])
Traceback (most recent call last):
...
NotImplementedError: only implemented for finite groups
>>> from sage.all import *
>>> G = GL(Integer(2),ZZ)
>>> G.character([Integer(1),Integer(1),Integer(1),Integer(1)])
Traceback (most recent call last):
...
NotImplementedError: only implemented for finite groups
character_table()[source]#

Return the matrix of values of the irreducible characters of this group \(G\) at its conjugacy classes.

The columns represent the conjugacy classes of \(G\) and the rows represent the different irreducible characters in the ordering given by GAP.

OUTPUT: a matrix defined over a cyclotomic field

EXAMPLES:

sage: MatrixGroup(SymmetricGroup(2)).character_table()                      # needs sage.rings.number_field
[ 1 -1]
[ 1  1]
sage: MatrixGroup(SymmetricGroup(3)).character_table()                      # needs sage.rings.number_field
[ 1  1 -1]
[ 2 -1  0]
[ 1  1  1]
sage: MatrixGroup(SymmetricGroup(5)).character_table()  # long time
[ 1 -1 -1  1 -1  1  1]
[ 4  0  1 -1 -2  1  0]
[ 5  1 -1  0 -1 -1  1]
[ 6  0  0  1  0  0 -2]
[ 5 -1  1  0  1 -1  1]
[ 4  0 -1 -1  2  1  0]
[ 1  1  1  1  1  1  1]
>>> from sage.all import *
>>> MatrixGroup(SymmetricGroup(Integer(2))).character_table()                      # needs sage.rings.number_field
[ 1 -1]
[ 1  1]
>>> MatrixGroup(SymmetricGroup(Integer(3))).character_table()                      # needs sage.rings.number_field
[ 1  1 -1]
[ 2 -1  0]
[ 1  1  1]
>>> MatrixGroup(SymmetricGroup(Integer(5))).character_table()  # long time
[ 1 -1 -1  1 -1  1  1]
[ 4  0  1 -1 -2  1  0]
[ 5  1 -1  0 -1 -1  1]
[ 6  0  0  1  0  0 -2]
[ 5 -1  1  0  1 -1  1]
[ 4  0 -1 -1  2  1  0]
[ 1  1  1  1  1  1  1]
class_function(values)[source]#

Return the class function with given values.

INPUT:

  • values – list/tuple/iterable of numbers; the values of the class function on the conjugacy classes, in that order

EXAMPLES:

sage: G = GL(2,GF(3))
sage: chi = G.class_function(range(8))                                      # needs sage.rings.number_field
sage: list(chi)                                                             # needs sage.rings.number_field
[0, 1, 2, 3, 4, 5, 6, 7]
>>> from sage.all import *
>>> G = GL(Integer(2),GF(Integer(3)))
>>> chi = G.class_function(range(Integer(8)))                                      # needs sage.rings.number_field
>>> list(chi)                                                             # needs sage.rings.number_field
[0, 1, 2, 3, 4, 5, 6, 7]
conjugacy_class(g)[source]#

Return the conjugacy class of g.

OUTPUT:

The conjugacy class of g in the group self. If self is the group denoted by \(G\), this method computes the set \(\{x^{-1}gx\ \vert\ x\in G\}\).

EXAMPLES:

sage: G = SL(2, QQ)
sage: g = G([[1,1],[0,1]])
sage: G.conjugacy_class(g)
Conjugacy class of [1 1]
[0 1] in Special Linear Group of degree 2 over Rational Field
>>> from sage.all import *
>>> G = SL(Integer(2), QQ)
>>> g = G([[Integer(1),Integer(1)],[Integer(0),Integer(1)]])
>>> G.conjugacy_class(g)
Conjugacy class of [1 1]
[0 1] in Special Linear Group of degree 2 over Rational Field
conjugacy_classes()[source]#

Return a list with all the conjugacy classes of self.

EXAMPLES:

sage: G = SL(2, GF(2))
sage: G.conjugacy_classes()
(Conjugacy class of [1 0]
 [0 1] in Special Linear Group of degree 2 over Finite Field of size 2,
 Conjugacy class of [0 1]
 [1 0] in Special Linear Group of degree 2 over Finite Field of size 2,
 Conjugacy class of [0 1]
 [1 1] in Special Linear Group of degree 2 over Finite Field of size 2)
>>> from sage.all import *
>>> G = SL(Integer(2), GF(Integer(2)))
>>> G.conjugacy_classes()
(Conjugacy class of [1 0]
 [0 1] in Special Linear Group of degree 2 over Finite Field of size 2,
 Conjugacy class of [0 1]
 [1 0] in Special Linear Group of degree 2 over Finite Field of size 2,
 Conjugacy class of [0 1]
 [1 1] in Special Linear Group of degree 2 over Finite Field of size 2)
sage: GL(2,ZZ).conjugacy_classes()
Traceback (most recent call last):
...
NotImplementedError: only implemented for finite groups
>>> from sage.all import *
>>> GL(Integer(2),ZZ).conjugacy_classes()
Traceback (most recent call last):
...
NotImplementedError: only implemented for finite groups
conjugacy_classes_representatives()[source]#

Return a set of representatives for each of the conjugacy classes of the group.

EXAMPLES:

sage: G = SU(3,GF(2))                                                       # needs sage.rings.finite_rings
sage: len(G.conjugacy_classes_representatives())                            # needs sage.rings.finite_rings
16

sage: G = GL(2,GF(3))
sage: G.conjugacy_classes_representatives()
(
[1 0]  [0 2]  [2 0]  [0 2]  [0 2]  [0 1]  [0 1]  [2 0]
[0 1], [1 1], [0 2], [1 2], [1 0], [1 2], [1 1], [0 1]
)

sage: len(GU(2,GF(5)).conjugacy_classes_representatives())                  # needs sage.rings.finite_rings
36
>>> from sage.all import *
>>> G = SU(Integer(3),GF(Integer(2)))                                                       # needs sage.rings.finite_rings
>>> len(G.conjugacy_classes_representatives())                            # needs sage.rings.finite_rings
16

>>> G = GL(Integer(2),GF(Integer(3)))
>>> G.conjugacy_classes_representatives()
(
[1 0]  [0 2]  [2 0]  [0 2]  [0 2]  [0 1]  [0 1]  [2 0]
[0 1], [1 1], [0 2], [1 2], [1 0], [1 2], [1 1], [0 1]
)

>>> len(GU(Integer(2),GF(Integer(5))).conjugacy_classes_representatives())                  # needs sage.rings.finite_rings
36
sage: GL(2,ZZ).conjugacy_classes_representatives()
Traceback (most recent call last):
...
NotImplementedError: only implemented for finite groups
>>> from sage.all import *
>>> GL(Integer(2),ZZ).conjugacy_classes_representatives()
Traceback (most recent call last):
...
NotImplementedError: only implemented for finite groups
conjugacy_classes_subgroups()[source]#

Return a complete list of representatives of conjugacy classes of subgroups in self.

The ordering is that given by GAP.

EXAMPLES:

sage: G = groups.matrix.GL(2,2)
sage: G.conjugacy_classes_subgroups()
[Subgroup with 0 generators ()
   of General Linear Group of degree 2 over Finite Field of size 2,
 Subgroup with 1 generators (
 [1 1]
 [0 1]
 ) of General Linear Group of degree 2 over Finite Field of size 2,
 Subgroup with 1 generators (
 [0 1]
 [1 1]
 ) of General Linear Group of degree 2 over Finite Field of size 2,
 Subgroup with 2 generators (
 [0 1]  [1 1]
 [1 1], [0 1]
 ) of General Linear Group of degree 2 over Finite Field of size 2]

sage: H = groups.matrix.Heisenberg(2)
sage: H.conjugacy_classes_subgroups()
Traceback (most recent call last):
...
NotImplementedError: group must be finite
>>> from sage.all import *
>>> G = groups.matrix.GL(Integer(2),Integer(2))
>>> G.conjugacy_classes_subgroups()
[Subgroup with 0 generators ()
   of General Linear Group of degree 2 over Finite Field of size 2,
 Subgroup with 1 generators (
 [1 1]
 [0 1]
 ) of General Linear Group of degree 2 over Finite Field of size 2,
 Subgroup with 1 generators (
 [0 1]
 [1 1]
 ) of General Linear Group of degree 2 over Finite Field of size 2,
 Subgroup with 2 generators (
 [0 1]  [1 1]
 [1 1], [0 1]
 ) of General Linear Group of degree 2 over Finite Field of size 2]

>>> H = groups.matrix.Heisenberg(Integer(2))
>>> H.conjugacy_classes_subgroups()
Traceback (most recent call last):
...
NotImplementedError: group must be finite
exponent()[source]#

Computes the exponent of the group.

The exponent \(e\) of a group \(G\) is the LCM of the orders of its elements, that is, \(e\) is the smallest integer such that \(g^e = 1\) for all \(g \in G\).

EXAMPLES:

sage: G = groups.matrix.GL(2, 3)
sage: G.exponent()
24

sage: H = groups.matrix.Heisenberg(2)
sage: H.exponent()
Traceback (most recent call last):
...
NotImplementedError: group must be finite
>>> from sage.all import *
>>> G = groups.matrix.GL(Integer(2), Integer(3))
>>> G.exponent()
24

>>> H = groups.matrix.Heisenberg(Integer(2))
>>> H.exponent()
Traceback (most recent call last):
...
NotImplementedError: group must be finite
group_id()[source]#

Return the ID code of self, which is a list of two integers.

It is a unique identified assigned by GAP for groups in the SmallGroup library.

EXAMPLES:

sage: PGL(2,3).group_id()
[24, 12]
sage: SymmetricGroup(4).group_id()
[24, 12]

sage: G = groups.matrix.GL(2, 2)
sage: G.group_id()
[6, 1]
sage: G = groups.matrix.GL(2, 3)
sage: G.id()
[48, 29]

sage: G = groups.matrix.GL(2, ZZ)
sage: G.group_id()
Traceback (most recent call last):
...
GAPError: Error, the group identification for groups of size infinity is not available
>>> from sage.all import *
>>> PGL(Integer(2),Integer(3)).group_id()
[24, 12]
>>> SymmetricGroup(Integer(4)).group_id()
[24, 12]

>>> G = groups.matrix.GL(Integer(2), Integer(2))
>>> G.group_id()
[6, 1]
>>> G = groups.matrix.GL(Integer(2), Integer(3))
>>> G.id()
[48, 29]

>>> G = groups.matrix.GL(Integer(2), ZZ)
>>> G.group_id()
Traceback (most recent call last):
...
GAPError: Error, the group identification for groups of size infinity is not available
id()[source]#

Return the ID code of self, which is a list of two integers.

It is a unique identified assigned by GAP for groups in the SmallGroup library.

EXAMPLES:

sage: PGL(2,3).group_id()
[24, 12]
sage: SymmetricGroup(4).group_id()
[24, 12]

sage: G = groups.matrix.GL(2, 2)
sage: G.group_id()
[6, 1]
sage: G = groups.matrix.GL(2, 3)
sage: G.id()
[48, 29]

sage: G = groups.matrix.GL(2, ZZ)
sage: G.group_id()
Traceback (most recent call last):
...
GAPError: Error, the group identification for groups of size infinity is not available
>>> from sage.all import *
>>> PGL(Integer(2),Integer(3)).group_id()
[24, 12]
>>> SymmetricGroup(Integer(4)).group_id()
[24, 12]

>>> G = groups.matrix.GL(Integer(2), Integer(2))
>>> G.group_id()
[6, 1]
>>> G = groups.matrix.GL(Integer(2), Integer(3))
>>> G.id()
[48, 29]

>>> G = groups.matrix.GL(Integer(2), ZZ)
>>> G.group_id()
Traceback (most recent call last):
...
GAPError: Error, the group identification for groups of size infinity is not available
intersection(other)[source]#

Return the intersection of two groups (if it makes sense) as a subgroup of the first group.

EXAMPLES:

sage: A = Matrix([(0, 1/2, 0), (2, 0, 0), (0, 0, 1)])
sage: B = Matrix([(0, 1/2, 0), (-2, -1, 2), (0, 0, 1)])
sage: G = MatrixGroup([A,B])
sage: len(G)  # isomorphic to S_3
6
sage: G.intersection(GL(3,ZZ))
Subgroup with 1 generators (
[ 1  0  0]
[-2 -1  2]
[ 0  0  1]
) of Matrix group over Rational Field with 2 generators (
  [  0 1/2   0]  [  0 1/2   0]
  [  2   0   0]  [ -2  -1   2]
  [  0   0   1], [  0   0   1]
  )
sage: GL(3,ZZ).intersection(G)
Subgroup with 1 generators (
[ 1  0  0]
[-2 -1  2]
[ 0  0  1]
) of General Linear Group of degree 3 over Integer Ring
sage: G.intersection(SL(3,ZZ))
Subgroup with 0 generators ()
  of Matrix group over Rational Field with 2 generators (
  [  0 1/2   0]  [  0 1/2   0]
  [  2   0   0]  [ -2  -1   2]
  [  0   0   1], [  0   0   1]
  )
>>> from sage.all import *
>>> A = Matrix([(Integer(0), Integer(1)/Integer(2), Integer(0)), (Integer(2), Integer(0), Integer(0)), (Integer(0), Integer(0), Integer(1))])
>>> B = Matrix([(Integer(0), Integer(1)/Integer(2), Integer(0)), (-Integer(2), -Integer(1), Integer(2)), (Integer(0), Integer(0), Integer(1))])
>>> G = MatrixGroup([A,B])
>>> len(G)  # isomorphic to S_3
6
>>> G.intersection(GL(Integer(3),ZZ))
Subgroup with 1 generators (
[ 1  0  0]
[-2 -1  2]
[ 0  0  1]
) of Matrix group over Rational Field with 2 generators (
  [  0 1/2   0]  [  0 1/2   0]
  [  2   0   0]  [ -2  -1   2]
  [  0   0   1], [  0   0   1]
  )
>>> GL(Integer(3),ZZ).intersection(G)
Subgroup with 1 generators (
[ 1  0  0]
[-2 -1  2]
[ 0  0  1]
) of General Linear Group of degree 3 over Integer Ring
>>> G.intersection(SL(Integer(3),ZZ))
Subgroup with 0 generators ()
  of Matrix group over Rational Field with 2 generators (
  [  0 1/2   0]  [  0 1/2   0]
  [  2   0   0]  [ -2  -1   2]
  [  0   0   1], [  0   0   1]
  )
irreducible_characters()[source]#

Return the irreducible characters of the group.

OUTPUT: tuple containing all irreducible characters

EXAMPLES:

sage: G = GL(2,2)
sage: G.irreducible_characters()                                            # needs sage.rings.number_field
(Character of General Linear Group of degree 2 over Finite Field of size 2,
 Character of General Linear Group of degree 2 over Finite Field of size 2,
 Character of General Linear Group of degree 2 over Finite Field of size 2)
>>> from sage.all import *
>>> G = GL(Integer(2),Integer(2))
>>> G.irreducible_characters()                                            # needs sage.rings.number_field
(Character of General Linear Group of degree 2 over Finite Field of size 2,
 Character of General Linear Group of degree 2 over Finite Field of size 2,
 Character of General Linear Group of degree 2 over Finite Field of size 2)
sage: GL(2,ZZ).irreducible_characters()
Traceback (most recent call last):
...
NotImplementedError: only implemented for finite groups
>>> from sage.all import *
>>> GL(Integer(2),ZZ).irreducible_characters()
Traceback (most recent call last):
...
NotImplementedError: only implemented for finite groups
is_abelian()[source]#

Return whether the group is Abelian.

OUTPUT: boolean; True if this group is an Abelian group and False otherwise

EXAMPLES:

sage: from sage.groups.libgap_group import GroupLibGAP
sage: GroupLibGAP(libgap.CyclicGroup(12)).is_abelian()
True
sage: GroupLibGAP(libgap.SymmetricGroup(12)).is_abelian()
False

sage: SL(1, 17).is_abelian()
True
sage: SL(2, 17).is_abelian()
False
>>> from sage.all import *
>>> from sage.groups.libgap_group import GroupLibGAP
>>> GroupLibGAP(libgap.CyclicGroup(Integer(12))).is_abelian()
True
>>> GroupLibGAP(libgap.SymmetricGroup(Integer(12))).is_abelian()
False

>>> SL(Integer(1), Integer(17)).is_abelian()
True
>>> SL(Integer(2), Integer(17)).is_abelian()
False
is_finite()[source]#

Test whether the matrix group is finite.

OUTPUT: boolean

EXAMPLES:

sage: G = GL(2,GF(3))
sage: G.is_finite()
True
sage: SL(2,ZZ).is_finite()
False
>>> from sage.all import *
>>> G = GL(Integer(2),GF(Integer(3)))
>>> G.is_finite()
True
>>> SL(Integer(2),ZZ).is_finite()
False
is_isomorphic(H)[source]#

Test whether self and H are isomorphic groups.

INPUT:

  • H – a group

OUTPUT: boolean

EXAMPLES:

sage: m1 = matrix(GF(3), [[1,1],[0,1]])
sage: m2 = matrix(GF(3), [[1,2],[0,1]])
sage: F = MatrixGroup(m1)
sage: G = MatrixGroup(m1, m2)
sage: H = MatrixGroup(m2)
sage: F.is_isomorphic(G)
True
sage: G.is_isomorphic(H)
True
sage: F.is_isomorphic(H)
True
sage: F == G, G == H, F == H
(False, False, False)
>>> from sage.all import *
>>> m1 = matrix(GF(Integer(3)), [[Integer(1),Integer(1)],[Integer(0),Integer(1)]])
>>> m2 = matrix(GF(Integer(3)), [[Integer(1),Integer(2)],[Integer(0),Integer(1)]])
>>> F = MatrixGroup(m1)
>>> G = MatrixGroup(m1, m2)
>>> H = MatrixGroup(m2)
>>> F.is_isomorphic(G)
True
>>> G.is_isomorphic(H)
True
>>> F.is_isomorphic(H)
True
>>> F == G, G == H, F == H
(False, False, False)
is_nilpotent()[source]#

Return whether this group is nilpotent.

EXAMPLES:

sage: from sage.groups.libgap_group import GroupLibGAP
sage: GroupLibGAP(libgap.AlternatingGroup(3)).is_nilpotent()
True
sage: GroupLibGAP(libgap.SymmetricGroup(3)).is_nilpotent()
False
>>> from sage.all import *
>>> from sage.groups.libgap_group import GroupLibGAP
>>> GroupLibGAP(libgap.AlternatingGroup(Integer(3))).is_nilpotent()
True
>>> GroupLibGAP(libgap.SymmetricGroup(Integer(3))).is_nilpotent()
False
is_p_group()[source]#

Return whether this group is a p-group.

EXAMPLES:

sage: from sage.groups.libgap_group import GroupLibGAP
sage: GroupLibGAP(libgap.CyclicGroup(9)).is_p_group()
True
sage: GroupLibGAP(libgap.CyclicGroup(10)).is_p_group()
False
>>> from sage.all import *
>>> from sage.groups.libgap_group import GroupLibGAP
>>> GroupLibGAP(libgap.CyclicGroup(Integer(9))).is_p_group()
True
>>> GroupLibGAP(libgap.CyclicGroup(Integer(10))).is_p_group()
False
is_perfect()[source]#

Return whether this group is perfect.

EXAMPLES:

sage: from sage.groups.libgap_group import GroupLibGAP
sage: GroupLibGAP(libgap.SymmetricGroup(5)).is_perfect()
False
sage: GroupLibGAP(libgap.AlternatingGroup(5)).is_perfect()
True

sage: SL(3,3).is_perfect()
True
>>> from sage.all import *
>>> from sage.groups.libgap_group import GroupLibGAP
>>> GroupLibGAP(libgap.SymmetricGroup(Integer(5))).is_perfect()
False
>>> GroupLibGAP(libgap.AlternatingGroup(Integer(5))).is_perfect()
True

>>> SL(Integer(3),Integer(3)).is_perfect()
True
is_polycyclic()[source]#

Return whether this group is polycyclic.

EXAMPLES:

sage: from sage.groups.libgap_group import GroupLibGAP
sage: GroupLibGAP(libgap.AlternatingGroup(4)).is_polycyclic()
True
sage: GroupLibGAP(libgap.AlternatingGroup(5)).is_solvable()
False
>>> from sage.all import *
>>> from sage.groups.libgap_group import GroupLibGAP
>>> GroupLibGAP(libgap.AlternatingGroup(Integer(4))).is_polycyclic()
True
>>> GroupLibGAP(libgap.AlternatingGroup(Integer(5))).is_solvable()
False
is_simple()[source]#

Return whether this group is simple.

EXAMPLES:

sage: from sage.groups.libgap_group import GroupLibGAP
sage: GroupLibGAP(libgap.SL(2,3)).is_simple()
False
sage: GroupLibGAP(libgap.SL(3,3)).is_simple()
True

sage: SL(3,3).is_simple()
True
>>> from sage.all import *
>>> from sage.groups.libgap_group import GroupLibGAP
>>> GroupLibGAP(libgap.SL(Integer(2),Integer(3))).is_simple()
False
>>> GroupLibGAP(libgap.SL(Integer(3),Integer(3))).is_simple()
True

>>> SL(Integer(3),Integer(3)).is_simple()
True
is_solvable()[source]#

Return whether this group is solvable.

EXAMPLES:

sage: from sage.groups.libgap_group import GroupLibGAP
sage: GroupLibGAP(libgap.SymmetricGroup(4)).is_solvable()
True
sage: GroupLibGAP(libgap.SymmetricGroup(5)).is_solvable()
False
>>> from sage.all import *
>>> from sage.groups.libgap_group import GroupLibGAP
>>> GroupLibGAP(libgap.SymmetricGroup(Integer(4))).is_solvable()
True
>>> GroupLibGAP(libgap.SymmetricGroup(Integer(5))).is_solvable()
False
is_supersolvable()[source]#

Return whether this group is supersolvable.

EXAMPLES:

sage: from sage.groups.libgap_group import GroupLibGAP
sage: GroupLibGAP(libgap.SymmetricGroup(3)).is_supersolvable()
True
sage: GroupLibGAP(libgap.SymmetricGroup(4)).is_supersolvable()
False
>>> from sage.all import *
>>> from sage.groups.libgap_group import GroupLibGAP
>>> GroupLibGAP(libgap.SymmetricGroup(Integer(3))).is_supersolvable()
True
>>> GroupLibGAP(libgap.SymmetricGroup(Integer(4))).is_supersolvable()
False
list()[source]#

List all elements of this group.

OUTPUT: tuple containing all group elements in a random but fixed order

EXAMPLES:

sage: F = GF(3)
sage: gens = [matrix(F,2, [1,0,-1,1]), matrix(F, 2, [1,1,0,1])]
sage: G = MatrixGroup(gens)
sage: G.cardinality()
24
sage: v = G.list()
sage: len(v)
24
sage: v[:5]
(
[1 0]  [2 0]  [0 1]  [0 2]  [1 2]
[0 1], [0 2], [2 0], [1 0], [2 2]
)

sage: all(g in G for g in G.list())
True
>>> from sage.all import *
>>> F = GF(Integer(3))
>>> gens = [matrix(F,Integer(2), [Integer(1),Integer(0),-Integer(1),Integer(1)]), matrix(F, Integer(2), [Integer(1),Integer(1),Integer(0),Integer(1)])]
>>> G = MatrixGroup(gens)
>>> G.cardinality()
24
>>> v = G.list()
>>> len(v)
24
>>> v[:Integer(5)]
(
[1 0]  [2 0]  [0 1]  [0 2]  [1 2]
[0 1], [0 2], [2 0], [1 0], [2 2]
)

>>> all(g in G for g in G.list())
True

An example over a ring (see Issue #5241):

sage: M1 = matrix(ZZ,2,[[-1,0],[0,1]])
sage: M2 = matrix(ZZ,2,[[1,0],[0,-1]])
sage: M3 = matrix(ZZ,2,[[-1,0],[0,-1]])
sage: MG = MatrixGroup([M1, M2, M3])
sage: MG.list()
(
[1 0]  [ 1  0]  [-1  0]  [-1  0]
[0 1], [ 0 -1], [ 0  1], [ 0 -1]
)
sage: MG.list()[1]
[ 1  0]
[ 0 -1]
sage: MG.list()[1].parent()
Matrix group over Integer Ring with 3 generators (
[-1  0]  [ 1  0]  [-1  0]
[ 0  1], [ 0 -1], [ 0 -1]
)
>>> from sage.all import *
>>> M1 = matrix(ZZ,Integer(2),[[-Integer(1),Integer(0)],[Integer(0),Integer(1)]])
>>> M2 = matrix(ZZ,Integer(2),[[Integer(1),Integer(0)],[Integer(0),-Integer(1)]])
>>> M3 = matrix(ZZ,Integer(2),[[-Integer(1),Integer(0)],[Integer(0),-Integer(1)]])
>>> MG = MatrixGroup([M1, M2, M3])
>>> MG.list()
(
[1 0]  [ 1  0]  [-1  0]  [-1  0]
[0 1], [ 0 -1], [ 0  1], [ 0 -1]
)
>>> MG.list()[Integer(1)]
[ 1  0]
[ 0 -1]
>>> MG.list()[Integer(1)].parent()
Matrix group over Integer Ring with 3 generators (
[-1  0]  [ 1  0]  [-1  0]
[ 0  1], [ 0 -1], [ 0 -1]
)

An example over a field (see Issue #10515):

sage: gens = [matrix(QQ,2,[1,0,0,1])]
sage: MatrixGroup(gens).list()
(
[1 0]
[0 1]
)
>>> from sage.all import *
>>> gens = [matrix(QQ,Integer(2),[Integer(1),Integer(0),Integer(0),Integer(1)])]
>>> MatrixGroup(gens).list()
(
[1 0]
[0 1]
)

Another example over a ring (see Issue #9437):

sage: len(SL(2, Zmod(4)).list())
48
>>> from sage.all import *
>>> len(SL(Integer(2), Zmod(Integer(4))).list())
48

An error is raised if the group is not finite:

sage: GL(2,ZZ).list()
Traceback (most recent call last):
...
NotImplementedError: group must be finite
>>> from sage.all import *
>>> GL(Integer(2),ZZ).list()
Traceback (most recent call last):
...
NotImplementedError: group must be finite
order()[source]#

Implement EnumeratedSets.ParentMethods.cardinality().

EXAMPLES:

sage: G = Sp(4,GF(3))
sage: G.cardinality()
51840

sage: G = SL(4,GF(3))
sage: G.cardinality()
12130560

sage: F = GF(5); MS = MatrixSpace(F,2,2)
sage: gens = [MS([[1,2],[-1,1]]),MS([[1,1],[0,1]])]
sage: G = MatrixGroup(gens)
sage: G.cardinality()
480

sage: G = MatrixGroup([matrix(ZZ,2,[1,1,0,1])])
sage: G.cardinality()
+Infinity

sage: G = Sp(4,GF(3))
sage: G.cardinality()
51840

sage: G = SL(4,GF(3))
sage: G.cardinality()
12130560

sage: F = GF(5); MS = MatrixSpace(F,2,2)
sage: gens = [MS([[1,2],[-1,1]]),MS([[1,1],[0,1]])]
sage: G = MatrixGroup(gens)
sage: G.cardinality()
480

sage: G = MatrixGroup([matrix(ZZ,2,[1,1,0,1])])
sage: G.cardinality()
+Infinity
>>> from sage.all import *
>>> G = Sp(Integer(4),GF(Integer(3)))
>>> G.cardinality()
51840

>>> G = SL(Integer(4),GF(Integer(3)))
>>> G.cardinality()
12130560

>>> F = GF(Integer(5)); MS = MatrixSpace(F,Integer(2),Integer(2))
>>> gens = [MS([[Integer(1),Integer(2)],[-Integer(1),Integer(1)]]),MS([[Integer(1),Integer(1)],[Integer(0),Integer(1)]])]
>>> G = MatrixGroup(gens)
>>> G.cardinality()
480

>>> G = MatrixGroup([matrix(ZZ,Integer(2),[Integer(1),Integer(1),Integer(0),Integer(1)])])
>>> G.cardinality()
+Infinity

>>> G = Sp(Integer(4),GF(Integer(3)))
>>> G.cardinality()
51840

>>> G = SL(Integer(4),GF(Integer(3)))
>>> G.cardinality()
12130560

>>> F = GF(Integer(5)); MS = MatrixSpace(F,Integer(2),Integer(2))
>>> gens = [MS([[Integer(1),Integer(2)],[-Integer(1),Integer(1)]]),MS([[Integer(1),Integer(1)],[Integer(0),Integer(1)]])]
>>> G = MatrixGroup(gens)
>>> G.cardinality()
480

>>> G = MatrixGroup([matrix(ZZ,Integer(2),[Integer(1),Integer(1),Integer(0),Integer(1)])])
>>> G.cardinality()
+Infinity
random_element()[source]#

Return a random element of this group.

OUTPUT: a group element

EXAMPLES:

sage: G = Sp(4,GF(3))
sage: G.random_element()  # random
[2 1 1 1]
[1 0 2 1]
[0 1 1 0]
[1 0 0 1]
sage: G.random_element() in G
True

sage: F = GF(5); MS = MatrixSpace(F,2,2)
sage: gens = [MS([[1,2],[-1,1]]), MS([[1,1],[0,1]])]
sage: G = MatrixGroup(gens)
sage: G.random_element()  # random
[1 3]
[0 3]
sage: G.random_element() in G
True
>>> from sage.all import *
>>> G = Sp(Integer(4),GF(Integer(3)))
>>> G.random_element()  # random
[2 1 1 1]
[1 0 2 1]
[0 1 1 0]
[1 0 0 1]
>>> G.random_element() in G
True

>>> F = GF(Integer(5)); MS = MatrixSpace(F,Integer(2),Integer(2))
>>> gens = [MS([[Integer(1),Integer(2)],[-Integer(1),Integer(1)]]), MS([[Integer(1),Integer(1)],[Integer(0),Integer(1)]])]
>>> G = MatrixGroup(gens)
>>> G.random_element()  # random
[1 3]
[0 3]
>>> G.random_element() in G
True
subgroups()[source]#

Return a list of all the subgroups of self.

OUTPUT:

Each possible subgroup of self is contained once in the returned list. The list is in order, according to the size of the subgroups, from the trivial subgroup with one element on through up to the whole group. Conjugacy classes of subgroups are contiguous in the list.

Warning

For even relatively small groups this method can take a very long time to execute, or create vast amounts of output. Likely both. Its purpose is instructional, as it can be useful for studying small groups.

For faster results, which still exhibit the structure of the possible subgroups, use conjugacy_classes_subgroups().

EXAMPLES:

sage: G = groups.matrix.GL(2, 2)
sage: G.subgroups()
[Subgroup with 0 generators ()
   of General Linear Group of degree 2 over Finite Field of size 2,
 Subgroup with 1 generators (
 [0 1]
 [1 0]
 ) of General Linear Group of degree 2 over Finite Field of size 2,
 Subgroup with 1 generators (
 [1 0]
 [1 1]
 ) of General Linear Group of degree 2 over Finite Field of size 2,
 Subgroup with 1 generators (
 [1 1]
 [0 1]
 ) of General Linear Group of degree 2 over Finite Field of size 2,
 Subgroup with 1 generators (
 [0 1]
 [1 1]
 ) of General Linear Group of degree 2 over Finite Field of size 2,
 Subgroup with 2 generators (
 [0 1]  [1 1]
 [1 1], [0 1]
 ) of General Linear Group of degree 2 over Finite Field of size 2]

sage: H = groups.matrix.Heisenberg(2)
sage: H.subgroups()
Traceback (most recent call last):
...
NotImplementedError: group must be finite
>>> from sage.all import *
>>> G = groups.matrix.GL(Integer(2), Integer(2))
>>> G.subgroups()
[Subgroup with 0 generators ()
   of General Linear Group of degree 2 over Finite Field of size 2,
 Subgroup with 1 generators (
 [0 1]
 [1 0]
 ) of General Linear Group of degree 2 over Finite Field of size 2,
 Subgroup with 1 generators (
 [1 0]
 [1 1]
 ) of General Linear Group of degree 2 over Finite Field of size 2,
 Subgroup with 1 generators (
 [1 1]
 [0 1]
 ) of General Linear Group of degree 2 over Finite Field of size 2,
 Subgroup with 1 generators (
 [0 1]
 [1 1]
 ) of General Linear Group of degree 2 over Finite Field of size 2,
 Subgroup with 2 generators (
 [0 1]  [1 1]
 [1 1], [0 1]
 ) of General Linear Group of degree 2 over Finite Field of size 2]

>>> H = groups.matrix.Heisenberg(Integer(2))
>>> H.subgroups()
Traceback (most recent call last):
...
NotImplementedError: group must be finite
trivial_character()[source]#

Return the trivial character of this group.

OUTPUT: a group character

EXAMPLES:

sage: MatrixGroup(SymmetricGroup(3)).trivial_character()                    # needs sage.rings.number_field
Character of Matrix group over Integer Ring with 6 generators
>>> from sage.all import *
>>> MatrixGroup(SymmetricGroup(Integer(3))).trivial_character()                    # needs sage.rings.number_field
Character of Matrix group over Integer Ring with 6 generators
sage: GL(2,ZZ).trivial_character()
Traceback (most recent call last):
...
NotImplementedError: only implemented for finite groups
>>> from sage.all import *
>>> GL(Integer(2),ZZ).trivial_character()
Traceback (most recent call last):
...
NotImplementedError: only implemented for finite groups