# HG changeset patch
# User Simon King <king@mathematik.unijena.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

b


5  5  David Joyner  initial version 
6  6  David Joyner  (200605) various modifications to address William 
7  7  Stein's TODO's. 
8   William Stein (20061209): many revisions. 
 8  William Stein (20061209): many revisions. 
 9  Simon King (20081116): __call__ method 
9  10  
10  11  EXAMPLES: 
11  12  
… 
… 

56  57  import sage.structure.element as element 
57  58  from sage.matrix.matrix import Matrix 
58  59  from sage.structure.factorization import Factorization 
 60  from sage.all import prod 
59  61  
60  62  def is_MatrixGroupElement(x): 
61  63  return isinstance(x, MatrixGroupElement) 
… 
… 

196  198  have latex and xdvi installed). 
197  199  """ 
198  200  return self.__mat._latex_() 
 201  
 202  def __call__(self,p): 
 203  """ 
 204  The linear action of self on a polynomial p. 
 205  The field over which self is defined should coerce 
 206  into the field over which p is defined. Moreover, 
 207  the number of variables of the parent of p must fit 
 208  to the dimension of self. 
 209  EXAMPLE: 
 210  sage: M=Matrix(GF(3),[[1,2],[1,1]]) 
 211  sage: G=MatrixGroup([M]) 
 212  sage: g=G.0 
 213  sage: R.<x,y>=GF(3)[] 
 214  sage: p=x*y^2 
 215  sage: g(p) 
 216  x^3 + x^2*y  x*y^2  y^3 
 217  """ 
 218  return p.left_matrix_action(self) 
199  219  
200  220  def _mul_(self,other): 
201  221  """ 
diff r 9d1b040aa879 r 545b25190c74 sage/rings/polynomial/multi_polynomial.pyx
a

b


5  5  
6  6  from sage.misc.derivative import multi_derivative 
7  7  from sage.rings.infinity import infinity 
 8  from sage.all import prod 
8  9  
9  10  def is_MPolynomial(x): 
10  11  return isinstance(x, MPolynomial) 
… 
… 

367  368  z *= var 
368  369  return ring(v) 
369  370  
 371  def left_matrix_action(self, M): 
 372  """ 
 373  Matrix action on polynomials. 
 374  
 375  EXAMPLE: 
 376  sage: M=Matrix(GF(3),[[1,2],[1,1]]) 
 377  sage: G=MatrixGroup([M]) 
 378  sage: g=G.0 
 379  sage: R.<x,y>=GF(3)[] 
 380  sage: p=x*y^2 
 381  sage: p.left_matrix_action(g) 
 382  x^3 + x^2*y  x*y^2  y^3 
 383  """ 
 384  R = self.parent() 
 385  cdef tuple Rgens = R.gens() 
 386  cdef list Coef = self.coefficients() 
 387  cdef list Expo = self.exponents() 
 388  cdef int n = len(Rgens) 
 389  cdef int l = len(Coef) 
 390  cdef int i,k 
 391  
 392  cdef list Y 
 393  q = R(0) 
 394  # The images of the ring variables under the action of self 
 395  cdef list Im = [sum([Y[i]*Rgens[i] for i in xrange(n)]) for Y in M.list()] 
 396  for i from 0<=i<l: 
 397  X = Expo[i] 
 398  c = Coef[i] 
 399  q += c*prod([Im[k]**X[k] for k in xrange(n)]) 
 400  return q 
 401  
370  402  def _mpoly_dict_recursive(self, vars=None, base_ring=None): 
371  403  """ 
372  404  Return a dict of coefficent entries suitable for construction of a MPolynomial_polydict 