22.11 Matrix Group Elements

Module: sage.groups.matrix_gps.matrix_group_element

Matrix Group Elements

Author Log:

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], [0, 1]], [[1, 1], [0, 1]]]    
sage: g = G([[1,1],[0,1]])
sage: h = G([[1,2],[0,1]])
sage: 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 type(s) for +: 'MatrixGroupElement' and
'MatrixGroupElement'

sage: g.matrix() + h.matrix()
[2 0]
[0 2]

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], [0, 1]], [[1, 1], [0, 1]]]'
sage: 2*g.matrix()
[2 2]
[0 2]

Module-level Functions

is_MatrixGroupElement( x)

Class: MatrixGroupElement

class MatrixGroupElement
An element of a matrix group.

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)
sage: g = G.random_element()
sage: type(g)
<class 'sage.groups.matrix_gps.matrix_group_element.MatrixGroupElement'>
MatrixGroupElement( self, g, parent, [check=True])

Create element of a matrix group.

Input:

g
- a Matrix
parent
- defines parent group (g must be in parent or a TypeError is raised).
check
- bool (default: True), if true does some type checking.

TESTS:

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)
sage: g = G.random_element()
sage: g == loads(dumps(g))
True

Functions: list,$ \,$ matrix,$ \,$ order,$ \,$ word_problem

list( self)

Return list representation of this matrix.

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)
sage: g = G.0
sage: g.list()   
[[1, 0], [0, 1]]

matrix( self)

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.

sage: k = GF(7); G = MatrixGroup([matrix(k,2,[1,1,0,1]), matrix(k,2,[1,0,0,2])])
sage: g = G.0
sage: g.matrix()
[1 1]
[0 1]
sage: parent(g.matrix())
Full MatrixSpace of 2 by 2 dense matrices over Finite Field of size 7

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

sage: g.matrix().charpoly('t')
t^2 + 5*t + 1

order( self)

Return the order of this group element, which is the smallest positive integer $ n$ such that $ g^n = 1$ .

sage: k = GF(7); G = MatrixGroup([matrix(k,2,[1,1,0,1]), matrix(k,2,[1,0,0,2])])
sage: G
Matrix group over Finite Field of size 7 with 2 generators: 
 [[[1, 1], [0, 1]], [[1, 0], [0, 2]]]
sage: G.order()
21

word_problem( self, [words=None])

Right this group element in terms of the elements of the list words.

If G and H are permutation groups (with G the parent of self), H is a subgroup of G generated by a list words of elements of G. If g is in H, return the expression for g as a word in the elements of words.

ALGORITHM: Use GAP, which has optimized algorithms for solving the word problem (the GAP functions EpimorphismFromFreeGroup and PreImagesRepresentative).

Input:

words
- list (default: None) a list of elements of the parent group; if words is empty, uses the gens of the parent group.

sage: G = GL(2,5); G
General Linear Group of degree 2 over Finite Field of size 5
sage: G.gens()
[
[2 0]
[0 1],
[4 1]
[4 0]
]
sage: G(1).word_problem([G.1, G.0])
1

Next we construct a more complicated element of the group from the generators:

sage: (G.0).order(), (G.1).order()
(4, 3)
sage: g = G.0^3 * G.1^2

We then ask to solve the word problem, with the generators reversed (just to make it trickier):

sage: s = g.word_problem([G.1, G.0]); s
([2 0]
[0 1])^-1 * 
([4 1]
[4 0])^-1

It worked!

sage: s.prod() == g
True

Author: David Joyner and William Stein

Special Functions: __cmp__,$ \,$ __init__,$ \,$ __invert__,$ \,$ _gap_init_,$ \,$ _gap_latex_,$ \,$ _latex_,$ \,$ _mul_,$ \,$ _repr_

__cmp__( self, other)

sage: F = GF(3); MS = MatrixSpace(F,2)
sage: gens = [MS([1,0, 0,1]), MS([1,1, 0,1])]
sage: G = MatrixGroup(gens)
sage: g = G([1,1, 0,1])
sage: h = G([1,1, 0,1])
sage: g == h
True

_gap_init_( self)

Return a string representation of a Gap object corresponding to this matrix group element.

sage: k = GF(7); G = MatrixGroup([matrix(k,2,[1,1,0,1]), matrix(k,2,[1,0,0,2])]); g = G.1
sage: g._gap_init_() # The variable $sage27 belongs to gap(k) and is somehow random
'[[Z(7)^0,0*Z(7)],[0*Z(7),Z(7)^2]]*One($sage27)'
sage: gap(g._gap_init_())
[ [ Z(7)^0, 0*Z(7) ], [ 0*Z(7), Z(7)^2 ] ]

It may be better to use gap(the matrix), since the result is cached.

sage: gap(G.1)
[ [ Z(7)^0, 0*Z(7) ], [ 0*Z(7), Z(7)^2 ] ]
sage: gap(G.1).IsMatrix()
true

_gap_latex_( self)

Return the GAP latex version of this matrix.

Author: S. Kohl wrote the GAP function.

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)
sage: g = G([[1, 1], [0, 1]])
sage: print g._gap_latex_()
\left(\begin{array}{rr}%
Z(3)^{0}\&Z(3)^{0}\\%
0*Z(3)\&Z(3)^{0}\\%
\end{array}\right)%

Type view(g._latex_()) to see the object in an xdvi window (assuming you have latex and xdvi installed).

_latex_( self)

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)
sage: g = G([[1, 1], [0, 1]])
sage: print g._latex_()
\left(\begin{array}{rr}
1 \& 1 \\
0 \& 1
\end{array}\right)

Type view(g._latex_()) to see the object in an xdvi window (assuming you have latex and xdvi installed).

_mul_( self, other)

Return the product of self and other, which must have identical parents.

sage: F = GF(3); MS = MatrixSpace(F,2)
sage: gens = [MS([1,0, 0,1]), MS([1,1, 0,1])]
sage: G = MatrixGroup(gens)
sage: g = G([1,1, 0,1])
sage: h = G([1,1, 0,1])
sage: g*h
[1 2]
[0 1]

_repr_( self)

Return string representation of this matrix.

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)
sage: g = G([[1, 1], [0, 1]])
sage: g
[1 1]
[0 1]

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