1 | initial version |
Using true polynomials, separating variables, we can ask for coefficients of involved monomials...
R.<a,b,c> = PolynomialRing(QQ)
S.<x,y> = PolynomialRing(R)
f = a*x^2 + a*y^2 + b*y^2 + c*y^2 + (2*a*y + b*y)*x
And now:
for entry in f: print(entry)
gives:
sage: for entry in f: print(entry)
....:
(a, x^2)
(2*a + b, x*y)
(a + b + c, y^2)
So each entry
collects the corresponding monomial in $x,y$ in its last component, the first component being the coefficient.