How to order a sum in ascending order of the powers? [closed]

Consider the sum

x^1+x^3+x^2+x^4


I want to order this sum in such the I have the powers in ascending order

x^1+x^2+x^3+x^4


And I want the procedure to be completely general, so that i works on any polynomial of any finite order in x. I have tried Expand (I have another series, not the simple example above) and it doesn't order my series the way I want.

• don't you get that by default: expr = x^1 + x^3 + x^2 + x^4; expr?
– kglr
Jul 25, 2018 at 15:14

inverseorder[expr_] := HoldForm[expr /. Plus -> CirclePlus // Evaluate] /. CirclePlus -> Plus