# [Maxima] integration of signum & friends

Richard Hennessy rvh2007 at comcast.net
Sat Dec 13 16:39:20 CST 2008

```Yes, that sound like a good idea.  I have already kidnapped code from other files before because I only want one part of it, not the
whole thing.

Rich

----- Original Message -----
From: "Barton Willis" <willisb at unk.edu>
To: "Richard Hennessy" <rvh2007 at comcast.net>
Cc: "Maxima List" <maxima at math.utexas.edu>
Sent: Saturday, December 13, 2008 11:34 AM
Subject: Re: [Maxima] integration of signum & friends

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

```