Newbie - integrate piecewise function



> As Stavros points out, one COULD try to do stuff like this...
> 
> diff ( (if p then f(x) else g(x)) ,x )    ==>
> if p then diff(f(x),x) else diff(g(x),x)

Assuming you "believe in" delta functions, you might actually want to
look at the transitions, something like:

     diff( if x<0 then f(x) else g(x) ) ->

       if (x<0 then diff(f(x),x) else
          if equal(x,0) then delta(0)* ( limit(g(x),x,0,plus) -
limit(f(x),x,0,minus) )
           else diff(g(x),x) )

(and let's not quibble about the details).

Not to mention that some functions are even more problematic:

    diff( if ratnump(x)  then 1 else 0 )

is nowhere differentiable.