rtoy / maxima

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

Wrong plotting of functions based on spherical harmonics #1795

Closed rtoy closed 4 months ago

rtoy commented 4 months ago

Imported from SourceForge on 2024-07-05 08:40:43 Created by *anonymous on 2011-01-04 17:34:34 Original: https://sourceforge.net/p/maxima/bugs/2122


Attached file is a script that shows d orbitals of hydrogen atom. In Maxima 22.1 it showed proper shape of these orbitals, in Maxima 23 (both Linux and Windows) there is apparently somethong wrong, the effects are different for sure comparing 22.1 and 23 version. The most probable reasons are: change in plot3d with spherical coordinates, change in orthopoly package or damaged interface to gnuplot.

rtoy commented 4 months ago

Imported from SourceForge on 2024-07-05 08:40:45 Created by *anonymous on 2011-01-04 17:34:34 Original: https://sourceforge.net/p/maxima/bugs/2122/#feb2


Attachments:

rtoy commented 4 months ago

Imported from SourceForge on 2024-07-05 08:40:48 Created by crategus on 2011-10-25 23:00:23 Original: https://sourceforge.net/p/maxima/bugs/2122/#a777


The reported bug is in the lisp function maybe-realpart. With revision 5.23 of Maxima the option $draw_realpart has been introduced for 3D-plots. The default value of this option is NIL. Therefore, the global *plot-realpart* is set to NIL, too.

The function maybe-realpart does not handle the case *plot-realpart* for a value NIL correctly.

This is the function maybe-realpart:

(defun maybe-realpart (x) (if *plot-realpart* ($realpart x) (if (eq 0 ($imagpart x)) x nil)))

The function has two bugs. 1) It is wrong to check the value of ($imagpart x) with the function eq to be zero. 2) For the case that the imaginary part is zero, it is wrong to return the value x. x might be an expression, which has a real value.

A more correct version is:

(defun maybe-realpart (x) (if *plot-realpart* ($realpart x) (if (zerop1 ($imagpart x)) ($realpart x) nil)))

With this version of maybe-realpart all plots of the reported examples work as expected.

Dieter Kaiser

rtoy commented 4 months ago

Imported from SourceForge on 2024-07-05 08:40:52 Created by crategus on 2011-10-26 18:26:41 Original: https://sourceforge.net/p/maxima/bugs/2122/#6b3a


rtoy commented 4 months ago

Imported from SourceForge on 2024-07-05 08:40:56 Created by crategus on 2011-10-26 18:26:41 Original: https://sourceforge.net/p/maxima/bugs/2122/#ec4d


Fixed in plot.lisp revision 26.10.2011 Closing this bug report as fixed. Dieter Kaiser