rtoy / maxima

A Clone of Maxima's repo
Other
0 stars 0 forks source link

real/imagpart don't know about conjugate #3227

Closed rtoy closed 3 months ago

rtoy commented 3 months ago

Imported from SourceForge on 2024-07-07 17:46:48 Created by macrakis on 2004-10-12 15:47:24 Original: https://sourceforge.net/p/maxima/bugs/617


realpart('conjugate(x)) => 'conjugate(x) imagpart('conjugate(x)) => 0

should be realpart(x) and -imagpart(x)

What is really going on is that rpart (realpart, imagpart, etc.) don't even know conjugate exists, which is not surprising, since it is in a load package (eigen).

Worse, there is no way to extend realpart/imagpart to new functions at the Maxima or the Lisp level.

-s

rtoy commented 3 months ago

Imported from SourceForge on 2024-07-07 17:46:49 Created by robert_dodier on 2006-07-31 04:14:47 Original: https://sourceforge.net/p/maxima/bugs/617/#a3c8


Logged In: YES user_id=501686

Observed in 5.9.3cvs. There has been very recent (last 2 days) work on src/conjugate.lisp, so maybe that stuff just needs some adjustment. (The definition in share/../eigen.mac is superseded by src/conjugate.lisp.)

rtoy commented 3 months ago

Imported from SourceForge on 2024-07-07 17:46:53 Created by robert_dodier on 2006-07-31 04:14:47 Original: https://sourceforge.net/p/maxima/bugs/617/#3814


rtoy commented 3 months ago

Imported from SourceForge on 2024-07-07 17:46:56 Created by crategus on 2009-05-04 21:42:53 Original: https://sourceforge.net/p/maxima/bugs/617/#66ba


This would be a small extension to the routine risplit in rpart.lisp which give the expected simplifications for the realpart and imagpart of an expression with conjugate:

((eq (caar l) '$conjugate) (cons (simplify (list '(%realpart) (cadr l))) (mul -1 (simplify (list '(%imagpart) (cadr l))))))

With this extension we get:

(%i31) declare(z,complex)$

This is the example of this bug report:

(%i32) realpart(conjugate(z)); (%o32) 'realpart(z) (%i33) imagpart(conjugate(z)); (%o33) -'imagpart(z)

It would work for complex functions too:

(%i38) realpart(conjugate(sin(z))); (%o38) cosh('imagpart(z))*sin('realpart(z)) (%i39) imagpart(conjugate(sin(z))); (%o39) -sinh('imagpart(z))*cos('realpart(z))

The testsuite has no problems with this extension. If there is no further comment, I would like to commit this extension.

Dieter Kaiser

rtoy commented 3 months ago

Imported from SourceForge on 2024-07-07 17:46:59 Created by crategus on 2009-05-06 21:37:30 Original: https://sourceforge.net/p/maxima/bugs/617/#e91d


Suggested extension is commited. Closing this bug report as fixed.

Dieter Kaiser

rtoy commented 3 months ago

Imported from SourceForge on 2024-07-07 17:47:03 Created by crategus on 2009-05-06 21:38:28 Original: https://sourceforge.net/p/maxima/bugs/617/#523a


Change status to closed.

rtoy commented 3 months ago

Imported from SourceForge on 2024-07-07 17:47:06 Created by crategus on 2009-05-06 21:38:28 Original: https://sourceforge.net/p/maxima/bugs/617/#6579