Menu

#2183 eigenvectors of a 10 x 10

closed
5
2015-12-12
2011-04-07
No

Of course, we shouldn't expect an explicit answer, but the error from part should not happen. One eigenvalue is 0,
by the way.

(%i9) load(eigen)$

(%i10) m : matrix([0,0,0,1,0,1,1,1,0,1],[1,1,0,0,1,0,1,0,1,0],[1,1,1,1,0,0,0,1,0,1],[0,1,1,0,0,1,1,1,1,0],[0,0,1,0,1,0,1,0,1,0],[0,1,0,0,0,0,0,1,0,0],[1,1,0,0,0,0,0,0,1,1],[1,0,1,1,1,0,1,0,0,0],[0,1,1,0,0,1,0,1,0,1],[1,0,0,1,1,0,0,1,0,0])$
(%i11) eigenvectors(m);
part: fell off the end.
#0: eigenvalues(mat=matrix([0,0,0,1,0,1,1,1,0,1],[1,1,0,0,1,0,1,0,1,0],[1,1,1,1,0,0,0,1,0,1],[0,1,1,0,0,1,1,1,1,0],[0,0,...)(eigen.mac line 94)
#1: eigenvectors(mat=matrix([0,0,0,1,0,1,1,1,0,1],[1,1,0,0,1,0,1,0,1,0],[1,1,1,1,0,0,0,1,0,1],[0,1,1,0,0,1,1,1,1,0],[0,0,...)(eigen.mac line 110)
-- an error. To debug this try: debugmode(true);

1 Attachments

Discussion

  • Yasuaki Honda

    Yasuaki Honda - 2015-05-31
    • assigned_to: Yasuaki Honda
    • Attachments has changed:

    Diff:

    --- old
    +++ new
    @@ -0,0 +1 @@
    +eigen.patch (1.4 kB; application/octet-stream)
    
    • Group: --> Includes_proposed_fix
     
  • Yasuaki Honda

    Yasuaki Honda - 2015-05-31

    I encountered the same error 'part: fell off the end' when computing eigenvalues of a matrix A of size 13x13. Checking the char poly by:
    factor(charpoly(A,x)), I obtained x^3*(polynomial of degree 10). In such cases where solve(charpoly(A,x)),x) returns only a subset of the set of all solutions, this error occurs.

    I debugged the functions eigenvalues() and eigenvectors() defined in share/matrix/eigen.mac and found that they seem not assume the above case. They use the dimension of the matrix to iterate the list of solutions of charpoly() of the matrix.

    I attached in this mail a patch to fix this issue. Applying this patch, both functions return a subset of eigenvalues / vectors when only a subset is obtained. A warning message that some solutions were lost in solve() is printed.

    If this way of fixing is OK, I will add some tests, a short explanation in the document, and commit this to the main branch of the git repository.

     
  • Yasuaki Honda

    Yasuaki Honda - 2015-06-01

    I committed the patch along with some document in Matrix.texi and tests in rtest15.mac. All the tests there and share/matrix/rtest_eigen.mac are passed.

    commit dcd222b40105d0d21de2ee5cda955432cbfaf5b9

     
  • Nils Bruin

    Nils Bruin - 2015-08-10

    I think the following example triggers the same bug. Perhaps it's worth checking if the proposed fix here solves the problem?

    (%i1) M: matrix([-d, 0, 0, 0, v, 0, 0, 0, 0, -a], [0, -e, 0, 0, 0, v, 0, 0, 0, a], [0, w, f, 0, 0, 0, v, 0, 0, 0], [0, 0, t, -d, 0, 0, 0, v, 0, 0], [b, 0, 0, 0, -g, 0, 0, 0, 0, 0], [0, b, 0, 0, 0, -g, 0, 0, 0, 0], [0, 0, b, 0, 0, 0, -g, 0, 0, 0], [0, 0, 0, b, 0, 0, 0, -g, 0, 0], [0, 0, -c, 0, 0, 0, 0, 0, -u, 0], [0, 0, c, 0, 0, 0, 0, 0, 0, -u])$
    
    (%i2) eigenvalues(M);
    
    part: fell off the end.
    #0: eigenvalues(mat=matrix([-d,0,0,0,v,0,0,0,0,-a],[0,-e,0,0,0,v,0,0,0,a],[0,w,f,0,0,0,v,0,0,0],[0,0,t,-d,0,0,0,v,0,0],[...)(eigen.mac line 94)
    #1: eigenvalues(_l=[matrix([-d,0,0,0,v,0,0,0,0,-a],[0,-e,0,0,0,v,0,0,0,a],[0,w,f,0,0,0,v,0,0,0],[0,0,t,-d,0,0,0,v,0,0],...)
     -- an error. To debug this try: debugmode(true);
    
     
  • Yasuaki Honda

    Yasuaki Honda - 2015-08-11

    The matrix M mentioned in the post by Nils did NOT trigger the error in Maxima built from the latest source tree. Note that my patch was posted after the 5.36.1 release, so the latest official binary does not have it.

    Nils san, would you please double check the version of your Maxima?

     
    • Nils Bruin

      Nils Bruin - 2015-08-11

      I observed this with the ancient version of maxima shipped with sage. Thanks for checking. Good to know this issue will disappear once we upgrade the maxima included in sage.

       
  • Yasuaki Honda

    Yasuaki Honda - 2015-08-11

    status changed to 'close'.

     
  • Yasuaki Honda

    Yasuaki Honda - 2015-08-11
    • status: open --> closed
     
  • Mike

    Mike - 2015-12-12

    I don't understand the significance of the line:

    count:length(multiplicities),
    

    in the patch. My thought is that count should represent the sum of multiplicities rather than the number of multiplicities---if so, then I think that the line

    count:apply("+",multiplicities),
    

    should be used instead.

    It seems to me that this change would also fix the missing eigenvectors bug (#3008).

     

    Last edit: Mike 2015-12-13

Log in to post a comment.