![]() | 1 | initial version |
Does this :
sage: var("a b c x y")
(a, b, c, x, y)
sage: foo = a*x^2 + a*y^2 + b*y^2 + c*y^2 + (2*a*y + b*y)*x
sage: sum([u*foo.coefficient(u) for u in (x^2, y^2, x*y)])
a*x^2 + (2*a + b)*x*y + (a + b + c)*y^2
answer your question ?
HTH,