Okay, the bad news is that diff cannot be trusted. The answer may look right to some users but it is not, especially
for complicated expressions. The good news is that integrate works fine and I have discovered nothing at all wrong with
it.
The diff function cannot be fixed easily but it can be fixed, it is a mathematical reasoning error on my part and the
fix requires writing a lot of currently non-existent code. But it will get done sometime over the next week or so I
hope. I don't expect any problems. Patience is a good thing. I have to introduce the diracdelta functional in order
to make this work, currently I have been trying to avoid that, but it can't be done any other way that I know of (or
want to). The solution is to define and make use of a new pw.mac function diracdelta(x). That will work.
The problem can be shown to exist easily by considering the the following two identities.
integrate(diff(expr,x),x) == expr + C
and
diff(integrate(expr,x),x) == expr
They don't both work. Try it on a complex expression like this one. I have suppresed the output.
(%i4) f:[-10, -(x^2-25)/15, -5, -15/3*sin(3*x), 0, x^2/6, 5, -(8*x-65)/6, 10];
(%i18) radcan(pw(f,x));
(%i19) radcan(diff(integrate(pw(f,x),x),x));
/*the next output line is seriously incorrect
(%i20) radcan(integrate(diff(pw(f,x),x),x));
Rich