Menu

#3008 Eigenvectors are missing

None
closed
nobody
7
2016-05-22
2015-08-28
Peter Bruin
No

It seems that the fix for bug #2183 introduced a new bug causing eigenvectors() to miss some eigenvectors:

Maxima branch_5_37_base_17_gce242fd 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) M: matrix([1, 1, 0], [0, 1, 0], [0, 0, 2]);
                                  [ 1  1  0 ]
                                  [         ]
(%o1)                             [ 0  1  0 ]
                                  [         ]
                                  [ 0  0  2 ]
(%i2) eigenvectors(M);
(%o2)                  [[[1, 2], [2, 1]], [[[1, 0, 0]]]]

The eigenvector [0, 0, 1] is missing. After reverting commit dcd222b (I'm not suggesting this is the right fix), the correct output is given:

(%i2) eigenvectors(M);
(%o2)           [[[1, 2], [2, 1]], [[[1, 0, 0]], [[0, 0, 1]]]]

Discussion

  • Mike

    Mike - 2015-12-20

    I agree that the patch for bug #2183 seems to be the cause of the issue. As an experiment, I suggest eliminating (or commenting out) the line

    count:length(multiplicities),
    

    and replacing it with the line

    count:apply("+",multiplicities),
    

    in the patched file "eigen.mac". In my limited testing, that change seemed to fix things for me.

     
    • Peter Bruin

      Peter Bruin - 2015-12-22

      This certainly looks like the correct fix to me. (I also checked that it fixes my example, but haven't done extensive tests.)

       
    • Robert Dodier

      Robert Dodier - 2016-05-17

      Re: count:apply("+",multiplicities), I'm pretty sure that's incorrect. In the loop at line 121 in share/matrix/eigen.mac, index1 is supposed to be an index for the eigenvalues and multiplicities, which are the same length. I'm pretty sure that it can't be right to assign anything other than length(multiplicities) (as it is at present).

      I have a different patch which I am working on. I'll try to update this report soon.

       
      • Mike

        Mike - 2016-05-18

        My suggestion of count:apply("+",multiplicities) was based on a cursory examination of the code in the #2183 patch only. From the standpoint of not changing code that was in place prior to #2183, I believe my suggestion was correct. With that being said, my current thinking is that a better solution is to keep count:length(multiplicities) and eliminate count:mi(count-part(multiplicities,index1)+1) in line 122.

         

        Last edit: Mike 2016-05-18
  • Robert Dodier

    Robert Dodier - 2016-05-22
    • status: open --> closed
     
  • Robert Dodier

    Robert Dodier - 2016-05-22

    Fixed by commit 3e4e107. Closing this report.

     

Log in to post a comment.

MongoDB Logo MongoDB
Gen AI apps are built with MongoDB Atlas
Atlas offers built-in vector search and global availability across 125+ regions. Start building AI apps faster, all in one place.
Try Free →