Closed rtoy closed 4 months ago
Imported from SourceForge on 2024-07-09 11:12:07 Created by robert_dodier on 2023-10-10 02:55:48 Original: https://sourceforge.net/p/maxima/bugs/4195/#a124
Imported from SourceForge on 2024-07-09 11:12:11 Created by willisbl on 2023-10-11 12:17:55 Original: https://sourceforge.net/p/maxima/bugs/4195/#6f7a
I'm unable to reproduce this with either Clozure CL (version 1.12.2, Windows) or SBLC (2.2.0, Windows). And I don't have a machine that can run CMU CL.
There was a flub in the commit commit 24a57b649a78077ad0fe76a7d849a9bfd1bed574 . I left a bit of debugging stuff in the code, but I fixed that.
Both Clozure CL and SBCL compile limit.lisp
without errors or warnings, I think. Does CMU CL report any errors?
I'm out of ideas. Suggestions on how to sort this?
Imported from SourceForge on 2024-07-09 11:12:14 Created by rtoy on 2023-10-12 14:05:09 Original: https://sourceforge.net/p/maxima/bugs/4195/#f0d9
I can reproduced this but I'm using snapshot-2023-08, which is slightly newer than 21e. I get something deterministic:
(%i1) limit(gamma(x)/gamma(1/x), x, 0, plus);
Evaluation took 0.1000 seconds (0.1000 elapsed) using 12.052 MB.
(%o1) 0
(%i2) limit(gamma(x)/gamma(1/x), x, 0, plus);
Type-error in KERNEL::OBJECT-NOT-LIST-ERROR-HANDLER: 0 is not of type LIST
[Condition of type TYPE-ERROR]
Restarts:
0: [MACSYMA-QUIT] Maxima top-level
Debug (type H for help)
(SPECREPP (0 . 0))
Source:
; File: /home/toy/src/sourceforge/maxima/src/simp.lisp
(CAAR E)
0]
The backtrace is:
0] back 9
0: (SPECREPP (0 . 0))
1: (SUBST1 ((MEXPT SIMP) $X -1) $Z (0 . 0))
2: (SUBST1 ((MEXPT SIMP) $X -1) $Z ((MEXPT SIMP) $%PI (0 . 0)))
3: (SUBST1 ((MEXPT SIMP) $X -1)
$Z
((MTIMES SIMP) ((MEXPT SIMP) 2 ((RAT SIMP) 1 2))
((MEXPT SIMP) $%PI (0 . 0))
((MEXPT SIMP) $Z ((MPLUS SIMP) ((RAT SIMP) -1 2) $Z))
((MEXPT SIMP) $%E ((MTIMES SIMP) -1 $Z))))
4: (MAXIMA-SUBSTITUTE ((MEXPT SIMP) $X -1)
$Z
((MTIMES SIMP) ((MEXPT SIMP) 2 ((RAT SIMP) 1 2))
((MEXPT SIMP) $%PI (0 . 0))
((MEXPT SIMP) $Z ((MPLUS SIMP) ((RAT SIMP) -1 2) $Z))
((MEXPT SIMP) $%E ((MTIMES SIMP) -1 $Z))))
5: (STIRLING0 ((MFACTORIAL SIMP) ((MPLUS SIMP) -1 ((MEXPT SIMP) $X -1))))
6: (STIRLING0
((MEXPT SIMP) ((MFACTORIAL SIMP) ((MPLUS SIMP) -1 ((MEXPT SIMP) $X -1)))
-1))
7: (STIRLING0
((MTIMES SIMP)
((MEXPT SIMP) ((MFACTORIAL SIMP) ((MPLUS SIMP) -1 ((MEXPT SIMP) $X -1)))
-1)
((MFACTORIAL SIMP) ((MPLUS SIMP) -1 $X))))
8: (TAYLIM
((MTIMES SIMP)
((MEXPT SIMP) ((MFACTORIAL SIMP) ((MPLUS SIMP) -1 ((MEXPT SIMP) $X -1)))
-1)
((MFACTORIAL SIMP) ((MPLUS SIMP) -1 $X)))
$X
$ZEROA
#<unused-arg>)
Perhaps the backtrace will have some hints onw what's happening. I'll take a closer look later,
Imported from SourceForge on 2024-07-09 11:12:18 Created by willisbl on 2023-10-12 14:10:48 Original: https://sourceforge.net/p/maxima/bugs/4195/#5145
Maybe it's obvious, but I'd focus on the functions stirling0
and taylim
as suspects.
Imported from SourceForge on 2024-07-09 11:12:21 Created by rtoy on 2023-10-22 23:11:59 Original: https://sourceforge.net/p/maxima/bugs/4195/#5be8
It's not just 21e. I get the same error with 21d (released in 2018-12). Now it's hard to tell if the issue is in cmucl or in maxima. I think the next step is to try to do a bisect of maxima using cmucl 21d to see if there's some obvious change in maxima that causes this issue.
Imported from SourceForge on 2024-07-09 11:12:25 Created by dgildea on 2023-10-22 23:59:30 Original: https://sourceforge.net/p/maxima/bugs/4195/#7417
Using cmucl 21b, the problem also seems to start with the commit mentioned above.
Imported from SourceForge on 2024-07-09 11:12:29 Created by rtoy on 2023-10-24 21:40:13 Original: https://sourceforge.net/p/maxima/bugs/4195/#a22b
I've found a solution to this problem, but I'm not sure it's quite right. The solution is modifying stirling
so that it conses up a new list for the third arg to maxima-substitute
. It appears maxima-substitute
can modify the third arg, which, in this case destructively modifies the constant list used in stirling
.
But I'm not yet sure if that's right; I need to study what maxima-substitute does to the third arg to see if can really modify the third arg. If so, we need to find all uses of maxima-substitute
and make sure the third arg is always a fresh list and not a constant.
Imported from SourceForge on 2024-07-09 11:12:32 Created by rtoy on 2023-10-25 14:40:08 Original: https://sourceforge.net/p/maxima/bugs/4195/#0a44/0f20
That's similar to what I did, but I just generated the third arg for maxima-substitute
anew each time.
As an experiment, I reverted the changes to stirling0
. This fixes the issues with cmucl. But now maxima fails the one test: limit(gamma(1/x)/gamma(x),x,0,'plus)
which returns minf
instead of inf
.
I think your proposed version of stirling is much easier to understand than the current version and is worth doing no matter what.
I'm going to take a closer look to see what's special about the changes to stirling0
that causes the bad behavior. It still troubles me that cmucl complains about ignoring the special var e
in simplimit%limit
. I can't find where e
was declared to be special (when building maxima from scratch). Cmucl's debugger actually says it's an undefined variable with a specific value that looks like the third arg of maxima-substitute
, but modified from the actual constant list in the source.
Imported from SourceForge on 2024-07-09 11:12:36 Created by rtoy on 2023-10-25 14:44:52 Original: https://sourceforge.net/p/maxima/bugs/4195/#0a44/0f20/1553
And it's not just cmucl that complains about ssimplim%limit
. Clisp says:
;; Compiling file /home/toy/src/sourceforge/maxima/src/limit.lisp ...
WARNING: in SIMPLIM%LIMIT in lines 2968..2970 : Binding variable E can cause
side effects despite IGNORE declaration since it is declared SPECIAL.
WARNING: in SIMPLIM%LIMIT in lines 2968..2970 : Binding variable X can cause
side effects despite IGNORE declaration since it is declared SPECIAL.
Don't know why cmucl doesn't think x
is a specvar.
In any case, we really need to figure this out. I'll file a different bug for this issue.
Imported from SourceForge on 2024-07-09 11:12:05 Created by dgildea on 2023-10-09 15:05:16 Original: https://sourceforge.net/p/maxima/bugs/4195
I get the following nondeterministic error with cmucl 21e
I do not get the error with ecl or gcl.
The problem seems to start with this commit: