1 revert(exp, t) := block([f, n, v, w, r1], n : hipow(exp, t),
2 array([v,w], n), r1:1/ratcoeff(exp,t,1), v[1]:1,
3 for k:2 thru n do (v[k]:ratcoef(exp, t, k)*r1 ,w[k]: - v[k] ), w[1] : 1,
4 f : lambda([j], for i from j + 1 thru n do w[i]:w[i]-w[j]*v[i-j+1]),
5 for j from 2 thru n - 1 do apply(f,[j]), for k from 2 thru n - 1
6 do (for j from k thru n - 1 do apply(f,[j])), f : 0,
7 for k thru n do f:f+w[k]*(t*r1)^k, f)$
9 revert2(exp, var, n) := block([f, v, w, r1, n2], n2:hipow(exp,var),
10 if n2 = 0 then return(exp), array([v,w], n),
11 v[0] : ratcoef(exp, var, 0), r1:1/ratcoef(exp,var,1),
13 for k:2 thru n do (v[k]: ratcoef(exp, var, k)*r1, w[k]: - v[k] ), w[1]: 1,
14 f : lambda([j], for i from j + 1 thru n do w[i] : w[i] - w[j]*v[i-j+1] ),
15 for j from 2 thru n - 1 do apply(f,[j]), for k from 2 thru n - 1
16 do (for j from k thru n - 1 do apply(f,[j])), f : 0,
17 r1 : ratdisrep(r1), for k thru n
18 do f:ratdisrep(w[k])*(ratdisrep(var-v[0])*r1)^k+f, f)$