Elements of Affine Groups#

The class in this module is used to represent the elements of AffineGroup() and its subgroups.

EXAMPLES:

sage: F = AffineGroup(3, QQ)
sage: F([1,2,3,4,5,6,7,8,0], [10,11,12])
      [1 2 3]     [10]
x |-> [4 5 6] x + [11]
      [7 8 0]     [12]

sage: G = AffineGroup(2, ZZ)
sage: g = G([[1,1],[0,1]], [1,0])
sage: h = G([[1,2],[0,1]], [0,1])
sage: g*h
      [1 3]     [2]
x |-> [0 1] x + [1]
sage: h*g
      [1 3]     [1]
x |-> [0 1] x + [1]
sage: g*h != h*g
True
>>> from sage.all import *
>>> F = AffineGroup(Integer(3), QQ)
>>> F([Integer(1),Integer(2),Integer(3),Integer(4),Integer(5),Integer(6),Integer(7),Integer(8),Integer(0)], [Integer(10),Integer(11),Integer(12)])
      [1 2 3]     [10]
x |-> [4 5 6] x + [11]
      [7 8 0]     [12]

>>> G = AffineGroup(Integer(2), ZZ)
>>> g = G([[Integer(1),Integer(1)],[Integer(0),Integer(1)]], [Integer(1),Integer(0)])
>>> h = G([[Integer(1),Integer(2)],[Integer(0),Integer(1)]], [Integer(0),Integer(1)])
>>> g*h
      [1 3]     [2]
x |-> [0 1] x + [1]
>>> h*g
      [1 3]     [1]
x |-> [0 1] x + [1]
>>> g*h != h*g
True

AUTHORS:

  • Volker Braun

class sage.groups.affine_gps.group_element.AffineGroupElement(parent, A, b=0, convert=True, check=True)[source]#

Bases: MultiplicativeGroupElement

An affine group element.

INPUT:

  • A – an invertible matrix, or something defining a matrix if convert==True

  • b – a vector, or something defining a vector if convert==True (default: 0, defining the zero vector)

  • parent – the parent affine group

  • convert – bool (default: True); whether to convert A into the correct matrix space and b into the correct vector space

  • check – bool (default: True); whether to do some checks or just accept the input as valid

As a special case, A can be a matrix obtained from matrix(), that is, one row and one column larger. In that case, the group element defining that matrix is reconstructed.

OUTPUT: The affine group element \(x \mapsto Ax + b\)

EXAMPLES:

sage: G = AffineGroup(2, GF(3))

sage: # needs sage.libs.gap
sage: g = G.random_element()
sage: type(g)
<class 'sage.groups.affine_gps.affine_group.AffineGroup_with_category.element_class'>
sage: G(g.matrix()) == g
True

sage: G(2)
      [2 0]     [0]
x |-> [0 2] x + [0]
>>> from sage.all import *
>>> G = AffineGroup(Integer(2), GF(Integer(3)))

>>> # needs sage.libs.gap
>>> g = G.random_element()
>>> type(g)
<class 'sage.groups.affine_gps.affine_group.AffineGroup_with_category.element_class'>
>>> G(g.matrix()) == g
True

>>> G(Integer(2))
      [2 0]     [0]
x |-> [0 2] x + [0]

Conversion from a matrix and a matrix group element:

sage: M = Matrix(4, 4, [0, 0, -1, 1, 0, -1, 0, 1, -1, 0, 0, 1, 0, 0, 0, 1])
sage: A = AffineGroup(3, ZZ)
sage: A(M)
      [ 0  0 -1]     [1]
x |-> [ 0 -1  0] x + [1]
      [-1  0  0]     [1]
sage: G = MatrixGroup([M])
sage: A(G.0)
      [ 0  0 -1]     [1]
x |-> [ 0 -1  0] x + [1]
      [-1  0  0]     [1]
>>> from sage.all import *
>>> M = Matrix(Integer(4), Integer(4), [Integer(0), Integer(0), -Integer(1), Integer(1), Integer(0), -Integer(1), Integer(0), Integer(1), -Integer(1), Integer(0), Integer(0), Integer(1), Integer(0), Integer(0), Integer(0), Integer(1)])
>>> A = AffineGroup(Integer(3), ZZ)
>>> A(M)
      [ 0  0 -1]     [1]
x |-> [ 0 -1  0] x + [1]
      [-1  0  0]     [1]
>>> G = MatrixGroup([M])
>>> A(G.gen(0))
      [ 0  0 -1]     [1]
x |-> [ 0 -1  0] x + [1]
      [-1  0  0]     [1]
A()[source]#

