Ask Your Question
0

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

asked 2014-09-08 06:06:34 +0100

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 09:22:59 +0100

FrédéricC gravatar image

updated 2014-09-08 09:23:50 +0100

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 21:46:20 +0100 )edit
0

answered 2014-09-08 10:57:01 +0100

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 21:44:47 +0100 )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-08 06:06:34 +0100

Seen: 899 times

Last updated: Sep 08 '14