up previous next
CoefficientsWRT

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

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

Description
The first function returns the list of the coefficients and PPs of F seen as a polynomial in X ; the second function does the same but viewing F as a polynomial in all the indeterminates in the set S . Note that coefficients in the result are RINGELEM belonging to 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 := x^3, coeff := z],
  record[PP := x, coeff := y +z],
  record[PP := 1, coeff := y +2*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 := x^3*z, coeff := 1],
  record[PP := x*z, coeff := 1],
  record[PP := x, coeff := y],
  record[PP := z, coeff := 2],
  record[PP := 1, coeff := y]
]

See Also