Matrix Group Elements#

EXAMPLES:

sage: F = GF(3); MS = MatrixSpace(F, 2, 2)
sage: gens = [MS([[1,0], [0,1]]), MS([[1,1], [0,1]])]
sage: G = MatrixGroup(gens); G
Matrix group over Finite Field of size 3 with 2 generators (
[1 0]  [1 1]
[0 1], [0 1] )
sage: g = G([[1,1], [0,1]])
sage: h = G([[1,2], [0,1]])
sage: g*h
[1 0]
[0 1]
>>> from sage.all import *
>>> F = GF(Integer(3)); MS = MatrixSpace(F, Integer(2), Integer(2))
>>> gens = [MS([[Integer(1),Integer(0)], [Integer(0),Integer(1)]]), MS([[Integer(1),Integer(1)], [Integer(0),Integer(1)]])]
>>> G = MatrixGroup(gens); G
Matrix group over Finite Field of size 3 with 2 generators (
[1 0]  [1 1]
[0 1], [0 1] )
>>> g = G([[Integer(1),Integer(1)], [Integer(0),Integer(1)]])
>>> h = G([[Integer(1),Integer(2)], [Integer(0),Integer(1)]])
>>> g*h
[1 0]
[0 1]

You cannot add two matrices, since this is not a group operation. You can coerce matrices back to the matrix space and add them there:

sage: g + h
Traceback (most recent call last):
...
TypeError: unsupported operand parent(s) for +:
'Matrix group over Finite Field of size 3 with 2 generators (
[1 0]  [1 1]
[0 1], [0 1]
)' and
'Matrix group over Finite Field of size 3 with 2 generators (
[1 0]  [1 1]
[0 1], [0 1]
)'

sage: g.matrix() + h.matrix()
[2 0]
[0 2]
>>> from sage.all import *
>>> g + h
Traceback (most recent call last):
...
TypeError: unsupported operand parent(s) for +:
'Matrix group over Finite Field of size 3 with 2 generators (
[1 0]  [1 1]
[0 1], [0 1]
)' and
'Matrix group over Finite Field of size 3 with 2 generators (
[1 0]  [1 1]
[0 1], [0 1]
)'

>>> g.matrix() + h.matrix()
[2 0]
[0 2]

Similarly, you cannot multiply group elements by scalars but you can do it with the underlying matrices:

sage: 2*g
Traceback (most recent call last):
...
TypeError: unsupported operand parent(s) for *: 'Integer Ring'
and 'Matrix group over Finite Field of size 3 with 2 generators (
[1 0]  [1 1]
[0 1], [0 1] )'
>>> from sage.all import *
>>> Integer(2)*g
Traceback (most recent call last):
...
TypeError: unsupported operand parent(s) for *: 'Integer Ring'
and 'Matrix group over Finite Field of size 3 with 2 generators (
[1 0]  [1 1]
[0 1], [0 1] )'

AUTHORS:

  • David Joyner (2006-05): initial version David Joyner

  • David Joyner (2006-05): various modifications to address William Stein’s TODO’s.

  • William Stein (2006-12-09): many revisions.

  • Volker Braun (2013-1) port to new Parent, libGAP.

  • Travis Scrimshaw (2016-01): reworks class hierarchy in order to cythonize

class sage.groups.matrix_gps.group_element.MatrixGroupElement_generic[source]#

Bases: MultiplicativeGroupElement

Element of a matrix group over a generic ring.

The group elements are implemented as Sage matrices.

INPUT:

  • M – a matrix

  • parent – the parent

  • check – bool (default: True); if True, then do some type checking

  • convert – bool (default: True); if True, then convert M to the right matrix space

EXAMPLES:

sage: W = CoxeterGroup(['A',3], base_ring=ZZ)                                   # needs sage.graphs
sage: g = W.an_element(); g                                                     # needs sage.graphs
[ 0  0 -1]
[ 1  0 -1]
[ 0  1 -1]
>>> from sage.all import *
>>> W = CoxeterGroup(['A',Integer(3)], base_ring=ZZ)                                   # needs sage.graphs
>>> g = W.an_element(); g                                                     # needs sage.graphs
[ 0  0 -1]
[ 1  0 -1]
[ 0  1 -1]
inverse()[source]#

Return the inverse group element.

OUTPUT: a matrix group element

EXAMPLES:

sage: # needs sage.combinat sage.libs.gap
sage: W = CoxeterGroup(['A',3], base_ring=ZZ)
sage: g = W.an_element()
sage: ~g
[-1  1  0]
[-1  0  1]
[-1  0  0]
sage: g * ~g == W.one()
True
sage: ~g * g == W.one()
True

