Menu

#3947 Odd interplay between eigenvalues() and numer

None
open
nobody
5
2022-02-21
2022-02-21
Eric Barth
No

A student in my class noticed

ee:eigenvalues(matrix([-3,2],[-4,3]));
ee,numer;

(both of the above return [[-1,1],[1,1]])

but

eigenvalues(matrix([-3,2],[-4,3])),numer;

(returns [[%e^(1.0*%i*%pi),%e^(2.0*%i*%pi)],[1,1]])

similarly strange behavior for

ff:eigenvalues(matrix([1,1],[4,4]));
ff,numer

and

eigenvalues(matrix([−1,1],[−4,−4])),numer;

wxMaxima version: 19.05.7
using wxWidgets version: wxWidgets 3.1.2
Maxima version: 5.43.0
Maxima build date: 2019-06-05 13:14:43
Host type: x86_64-apple-darwin13.4.0
System type: Darwin 18.7.0 X86-64
Lisp implementation type: SBCL
Lisp implementation version: 1.5.3
wxMaxima's idea of the directory layout is:
User configuration dir: /Users/barth/.maxima/


Discussion

  • Robert Dodier

    Robert Dodier - 2022-02-21

    solve is eventually called to solve an equation equivalent tox^2 - 1 to find the eigenvalues (you can see this via trace(solve) and then calling eigenvalues). In the presence of the numer flag, that comes out differently.

    A lot of built-in functions don't handle float numbers consistently. My advice to the user is to postpone numerical evaluation as long as possible, and apply it only at the end. I know that's not always easy to follow, and since Maxima doesn't prohibit doing otherwise, the user can't know that something is going wrong from the outset.

    I am inclined to think solve or at least eigenvalues (and maybe other callers) should disable numer, float, and keepfloat before proceeding. If anyone else has an opinion, I would be interested to hear about it.

     
  • Robert Dodier

    Robert Dodier - 2022-02-21

    I encountered a different solve + numer bug while investigating; see #3948.

     

Log in to post a comment.