Ask Your Question
0

How to plot the output of A.eigenvectors_right()?

asked 2014-09-07 23:06:34 -0500

this post is marked as community wiki

This post is a wiki. Anyone with karma >750 is welcome to improve it.

Trying to calculate and plot eigenvectors of a matrix A. The call A.eigenvectors_right() works, but the output is a mixed list. How to extract the eigenvectors from it to plot them? The attempt: s=Lambda.eigenvectors_right();v=s[1];v[1];v1=v[1];plot(v1) gives an error message... Thank you.

edit retag flag offensive close merge delete

2 answers

Sort by » oldest newest most voted
0

answered 2014-09-08 02:22:59 -0500

FrédéricC gravatar image

updated 2014-09-08 02:23:50 -0500

Something like that maybe ?

sage: A = matrix([[2, 3], [3, 5]])
sage: l = flatten([u[1] for u in A.eigenvectors_right()])
sage: add(plot(v) for v in l)
edit flag offensive delete link more

Comments

It works!...

DVD gravatar imageDVD ( 2014-09-08 14:46:20 -0500 )edit
0

answered 2014-09-08 03:57:01 -0500

tmonteil gravatar image

As you can see, v1 is a list containing a single tuple:

sage: v1
[(1, 1.618033988749895?)]

You want to plot the vector described by the inner tuple, not the list. The following should work:

sage: plot(v1[0])
edit flag offensive delete link more

Comments

Looks like "flatten()" is needed (see below)...

DVD gravatar imageDVD ( 2014-09-08 14:44:47 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2014-09-07 23:06:34 -0500

Seen: 264 times

Last updated: Sep 08 '14