up previous next
CoefficientsWRT    --    list of coeffs and PPs of a poly wrt indet or 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 power-products of F seen as a polynomial in X (with respect to (WRT) X); the second function does the same but viewing F as a polynomial in all the indeterminates in the set S. NOTE: 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