# 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 = var1*expr11 + var2*expr22 + var1*var2*expr12 + ...

to

var1*Simplify[expr11] + var2*Simplify[expr22] + var1*var2*Simplify[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!