Loading [MathJax]/jax/output/HTML-CSS/jax.js

First time here? Check out the FAQ!

Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Manually grouping symbolic terms

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