rtoy / maxima

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

Issues with sparse determinants #4068

Open rtoy opened 3 months ago

rtoy commented 3 months ago

Imported from SourceForge on 2024-07-09 11:14:39 Created by rtoy on 2023-11-06 16:43:15 Original: https://sourceforge.net/p/maxima/bugs/4205


The documentation says setting sparse (and ratmx) to true will cause maxima to use a technique for sparse determinants. There are a few issues here.

  1. There are no tests for this AFACT.
  2. Richard Fateman says ratmx is required, so the documentation could be wrong
  3. A simple matrix causes an error.

This causes an error (with sparse true, but ratmx false).

(%i36) determinant(matrix([1,2,3],[4,5,6],[7,8,9]));

Type-error in KERNEL::OBJECT-NOT-SYMBOL-ERROR-HANDLER:  1 is not of type SYMBOL
   [Condition of type TYPE-ERROR]

Another example:

(%i44) determinant(matrix([1,2,0],[0,2,0],[0,1,3]));

Argument X is not a NUMBER: NIL.
   [Condition of type SIMPLE-TYPE-ERROR]

But if we set ratmx:true, there's no error:

(%i46) determinant(matrix([1,2,0],[0,2,0],[0,1,3]));

(%o46)                                 6
rtoy commented 3 months ago

Imported from SourceForge on 2024-07-09 11:14:40 Created by robert_dodier on 2023-12-18 07:18:18 Original: https://sourceforge.net/p/maxima/bugs/4205/#f75e


If it's not obvious how to fix it, we probably should just nuke it. There's little benefit to having broken special-purpose code hanging around ...

rtoy commented 3 months ago

Imported from SourceForge on 2024-07-09 11:14:43 Created by macrakis on 2024-01-01 22:08:20 Original: https://sourceforge.net/p/maxima/bugs/4205/#be68


Presumably this is a related problem:

determinant(matrix([1,0,0],[1,-1,0],[-1,0,-1])),sparse:true => false

Having both sparse and ratmx true can also cause an error:

determinant(matrix([0,1,0,1],[1,0,1,1],[0,1,1,1],[0,1,1,1])),ratmx:true,sparse:true;

Maxima encountered a Lisp error:

 The value
   1
 is not of type
   LIST

Tested in Maxima 5.46.0 SBCL 2.3.0 MacOS

rtoy commented 3 months ago

Imported from SourceForge on 2024-07-09 11:14:47 Created by robert_dodier on 2024-01-08 03:46:05 Original: https://sourceforge.net/p/maxima/bugs/4205/#3b3c


I notice that the presence of ratmx changes the reported error. When ratmx = false (and sparse = true), the error is "1 is not of type SYMBOL", while the error is "1 is not of type LIST" when ratmx = true.