You forgot the "[0]":
sage: m = matrix([[1,2,2],[2,1,2],[2,2,1]]); m [1 2 2] [2 1 2] [2 2 1] sage: es = m.eigenvectors_right(); es [(5, [ (1, 1, 1) ], 1), (-1, [ (1, 0, -1), (0, 1, -1) ], 2)] sage: eval, evec, degen = es[0]; evec[0] (1, 1, 1) sage: m*evec[0] (5, 5, 5) On Fri, Dec 5, 2008 at 8:13 AM, Rafael <[EMAIL PROTECTED]> wrote: > > Hello, > > I would like to pick out individual eigenvectors of a matrix, and then > be able to manipulate them as vectors. I tried the following: > > ---------------------------------------------------------------------- > | Sage Version 3.2, Release Date: 2008-11-20 | > | Type notebook() for the GUI, and license() for information. | > ---------------------------------------------------------------------- > > sage: m=matrix([[1,2,2],[2,1,2],[2,2,1]]);m > > [1 2 2] > [2 1 2] > [2 2 1] > sage: es = m.eigenvectors_right();es > > [(5, [ > (1, 1, 1) > ], 1), (-1, [ > (1, 0, -1), > (0, 1, -1) > ], 2)] > sage: eval, evec, degen = es[0];evec > > [ > (1, 1, 1) > ] > > But if I try to act with the matrix m on the eigenvector evec, there > is a problem: > > sage: m*evec > --------------------------------------------------------------------------- > TypeError Traceback (most recent call > last) > > /Users/rafael/<ipython console> in <module>() > > /Applications/sage-3.2/local/lib/python2.5/site-packages/sage/ > structure/element.so in sage.structure.element.Matrix.__mul__ (sage/ > structure/element.c:11189)() > > /Applications/sage-3.2/local/lib/python2.5/site-packages/sage/ > structure/coerce.so in > sage.structure.coerce.CoercionModel_cache_maps.bin_op (sage/structure/ > coerce.c:5782)() > > TypeError: unsupported operand parent(s) for '*': 'Full MatrixSpace of > 3 by 3 dense matrices over Integer Ring' and 'Category of sequences in > Vector space of degree 3 and dimension 1 over Rational Field > User basis matrix: > [1 1 1]' > > On the other hand, the following does work: > > sage: w=vector([1, 1, 1]);w > (1, 1, 1) > sage: m*w > (5, 5, 5) > > So it seems I need to convert evec, which is a sequence, to a vector. > Is there a way to do this (other than retyping as above)? > > Many thanks! > > Rafael > > > --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---