Is there an easy way to collect terms by powers of a variable in an expression? Ie. I have an expression on the stack that looks like this
A*x^2 + A*x + B*x + C
I want to group (something like GROUP(expression,'x') ) it by powers of x, so that it looks like this:
Ax^2 + (A+B)x + C
and not something like A(x^2 + x) + Bx + C which FACTOR/SIMPLIFY/COLLECT often give me.
It would also be handy if I could extract a vector of coefficients from that expression: [A A+B C].
If anyone knows how to do this please help me out :)