## #559 diff(realpart) bogus

closed
nobody
5
2012-12-04
2004-04-19
Stavros Macrakis
No

declare(z,complex)\$
diff(realpart(z),z) => realpart(1) ?!?!

Realpart is nowhere differentiable!

## Discussion

• Robert Dodier
2006-07-29

Logged In: YES
user_id=501686

Observed in 5.9.3cvs.

• Robert Dodier
2006-07-29

• labels: --> Lisp Core - Complex

• Dieter Kaiser
2009-05-10

In the routine sdiff the following code is implemented:

((member (caar e) '(%realpart %imagpart) :test #'eq)
(list (cons (caar e) nil) (sdiff (cadr e) x)))

That is

diff(realpart(f(x)),x) --> realpart(diff (f(x),x)) and
diff(imagpart(f(x),x)) --> imagpart(diff(f(x),x)).

Both rules are wrong. The code should be simply cut out. The testsuite has no problems and does not depend on this code.

These are some results, when we cut out the code:

(%i1) declare(z,complex)\$

A noun form for a complex symbol:

(%i2) diff(realpart(z),z);
(%o2) 'diff('realpart(z),z,1)
(%i3) diff(imagpart(z),z);
(%o3) 'diff('imagpart(z),z,1)

For a real symbol realpart and imagpart simplify and we get:

(%i4) diff(realpart(x),x);
(%o4) 1
(%i5) diff(imagpart(x),x);
(%o5) 0

An unknown function does not simplify and we get again the noun forms:

(%i6) diff(realpart(f(x)),x);
(%o6) 'diff('realpart(f(x)),x,1)
(%i7) diff(imagpart(f(x)),x);
(%o7) 'diff('imagpart(f(x)),x,1)

Maxima knows how to simplify the sin function and we get:

(%i8) diff(realpart(sin(x)),x);
(%o8) cos(x)
(%i9) diff(imagpart(sin(x)),x);
(%o9) 0

I think we should cut out the above code.

Dieter Kaiser

• Dieter Kaiser
2009-05-10

• milestone: --> Includes_proposed_fix

• Dieter Kaiser
2009-06-04

The rule for differentiating realpart and imagpart has been removed as suggested.

Closing this bug report as fixed.

Dieter Kaiser

• Dieter Kaiser
2009-06-04

• status: open --> closed