Given a symbolic expression like:
sage: var("a b c x y")
(a, b, c, x, y)
sage: a*x^2 + a*y^2 + b*y^2 + c*y^2 + (2*a*y + b*y)*x
How can I manually collect terms together? I want to represent this equation in the form:
Ax2+Bxy+Cy2
Where A=a,B=2a+b,C=a+b+c. Desired output should be:
a*x^2 + (2*a + b)*x*y + (a + b + c)*y^2
And then is there any way to read off these coefficients? Thanks