Re: fix for eigenvectors function in eigen.mac

Robert Dodier <[email protected]> Tue, 16 Jun 2026 22:31:37 -0700
Newsgroups gmane.comp.mathematics.maxima.general
Message-ID <CAAsY_sQ8nZMR6r9-4rVwCA+GHimb+ygOWG9HFC8-=Em0LA72sg@mail.gmail.com>
On Wed, Jun 10, 2026 at 2:12 PM ehm <[email protected]> wrote:

> Change the two lines
>
> solution:algsys(equations,unknowns),
> interm:map('rhs,solution[1]),
>
> to
>
> solution:linsolve(equations,unknowns),
> interm:map('rhs,solution),

Eric, thanks for working on this stuff. I tried the patch you
suggested and for the most part it seems to give the same results as
before (and also solves the problem you encountered). However, one of
the tests in share/matrix/rtest_eigen.mac fails, namely

block ([D1, uv], local (dmatrix),
 /* diag_matrix and diag involve loading big blobs of stuff, and
diagmatrix isn't suitable ... sigh. */
 dmatrix (L) := block ([M, n : length (L)], M : zeromatrix (n, n), for
i thru n do M[i, i] : L[i], M),
 D1 : matrix ([3, 2, 1, -5], [-1, 2, 1, -3], [5, -1, 2, 4], [3, 1, -1, 5]),
 uv : block([ratmx : true], similaritytransform (D1)),
 /* ratsimp or radcan could help here, but ratsimp simplifies
leftmatrix . D1 . rightmatrix
  * incorrectly ... sigh. Also mat_norm could help but it's embedded
in a big blob ... sigh.
  */
 float (dmatrix (uv[1][1]) - leftmatrix . D1 . rightmatrix),
 expand (%%),
 matrixmap (cabs, %%),
 maplist (lmax, %%),
 lmax (%%),
 is (%% < 1e-10));

The function similaritytransform calls eigenvectors (via
uniteigenvectors) so that patch comes into play.

I guess linsolve is returning something different than algsys for that
case -- I haven't investigated, although I will try to remember to
look at it in more detail. I suppose the first thing to try is a 2 by
2 example to see if I can find something more comprehensible.

Hope this helps,

Robert


_______________________________________________
Maxima-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/maxima-discuss