Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

collect multiple variables and simplify their coefficients

Hi there!

In Mathematica you can do the following: Collect[expr, {var1, var2, var3}, Simplify]

This transforms

expr = var1expr11 + var2expr22 + var1var2expr12 + ...

to

var1Simplify[expr11] + var2Simplify[expr22] + var1var2Simplify[expr12] + ...

I was wondering if there is an easy way to do this in Sage.

So my questions are:

1) How can you collect multiple variables?

2) How can you manipulate their coefficients? (each coefficient is independent)

3*) How can you print the result in a pretty way? (e.g. collecting the expression by coefficients and printing each term in a new line)

Thanks for your help!