1
$\begingroup$

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.

$\endgroup$
  • 9
    $\begingroup$ don't you get that by default: expr = x^1 + x^3 + x^2 + x^4; expr? $\endgroup$ – kglr Jul 25 '18 at 15:14
0
$\begingroup$

One way is to define function

inverseorder[expr_] := HoldForm[expr /. Plus -> CirclePlus // Evaluate] /. CirclePlus -> Plus
| improve this answer | |
$\endgroup$

Not the answer you're looking for? Browse other questions tagged or ask your own question.