ordpoly(P) := block ( [n,S,i,PP], PP:expand(P), n:hipow(PP,X), S:coeff(PP,X,n)*X^n, for i:n-1 step -1 thru 0 do S:S+coeff(PP,X,i)*X^i, S );