up previous next
CoefficientsWRT

list of coeffs and PPs of a polynomial wrt an indet or a list of indets

Syntax
CoefficientsWRT(F: RINGELEM, F: RINGELEM): LIST
CoefficientsWRT(F: RINGELEM, S: LIST of RINGELEM): LIST

Description
This function returns the list of the coefficients and PPs of F seen as a polynomial in X, and indeterminate or a list of indeterminates. All entries in the returned list are RingElem in RingOf(F).

Example
/**/ Use R ::= QQ[x,y,z]; 
/**/ f := x^3*z+x*y+x*z+y+2*z;
/**/ Cx :=  CoefficientsWRT(f, x);  -- same as...
/**/ Cx :=  CoefficientsWRT(f, [x]);
/**/ indent(Cx);
[
  record[PP := 1, coeff := y +2*z],
  record[PP := x, coeff := y +z],
  record[PP := x^3, coeff := z]
]
/**/ f = sum([M.coeff * M.PP | M In Cx]);
true
/**/ Foreach M In Cx Do Print "  +(", M.coeff, ")*", M.PP; EndForeach;
  +(y +2*z)*1  +(y +z)*x  +(z)*x^3

/**/ Cxz :=  CoefficientsWRT(f, [x,z]);
/**/ indent(Cxz);
[
  record[PP := 1, coeff := y],
  record[PP := z, coeff := 2],
  record[PP := x, coeff := y],
  record[PP := x*z, coeff := 1],
  record[PP := x^3*z, coeff := 1]
]

See Also