rtoy / maxima

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

plot2d plotting fcn by name fails on many built-in functions #1584

Closed rtoy closed 2 days ago

rtoy commented 2 days ago

Imported from SourceForge on 2024-07-04 20:17:36 Created by robert_dodier on 2005-12-19 15:54:55 Original: https://sourceforge.net/p/maxima/bugs/842


plot2d (fn_name, ...) works if the function in question is defined in Maxima by := or define, or in Lisp by DEFUN or DEFMFUN. However, if it is defined by DEFMSPEC or it is a simplifying function, plot2d complains "Undefined function".

COERCE-FLOAT-FUN in src/plot.lisp checks FBOUNDP (catches DEFUN/DEFMFUN) and looks for the MEXPR property (catches :=/define).

Failing to catch DEFMSPEC isn't a big deal (although for consistency we should do it), but not catching simplifying functions is a problem. For example

plot2d (sin, [x, 0, %pi])

fails w/ "Undefined function" although

my_sin(x) := sin(x); plot2d (my_sin, [x, 0, %pi]);

succeeds.

rtoy commented 2 days ago

Imported from SourceForge on 2024-07-04 20:17:38 Created by robert_dodier on 2006-03-28 15:22:59 Original: https://sourceforge.net/p/maxima/bugs/842/#225f


rtoy commented 2 days ago

Imported from SourceForge on 2024-07-04 20:17:41 Created by robert_dodier on 2006-03-28 15:22:59 Original: https://sourceforge.net/p/maxima/bugs/842/#b192


Logged In: YES user_id=501686

Fixed by r1.62 of src/plot.lisp -- COERCE-FLOAT-FUN extended to catch simplifying functions, DEFMSPEC, Maxima macros, and operator names.