Return the general linear part of an affine group element.

OUTPUT: The matrix \(A\) of the affine group element \(Ax + b\)

EXAMPLES:

sage: G = AffineGroup(3, QQ)
sage: g = G([1,2,3,4,5,6,7,8,0], [10,11,12])
sage: g.A()
[1 2 3]
[4 5 6]
[7 8 0]
>>> from sage.all import *
>>> G = AffineGroup(Integer(3), QQ)
>>> g = G([Integer(1),Integer(2),Integer(3),Integer(4),Integer(5),Integer(6),Integer(7),Integer(8),Integer(0)], [Integer(10),Integer(11),Integer(12)])
>>> g.A()
[1 2 3]
[4 5 6]
[7 8 0]
b()[source]#

Return the translation part of an affine group element.

OUTPUT: The vector \(b\) of the affine group element \(Ax + b\)

EXAMPLES:

sage: G = AffineGroup(3, QQ)
sage: g = G([1,2,3,4,5,6,7,8,0], [10,11,12])
sage: g.b()
(10, 11, 12)
>>> from sage.all import *
>>> G = AffineGroup(Integer(3), QQ)
>>> g = G([Integer(1),Integer(2),Integer(3),Integer(4),Integer(5),Integer(6),Integer(7),Integer(8),Integer(0)], [Integer(10),Integer(11),Integer(12)])
>>> g.b()
(10, 11, 12)
list()[source]#

Return list representation of self.

EXAMPLES:

sage: F = AffineGroup(3, QQ)
sage: g = F([1,2,3,4,5,6,7,8,0], [10,11,12])
sage: g
      [1 2 3]     [10]
x |-> [4 5 6] x + [11]
      [7 8 0]     [12]
sage: g.matrix()
[ 1  2  3|10]
[ 4  5  6|11]
[ 7  8  0|12]
[--------+--]
[ 0  0  0| 1]
sage: g.list()
[[1, 2, 3, 10], [4, 5, 6, 11], [7, 8, 0, 12], [0, 0, 0, 1]]
>>> from sage.all import *
>>> F = AffineGroup(Integer(3), QQ)
>>> g = F([Integer(1),Integer(2),Integer(3),Integer(4),Integer(5),Integer(6),Integer(7),Integer(8),Integer(0)], [Integer(10),Integer(11),Integer(12)])
>>> g
      [1 2 3]     [10]
x |-> [4 5 6] x + [11]
      [7 8 0]     [12]
>>> g.matrix()
[ 1  2  3|10]
[ 4  5  6|11]
[ 7  8  0|12]
[--------+--]
[ 0  0  0| 1]
>>> g.list()
[[1, 2, 3, 10], [4, 5, 6, 11], [7, 8, 0, 12], [0, 0, 0, 1]]
matrix()[source]#

Return the standard matrix representation of self.

EXAMPLES:

sage: G = AffineGroup(3, GF(7))
sage: g = G([1,2,3,4,5,6,7,8,0], [10,11,12])
sage: g
      [1 2 3]     [3]
x |-> [4 5 6] x + [4]
      [0 1 0]     [5]
sage: g.matrix()
[1 2 3|3]
[4 5 6|4]
[0 1 0|5]
[-----+-]
[0 0 0|1]
sage: parent(g.matrix())
Full MatrixSpace of 4 by 4 dense matrices over Finite Field of size 7
sage: g.matrix() == matrix(g)
True
>>> from sage.all import *
>>> G = AffineGroup(Integer(3), GF(Integer(7)))
>>> g = G([Integer(1),Integer(2),Integer(3),Integer(4),Integer(5),Integer(6),Integer(7),Integer(8),Integer(0)], [Integer(10),Integer(11),Integer(12)])
>>> g
      [1 2 3]     [3]
x |-> [4 5 6] x + [4]
      [0 1 0]     [5]
>>> g.matrix()
[1 2 3|3]
[4 5 6|4]
[0 1 0|5]
[-----+-]
[0 0 0|1]
>>> parent(g.matrix())
Full MatrixSpace of 4 by 4 dense matrices over Finite Field of size 7
>>> g.matrix() == matrix(g)
True

Composition of affine group elements equals multiplication of the matrices:

sage: # needs sage.libs.gap
sage: g1 = G.random_element()
sage: g2 = G.random_element()
sage: g1.matrix() * g2.matrix() == (g1*g2).matrix()
True
>>> from sage.all import *
>>> # needs sage.libs.gap
>>> g1 = G.random_element()
>>> g2 = G.random_element()
>>> g1.matrix() * g2.matrix() == (g1*g2).matrix()
True