With Mathematica I would like collect terms from (1 + a + x + y)^4 according to the exponents of x and y, so
(1 + a + x + y)^4 = (...)x^0 y^0 + (...)x^1 y^0 + (...)x^0 y^1 + ...
The Mathematica help has a nice example which I tried to imitate:
D[f[Sqrt[ x^2 + 1 ]], {x, 3}]
Collect[%, Derivative[ _ ][ f ][ _ ], Together]
This collects derivative terms of the same order (and the same argument for f)
Can anyone explain why the following imitation does not work?
Collect[(1 + a + x + y)^4, x^_ y^_]
gives
(1 + a + x + y)^4
Any suggestions for a solution?