rtoy / maxima

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

eigenvalues called on array causes Maxima to crash #3017

Open rtoy opened 4 months ago

rtoy commented 4 months ago

Imported from SourceForge on 2024-07-07 09:30:53 Created by tomdean1939 on 2018-06-30 21:26:14 Original: https://sourceforge.net/p/maxima/bugs/3447


An incorrect call to eigenvalues() causes maxima to display an error message and exit. If maxima is started with 'xterm -e maxima' it sometimes causes the xterm to close.

Console output:

> /usr/local/bin/maxima
Maxima branch_5_41_base_450_g0b7d9cd_dirty http://maxima.sourceforge.net
using Lisp GNU Common Lisp (GCL) GCL 2.6.12
Distributed under the GNU Public License. See the file COPYING.
Dedicated to the memory of William Schelter.
The function bug_report() provides bug reporting information.
(%i1) A: make_array(any,3,3);
(%o1) {Lisp Array: #2A((NIL NIL NIL) (NIL NIL NIL) (NIL NIL NIL))}
(%i2) fill_array(A,[x-y, x, 0, x, x-y, x, 0, x, x-y]);
(%o2) fill_array({Lisp Array: #2A((NIL NIL NIL) (NIL NIL NIL) (NIL NIL NIL))}, 
[x - y, x, 0, x, x - y, x, 0, x, x - y])
(%i3) listarray(A);
(%o3) [false, false, false, false, false, false, false, false, false]
(%i4) eigenvalues(A);

Maxima encountered a Lisp error:

 Condition in MACSYMA-TOP-LEVEL [or a callee]: INTERNAL-SIMPLE-ERROR: Caught fatal error [memory may be damaged]

Automatically continuing.
To enable the Lisp debugger set *debugger-hook* to nil.
(%i5) eigenvalues(A);

Unrecoverable error: Segmentation violation..
rtoy commented 4 months ago

Imported from SourceForge on 2024-07-07 09:30:54 Created by robert_dodier on 2018-09-02 21:10:44 Original: https://sourceforge.net/p/maxima/bugs/3447/#6c47


Diff:


--- old
+++ new
@@ -1 +0,0 @@
-maxima.err (997 Bytes; application/octet-stream)
rtoy commented 4 months ago

Imported from SourceForge on 2024-07-07 09:30:57 Created by robert_dodier on 2018-09-02 21:13:51 Original: https://sourceforge.net/p/maxima/bugs/3447/#f559


Diff:


--- old
+++ new
@@ -1,3 +1,30 @@
 An incorrect call to eigenvalues() causes maxima to display an error message and exit.  If maxima is started with 'xterm -e maxima' it sometimes causes the xterm to close.

-Console output attached.
+Console output:
+
+~~~~
+> /usr/local/bin/maxima
+Maxima branch_5_41_base_450_g0b7d9cd_dirty http://maxima.sourceforge.net
+using Lisp GNU Common Lisp (GCL) GCL 2.6.12
+Distributed under the GNU Public License. See the file COPYING.
+Dedicated to the memory of William Schelter.
+The function bug_report() provides bug reporting information.
+(%i1) A: make_array(any,3,3);
+(%o1) {Lisp Array: #2A((NIL NIL NIL) (NIL NIL NIL) (NIL NIL NIL))}
+(%i2) fill_array(A,[x-y, x, 0, x, x-y, x, 0, x, x-y]);
+(%o2) fill_array({Lisp Array: #2A((NIL NIL NIL) (NIL NIL NIL) (NIL NIL NIL))}, 
+[x - y, x, 0, x, x - y, x, 0, x, x - y])
+(%i3) listarray(A);
+(%o3) [false, false, false, false, false, false, false, false, false]
+(%i4) eigenvalues(A);
+
+Maxima encountered a Lisp error:
+
+ Condition in MACSYMA-TOP-LEVEL [or a callee]: INTERNAL-SIMPLE-ERROR: Caught fatal error [memory may be damaged]
+
+Automatically continuing.
+To enable the Lisp debugger set *debugger-hook* to nil.
+(%i5) eigenvalues(A);
+
+Unrecoverable error: Segmentation violation..
+~~~~
rtoy commented 4 months ago

Imported from SourceForge on 2024-07-07 09:31:01 Created by robert_dodier on 2018-09-02 21:13:52 Original: https://sourceforge.net/p/maxima/bugs/3447/#3e3a


I see the error is caused by calling eigenvalues on an array, while eigenvalues (and most other functions) expect a matrix, which is a different kind of object in Maxima.

Tom, I think what you want is:

A : matrix ([x - y, x, 0], [x, x - y, x], [0, x, x - y]);
eigenvalues (A);
rtoy commented 4 months ago

Imported from SourceForge on 2024-07-07 09:31:05 Created by robert_dodier on 2018-09-02 21:15:18 Original: https://sourceforge.net/p/maxima/bugs/3447/#c59c


The error here is that eigenvalues and other functions which expect a matrix should print a more intelligible error message if they get some other kind of input.