Alexander Hupfer wrote: > thank you for your quick reply. > > Just for sake of documentation: > > the output reads as [[[eigenvalue1, eigenvalue2],[multiplicity of > EVal1, multiplicity of EVal2]], Eigenvect of EVal1,..., Eigenvect > EVal1, Eigenvect of EVal2,..., Eigenvect of EVal2]
Interestingly, there doesn't seem to be an easy way to tell (from the output) which eigenvector goes with which eigenvalue in the following examples: sage: M = matrix(SR,4,4, [[0,1,0,0],[0,0,0,0],[0,0,2,0],[0,0,0,2]]); M [0 1 0 0] [0 0 0 0] [0 0 2 0] [0 0 0 2] sage: M._maxima_().eigenvectors().sage() [[[0, 2], [2, 2]], [1, 0, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]] sage: M = matrix(SR,4,4, [[0,0,0,0],[0,0,0,0],[0,0,2,1],[0,0,0,2]]); M [0 0 0 0] [0 0 0 0] [0 0 2 1] [0 0 0 2] sage: M._maxima_().eigenvectors().sage() [[[0, 2], [2, 2]], [1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0]] I believe MMA helps you by making sure that the list of eigenvectors is exactly as long as the sum of the multiplicities by inserting zero vectors where needed (in other words, you can just count multiplicities to get a generating set for the eigenspace). The Sage eigenvectors_right command avoids the problem by returning a set of eigenvectors associated with each eigenvalue. Thanks, Jason > > On 4 Mrz., 12:44, Jason Grout <jason-s...@creativetrax.com> wrote: >> sonium wrote: >>> Hi, I have problems calculating the eigenvectors of a symbolic matrix. >>> I tried: >>> a,b = var('a'),var('b') >>> M = matrix(SR,4,4,((a, 0, 0, 0), (0,-a,0,0), (0,0,a,0), (0,0,0,-a))) >>> M.eigenvectors_right() >>> what results in: >>> AttributeError: 'SymbolicArithmetic' object has no attribute 'degree' >> This comes from us not having a special implementation of the eigen >> functions for symbolic matrices (i.e., using maxima). For now, you can do: >> >> sage: a,b = var('a'),var('b') >> sage: M = matrix(SR,4,4,((a, 0, 0, 0), (0,-a,0,0), (0,0,a,0), (0,0,0,-a))) >> sage: M._maxima_().eigenvectors().sage() >> [[[-a, a], [2, 2]], [0, 1, 0, 0], [0, 0, 0, 1], [1, 0, 0, 0], [0, 0, 1, 0]] >> >> Seehttp://maxima.sourceforge.net/docs/manual/en/maxima_25.html#Item_003a... >> to understand the output of the command. >> >> The specific error you received came from there not being a .degree() >> method for a symbolic polynomial. >> >> >> >>> and >>> P.<a,b> = PolynomialRing(QQ) >>> M = matrix(P,4,4,((a, 0, 0, 0), (0,-a,0,0), (0,0,a,0), (0,0,0,-a))) >>> M.eigenvectros_right() >>> what gives: >>> Traceback (most recent call last): >>> File "<stdin>", line 1, in <module> >>> File "/home/sage/sagenb/sage_notebook/worksheets/sonium/1/code/ >>> 26.py", line 6, in <module> >>> M.eigenvectors_right() >>> File "/home/sage/sage_install/sage-a/local/lib/python2.5/site- >>> packages/SQLAlchemy-0.4.6-py2.5.egg/", line 1, in <module> >>> File "matrix2.pyx", line 3054, in >>> sage.matrix.matrix2.Matrix.eigenvectors_right (sage/matrix/matrix2.c: >>> 18020) >>> File "matrix2.pyx", line 3000, in >>> sage.matrix.matrix2.Matrix.eigenvectors_left (sage/matrix/matrix2.c: >>> 17523) >>> File "matrix2.pyx", line 2755, in >>> sage.matrix.matrix2.Matrix.eigenspaces_left (sage/matrix/matrix2.c: >>> 16250) >>> File "matrix2.pyx", line 1058, in sage.matrix.matrix2.Matrix.fcp >>> (sage/matrix/matrix2.c:7456) >>> File "polynomial_element.pyx", line 2288, in >>> sage.rings.polynomial.polynomial_element.Polynomial.factor (sage/rings/ >>> polynomial/polynomial_element.c:18681) >>> NotImplementedError >> I'm not sure what is going on here... >> >> Thanks, >> >> Jason > > > --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---