# Ticket #4513: matrixgroupCall.patch

File matrixgroupCall.patch, 3.5 KB (added by SimonKing, 11 years ago)

call method for MatrixGroupelement? (this time with doc test) and left_matrix_action for MPolynomial

• ## sage/groups/matrix_gps/matrix_group_element.py

```# HG changeset patch
# User Simon King <king@mathematik.uni-jena.de>
# Date 1226647475 -3600
# Node ID 545b25190c747c7e1d0a143e970c848e6c6483dc
# Parent  9d1b040aa879d17374faeaf165fdd4d359e12688
__call__ method for MatrixGroupElement / left_matrix_action method for MPolynomial

diff -r 9d1b040aa879 -r 545b25190c74 sage/groups/matrix_gps/matrix_group_element.py```
 a David Joyner -- initial version David Joyner -- (2006-05) various modifications to address William Stein's TODO's. William Stein (2006-12-09): many revisions. William Stein (2006-12-09): many revisions. Simon King (2008-11-16): __call__ method EXAMPLES: import sage.structure.element as element from sage.matrix.matrix import Matrix from sage.structure.factorization import Factorization from sage.all import prod def is_MatrixGroupElement(x): return isinstance(x, MatrixGroupElement) have latex and xdvi installed). """ return self.__mat._latex_() def __call__(self,p): """ The linear action of self on a polynomial p. The field over which self is defined should coerce into the field over which p is defined. Moreover, the number of variables of the parent of p must fit to the dimension of self. EXAMPLE: sage: M=Matrix(GF(3),[[1,2],[1,1]]) sage: G=MatrixGroup([M]) sage: g=G.0 sage: R.=GF(3)[] sage: p=x*y^2 sage: g(p) x^3 + x^2*y - x*y^2 - y^3 """ return p.left_matrix_action(self) def _mul_(self,other): """
• ## sage/rings/polynomial/multi_polynomial.pyx

`diff -r 9d1b040aa879 -r 545b25190c74 sage/rings/polynomial/multi_polynomial.pyx`
 a from sage.misc.derivative import multi_derivative from sage.rings.infinity import infinity from sage.all import prod def is_MPolynomial(x): return isinstance(x, MPolynomial) z *= var return ring(v) def left_matrix_action(self, M): """ Matrix action on polynomials. EXAMPLE: sage: M=Matrix(GF(3),[[1,2],[1,1]]) sage: G=MatrixGroup([M]) sage: g=G.0 sage: R.=GF(3)[] sage: p=x*y^2 sage: p.left_matrix_action(g) x^3 + x^2*y - x*y^2 - y^3 """ R = self.parent() cdef tuple Rgens = R.gens() cdef list Coef = self.coefficients() cdef list Expo = self.exponents() cdef int n = len(Rgens) cdef int l = len(Coef) cdef int i,k cdef list Y q = R(0) # The images of the ring variables under the action of self cdef list Im = [sum([Y[i]*Rgens[i] for i in xrange(n)]) for Y in M.list()] for i from 0<=i