sage: # needs sage.combinat sage.libs.gap sage.rings.number_field
sage: W = CoxeterGroup(['B',3])
sage: W.base_ring()
Number Field in a with defining polynomial x^2 - 2 with a = 1.414213562373095?
sage: g = W.an_element()
sage: ~g
[-1  1  0]
[-1  0  a]
[-a  0  1]
>>> from sage.all import *
>>> # needs sage.combinat sage.libs.gap
>>> W = CoxeterGroup(['A',Integer(3)], base_ring=ZZ)
>>> g = W.an_element()
>>> ~g
[-1  1  0]
[-1  0  1]
[-1  0  0]
>>> g * ~g == W.one()
True
>>> ~g * g == W.one()
True

>>> # needs sage.combinat sage.libs.gap sage.rings.number_field
>>> W = CoxeterGroup(['B',Integer(3)])
>>> W.base_ring()
Number Field in a with defining polynomial x^2 - 2 with a = 1.414213562373095?
>>> g = W.an_element()
>>> ~g
[-1  1  0]
[-1  0  a]
[-a  0  1]
is_one()[source]#

Return whether self is the identity of the group.

EXAMPLES:

sage: # needs sage.graphs
sage: W = CoxeterGroup(['A',3])
sage: g = W.gen(0)
sage: g.is_one()
False
sage: W.an_element().is_one()
False
sage: W.one().is_one()
True
>>> from sage.all import *
>>> # needs sage.graphs
>>> W = CoxeterGroup(['A',Integer(3)])
>>> g = W.gen(Integer(0))
>>> g.is_one()
False
>>> W.an_element().is_one()
False
>>> W.one().is_one()
True
list()[source]#

Return list representation of this matrix.

EXAMPLES:

sage: # needs sage.combinat sage.libs.gap
sage: W = CoxeterGroup(['A',3], base_ring=ZZ)
sage: g = W.gen(0)
sage: g
[-1  1  0]
[ 0  1  0]
[ 0  0  1]
sage: g.list()
[[-1, 1, 0], [0, 1, 0], [0, 0, 1]]
>>> from sage.all import *
>>> # needs sage.combinat sage.libs.gap
>>> W = CoxeterGroup(['A',Integer(3)], base_ring=ZZ)
>>> g = W.gen(Integer(0))
>>> g
[-1  1  0]
[ 0  1  0]
[ 0  0  1]
>>> g.list()
[[-1, 1, 0], [0, 1, 0], [0, 0, 1]]
matrix()[source]#

Obtain the usual matrix (as an element of a matrix space) associated to this matrix group element.

One reason to compute the associated matrix is that matrices support a huge range of functionality.

EXAMPLES:

sage: # needs sage.combinat sage.libs.gap
sage: W = CoxeterGroup(['A',3], base_ring=ZZ)
sage: g = W.gen(0)
sage: g.matrix()
[-1  1  0]
[ 0  1  0]
[ 0  0  1]
sage: parent(g.matrix())
Full MatrixSpace of 3 by 3 dense matrices over Integer Ring
>>> from sage.all import *
>>> # needs sage.combinat sage.libs.gap
>>> W = CoxeterGroup(['A',Integer(3)], base_ring=ZZ)
>>> g = W.gen(Integer(0))
>>> g.matrix()
[-1  1  0]
[ 0  1  0]
[ 0  0  1]
>>> parent(g.matrix())
Full MatrixSpace of 3 by 3 dense matrices over Integer Ring

Matrices have extra functionality that matrix group elements do not have:

sage: g.matrix().charpoly('t')                                              # needs sage.combinat sage.libs.gap
t^3 - t^2 - t + 1
>>> from sage.all import *
>>> g.matrix().charpoly('t')                                              # needs sage.combinat sage.libs.gap
t^3 - t^2 - t + 1
sage.groups.matrix_gps.group_element.is_MatrixGroupElement(x)[source]#

Test whether x is a matrix group element.

INPUT:

  • x – anything

OUTPUT: boolean

EXAMPLES:

sage: from sage.groups.matrix_gps.group_element import is_MatrixGroupElement
sage: is_MatrixGroupElement('helloooo')
False

sage: G = GL(2,3)
sage: is_MatrixGroupElement(G.an_element())
True
>>> from sage.all import *
>>> from sage.groups.matrix_gps.group_element import is_MatrixGroupElement
>>> is_MatrixGroupElement('helloooo')
False

>>> G = GL(Integer(2),Integer(3))
>>> is_MatrixGroupElement(G.an_element())
True