I tried to expand this polynomials. With x, it is increasing with the right order, however with b it is in a random order. The only difference is that I change b to x and it works.
Expand[FullSimplify[a00*1 + a01*0 + a02/12 + a10*0 + a11*(1/(12 k) - b/(2 k) + b^2/(2 k)) + a12*(b/(6 k) - b^2/(2 k) + b^3/(3 k)) + a20/12 + a21*(-(b/(6 k^2)) + b^2/(2 k^2) - b^3/(3 k^2)) + a22 (1/144 + 1/(180 k^2) - b^2/(6 k^2) + b^3/(3 k^2) - b^4/(6 k^2))], b]
1/12 (12 a00 + a02 + a20) + a22/144 + a22/(180 k^2) - (a21 b)/( 6 k^2) + (a21 b^2)/(2 k^2) - (a22 b^2)/(6 k^2) - (a21 b^3)/( 3 k^2) + (a22 b^3)/(3 k^2) - (a22 b^4)/(6 k^2) + a11/(12 k) - ( a11 b)/(2 k) + (a12 b)/(6 k) + (a11 b^2)/(2 k) - (a12 b^2)/(2 k) + ( a12 b^3)/(3 k)
Change b to x and it works.
Expand[FullSimplify[a00*1 + a01*0 + a02/12 + a10*0 + a11*(1/(12 k) - x/(2 k) + x^2/(2 k)) + a12*(x/(6 k) - x^2/(2 k) + x^3/(3 k)) + a20/12 + a21*(-(x/(6 k^2)) + x^2/(2 k^2) - x^3/(3 k^2)) + a22 (1/144 + 1/(180 k^2) - x^2/(6 k^2) + x^3/(3 k^2) - x^4/(6 k^2))], x]
a22/144 + a22/(180 k^2) + (a11 + (12 a00 + a02 + a20) k)/(12 k) - ( a21 x)/(6 k^2) - (a11 x)/(2 k) + (a12 x)/(6 k) + (a21 x^2)/( 2 k^2) - (a22 x^2)/(6 k^2) + (a11 x^2)/(2 k) - (a12 x^2)/(2 k) - ( a21 x^3)/(3 k^2) + (a22 x^3)/(3 k^2) + (a12 x^3)/(3 k) - (a22 x^4)/( 6 k^2)
What is wrong?
(Full)Simplify
uses heuristics to try to come up with something reasonable. There are no guarantees about the result. (2) Parts of expressions are auto-sorted by Mathematica, e.g.b+a
is transformed toa+b
. This makes it easy to detect thata+b
andb+a
are the same thing. But it also means that the choice of symbol names may affect the final structure, and therefore the simplification of expression. $\endgroup$