Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
""" Elements of Affine Groups
The class in this module is used to represent the elements of :func:`~sage.groups.affine_gps.affine_group.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
AUTHORS:
- Volker Braun """
#***************************************************************************** # Copyright (C) 2013 Volker Braun <vbraun.name@gmail.com> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 2 of the License, or # (at your option) any later version. # http://www.gnu.org/licenses/ #*****************************************************************************
""" 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 :meth:`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: 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]
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] """ r""" Create element of an affine group.
TESTS::
sage: G = AffineGroup(4, GF(5)) sage: g = G.random_element() sage: TestSuite(g).run() """ # Note: the coercion framework expects that we raise TypeError for invalid input raise TypeError('A must be a matrix') raise TypeError('A must be an element of '+str(parent.matrix_space())) raise TypeError('b must be an element of '+str(parent.vector_space()))
""" 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] """
""" 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) """
def matrix(self): """ Return the standard matrix representation of ``self``.
.. SEEALSO::
- :meth:`AffineGroup.linear_space()`
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
Composition of affine group elements equals multiplication of the matrices::
sage: g1 = G.random_element() sage: g2 = G.random_element() sage: g1.matrix() * g2.matrix() == (g1*g2).matrix() True """
""" Return a string representation of ``self``.
EXAMPLES::
sage: G = AffineGroup(2, QQ) sage: g = G([[1, 1], [0, 1]], [3,4]) sage: g [1 1] [3] x |-> [0 1] x + [4] """ else:
r""" Return a LaTeX representation of ``self``.
EXAMPLES::
sage: G = AffineGroup(2, QQ) sage: g = G([[1, 1], [0, 1]], [3,4]) sage: latex(g) \vec{x}\mapsto \left(\begin{array}{rr} 1 & 1 \\ 0 & 1 \end{array}\right)\vec{x} + \left(\begin{array}{r} 3 \\ 4 \end{array}\right) sage: g._latex_() '\\vec{x}\\mapsto \\left(\\begin{array}{rr}\n1 & 1 \\\\\n0 & 1\n\\end{array}\\right)\\vec{x} + \\left(\\begin{array}{r}\n3 \\\\\n4\n\\end{array}\\right)' """
""" Return the composition of ``self`` and ``other``.
INPUT:
- ``other`` -- another element of the same affine group.
OUTPUT:
The product of the affine group elements ``self`` and ``other`` defined by the composition of the two affine transformations.
EXAMPLES::
sage: G = AffineGroup(2, GF(3)) sage: g = G([1,1, 0,1], [0,1]) sage: h = G([1,1, 0,1], [1,2]) sage: g*h [1 2] [0] x |-> [0 1] x + [0] sage: g.matrix() * h.matrix() == (g*h).matrix() True """
""" Apply the affine transformation to ``v``.
INPUT:
- ``v`` -- a multivariate polynomial, a vector, or anything that can be converted into a vector.
OUTPUT:
The image of ``v`` under the affine group element.
EXAMPLES::
sage: G = AffineGroup(2, QQ) sage: g = G([0,1,-1,0],[2,3]); g [ 0 1] [2] x |-> [-1 0] x + [3] sage: v = vector([4,5]) sage: g(v) (7, -1)
sage: R.<x,y> = QQ[] sage: g(x), g(y) (y + 2, -x + 3) sage: p = x^2 + 2*x*y + y + 1 sage: g(p) -2*x*y + y^2 - 5*x + 10*y + 20
The action on polynomials is such that it intertwines with evaluation. That is::
sage: p(*g(v)) == g(p)(*v) True
Test that the univariate polynomial ring is covered::
sage: H = AffineGroup(1, QQ) sage: h = H([2],[3]); h x |-> [2] x + [3] sage: R.<z> = QQ[] sage: h(z+1) 3*z + 2 """
""" Define the multiplicative action of the affine group elements.
EXAMPLES::
sage: G = AffineGroup(2, GF(3)) sage: g = G([1,2,3,4], [5,6]) sage: g [1 2] [2] x |-> [0 1] x + [0] sage: v = vector(GF(3), [1,-1]); v (1, 2) sage: g*v (1, 2) sage: g*v == g.A() * v + g.b() True """
""" Return the inverse group element.
OUTPUT:
Another affine group element.
EXAMPLES::
sage: G = AffineGroup(2, GF(3)) sage: g = G([1,2,3,4], [5,6]) sage: g [1 2] [2] x |-> [0 1] x + [0] sage: ~g [1 1] [1] x |-> [0 1] x + [0] sage: g * g.inverse() [1 0] [0] x |-> [0 1] x + [0] sage: g * g.inverse() == g.inverse() * g == G(1) True """
""" Compare ``self`` with ``other``.
OUTPUT:
boolean
EXAMPLES::
sage: F = AffineGroup(3, QQ) sage: g = F([1,2,3,4,5,6,7,8,0], [10,11,12]) sage: h = F([1,2,3,4,5,6,7,8,0], [10,11,0]) sage: g == h False sage: g == g True """ return richcmp_not_equal(lx, rx, op)
""" 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]] """
|