alternative eigenvector code



I wrote a Maxima function that expresses eigenvectors as polynomials in the eigenvalues; for example

 (%i15) alt_eigen(matrix([1,2,3],[4,5,6],[7,8,9]), 'var=z, 'maxdegree=1);
 (%o15) [z^2=15*z+18,[matrix([26-2*z],[2-z],[-22])],z=0,[matrix([-1],[2],[-1])]]

Here, maxdegree is the highest degree polynomial that is solved. When maxdegree is 2:

 (%i23) alt_eigen(matrix([1,2,3],[4,5,6],[7,8,9]), 'var=z, 'maxdegree=2);
 (%o23) [z=(3*sqrt(33)+15)/2,[matrix([11-3*sqrt(33)],[2-(3*sqrt(33)+15)/2],[-22])],z=-(3*sqrt(33)-15)/2,[matrix([3*sqrt(33)+11],[(3*sqrt(33)-15)/2+2],[-22])],z=0,[matrix([-1],[2],[-1])]]

For matrices with parameters, alt_eigen doesn't always return an expression that is correct for
all values of the parameters, but it does return assumptions on the parameters

 (%i25) alt_eigen(matrix([2,0,1],[1,0,2],['w,0,1]), 'var=z, 'maxdegree=1);
 (%o25) assuming(notequal((w-2)^2*(4*w+1),0),[z^2=3*z+w-2,[matrix([-3*z-2*w+4],[-4*w-1],[z+w*(1-2*z)-2])],z=0,[matrix([0],[-1],[0])]])

When w <-- 2, output %025 simplifies to unknown:

 (%i26) subst(w=2,%);
 (%o26) unknown

Comments? If you would like to test the code, I send you the 162 line file. If you all think this code
is worthy, maybe it could be placed into share/linearalgebra.


--Barton