piecewise function with integrals



Sample Maxima session

(%i12) 12/0;
(%o12) if x>0 then 12/x else (if x<0 then 12/x else 'und)

I don't think this answer will be very popular.

How about a feature like this that just aborts if an error occurs and return 
the input.
(%i23) (1/(x-1) *  if equal(x,1) then 1 else (x-1));
(out23) (if equal(x,1) then 1 else x-1)/(x-1)
(%i24) ifthen2iif(%);
(out24) iif(equal(x,1),1,x-1)/(x-1)
(%i25) pulliniif(%);
(out25) iif(equal(x,1),1/(x-1),1)
(%i26) if errcatch(simpiifs(%))=[] then % else %%; /* could be a function, I 
think */
`quotient' by `zero'
(out26) iif(equal(x,1),1/(x-1),1)

This requires converting to iif() which can be undone as the last step in 
you want "if then".  iif() avoids "and's" and "or's", since they are not 
allowed in the condition.  They are never actually needed, BTW.

Rich