Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Here are two helpful functions:

sage: var('x,y,z')
(x, y, z)
sage: expr=x^2*y+2*x*y*z+54*z-3*x*z
sage: expr.collect(x)
x^2*y + (2*y*z - 3*z)*x + 54*z
sage: expr.coefficients(x)
[[54*z, 0], [2*y*z - 3*z, 1], [y, 2]]