#2122 Wrong plotting of functions based on spherical harmonics

closed
nobody
None
5
2011-10-26
2011-01-04
Anonymous
No

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.

Discussion

  • Comment has been marked as spam. 
    Undo

    You can see all pending comments posted by this user  here

    Anonymous - 2011-01-04
     
  • Dieter Kaiser

    Dieter Kaiser - 2011-10-25

    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

     
  • Dieter Kaiser

    Dieter Kaiser - 2011-10-26
    • status: open --> closed
     
  • Dieter Kaiser

    Dieter Kaiser - 2011-10-26

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

     

Log in to post a comment.