rtoy / maxima

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

package ezunits: ev(dimensions(u), nouns) stack overflow #4179

Closed rtoy closed 4 months ago

rtoy commented 4 months ago

Imported from SourceForge on 2024-07-09 19:33:12 Created by robert_dodier on 2021-05-30 21:37:03 Original: https://sourceforge.net/p/maxima/bugs/3789


Not sure where the error is exactly, but the following fails with current (near-5.45) Maxima. This is with Clisp but I saw the same behavior with SBCL.

(%i1) 81*sin(acos((77-x)/81)-atan(7/20));
                                    77 - x         7
(%o1)                   81 sin(acos(------) - atan(--))
                                      81           20
(%i2) load(ezunits);
(%o2)       /Users/dodier/tmp/maxima-code/share/ezunits/ezunits.mac
(%i3) :lisp (defparameter foo (coerce-float-fun $%o1 '((mlist) $x)))
FOO
(%i3) :lisp (funcall foo 5)
11.239418709847056
(%i3) :lisp (funcall foo 55)
66.31087764466791
(%i3) :lisp (funcall foo 'u)

*** - Program stack overflow. RESET

Looks like the problem is in processing dimensions in the presence of the nouns flag.

dimensions(abs(1.524157902758726E-4*(77-u)^2-1));

is okay, while

dimensions(abs(1.524157902758726E-4*(77-u)^2-1)), nouns;

results in the stack overflow. The simplest example I found is:

dimensions(u),nouns;

leads to stack overflow. This is a bug in the implementation of dimensions in ezunits.

The original problem was to plot the expression shown in %o1 as shown in: https://stackoverflow.com/questions/67755215/plotting-a-graph-with-ezunits

rtoy commented 4 months ago

Imported from SourceForge on 2024-07-09 19:33:14 Created by robert_dodier on 2021-06-01 03:20:20 Original: https://sourceforge.net/p/maxima/bugs/3789/#7f57


rtoy commented 4 months ago

Imported from SourceForge on 2024-07-09 19:33:17 Created by robert_dodier on 2021-06-01 03:20:20 Original: https://sourceforge.net/p/maxima/bugs/3789/#b24e


Fixed by commit 967397.