Suggestion: eliminate the dependence on to_poly with something like (the
function min_to_abs
is similar)
(%i11) max_to_abs(e) := subst('max = lambda([[x]], xreduce(lambda([a,b], (a
+ b + abs(a-b))/2),x)),e)$
(%i12) max_to_abs(max(a,b));
(%o12) (abs(b-a)+b+a)/2
(%i13) subst([a=1,b= 42], %);
(%o13) 42
(%i14) max_to_abs(max(x,y,z) * max(p,q));
(%o14) ((abs(q-p)+q+p)*(abs(z-(abs(y-x)+y+x)/2)+z+(abs(y-x)+y+x)/2))/4
Substitution of a function by a lambda form is handy.
Barton