Home Online Manual
Top
Back: coef
Forward: contract
FastBack: Functions and system variables
FastForward: Control structures
Up: Functions
Top: Singular Manual
Contents: Table of Contents
Index: Index
About: About this document

5.1.12 coeffs

Syntax:
coeffs ( poly_expression , ring_variable )
coeffs ( ideal_expression, ring_variable )
coeffs ( vector_expression, ring_variable )
coeffs ( module_expression, ring_variable )
coeffs ( poly_expression, ring_variable, matrix_name )
coeffs ( ideal_expression, ring_variable, matrix_name )
coeffs ( vector_expression, ring_variable, matrix_name )
coeffs ( module_expression, ring_variable, matrix_name )
Type:
matrix
Purpose:
develops each polynomial of the first argument J as a univariate polynomial in the given ring_variable z, and returns the coefficients as a matrix M.

With e denoting the maximal z-degree occuring in the polynomials of J, and d:=e+1, M = $(m_{ij})$satisfies the following conditions:

  • (i) If J is a single polynomial f, then M is a $(d\times 1)$-matrix and $m_{i+1,j}, 0\leq i\leq e$,is the coefficient of $z^i$in f.
  • (ii) If J is an ideal with generators $f_1, f_2,\ldots,f_k$then M is a $(d\times k)$-matrix and $m_{i+1,j}, 0\leq i\leq e, 1\leq j\leq k$,is the coefficient of $z^i$in $f_j$.
  • (iii) If J is a k-dimensional vector with entries $f_1, f_2,\ldots,f_k$then M is a $(dk\times 1)$-matrix and $m_{(j-1)d+i+1,1}, 0\leq i\leq e, 1\leq j\leq k$,is the coefficient of $z^i$in $f_j$.
  • (iV) If J is a module generated by s vectors $v_1, v_2,\ldots,v_s$of dimension k then M is a $(dk\times s)$-matrix and $m_{(j-1)d+i+1,r}, 0\leq i\leq e, 1\leq j\leq k, 1\leq r\leq s$,is the coefficient of $z^i$in the j-th entry of $v_r$.
The optional third argument T can be used to return the matrix of powers of z such that matrix(J) = T*M holds in each of the previous four cases.

Note:
coeffs returns the coefficient 0 at the appropriate matrix entry if a monomial is not present, while coef considers only monomials which actually occur in the given expression.

Example:
 
  ring r;
  poly f = (x+y)^3;
  poly g = xyz+z10y4;
  ideal i = f, g;
  matrix M = coeffs(i, y);
  print(M);
==> x3, 0, 
==> 3x2,xz,
==> 3x, 0, 
==> 1,  0, 
==> 0,  z10
  vector v = [f, g];
  M = coeffs(v, y);
  print(M);
==> x3, 
==> 3x2,
==> 3x, 
==> 1,  
==> 0,  
==> 0,  
==> xz, 
==> 0,  
==> 0,  
==> z10 

Syntax:
coeffs ( ideal_expression, ideal_expression )
coeffs ( module_expression, module_expression )
coeffs ( ideal_expression, ideal_expression, product_of_ringvars )
coeffs ( module_expression, module_expression, product_of_ringvars )

Type:
matrix

Purpose:
expresses each polynomial of the first argument M as a sum $\sum_{i=1}^k m_i\cdot a_i\cdot x^{e_i}$,where the $m_i$come from a specified set of monomials, the $a_i$are from the underlying coefficient ring (or field), and the $x^{e_i}$are powers of a specified ring variable x.

The second parameter K provides the set of monomials which should be sufficient to generate all entries of M.
Both M and K can be thought of as the matrices obtained by matrix(M) and matrix(K), respectively. (If M and K are given by ideals, then this matrix has just one row.)

The optional parameter product_of_ringvars determines the variable x: It is expected to be either the product of all ring variables (then x is 1, and each polynomial will be expressed as $\sum_{i=1}^k m_i\cdot a_i$,or product_of_ringvars is the product of all ring variables except one variable (which then determines x). If product_of_ringvars is omitted then x = 1 as default.

If K contains all monomials that are necessary to express the entries of M, then the returned matrix A satisfies $K\cdot A=M$.Otherwise only a subset of entries of $K\cdot A$and M will coincide. In this case, the valid entries start at M[1,1] and run from left to right, top to bottom.

Note:
Note that in general not all entries of K*A and M will coincide, depending on the set of monomials provided by K.

Example:
 
  ring r=32003,(x,y,z),dp;
  module M = [y3+x2z, xy], [-xy, y2+x2z];
  print(M);
==> y3+x2z,-xy,  
==> xy,    x2z+y2
  module K = [x2, xy], [y3, xy], [xy, x];
  print(K);
==> x2,y3,xy,
==> xy,xy,x  
  matrix A = coeffs(M, K, xy);   // leaving z as variable of interest
  print(A);   // attention: only the first row of M is reproduced by K*A
==> z,0,
==> 1,0,
==> 0,-1
See coef; kbase.