First time here? Check out the FAQ!

Ask Your Question
0

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

asked 10 years ago

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.

Preview: (hide)

2 Answers

Sort by » oldest newest most voted
0

answered 10 years ago

FrédéricC gravatar image

updated 10 years ago

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)
Preview: (hide)
link

Comments

It works!...

DVD gravatar imageDVD ( 10 years ago )
0

answered 10 years ago

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])
Preview: (hide)
link

Comments

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

DVD gravatar imageDVD ( 10 years ago )

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: 10 years ago

Seen: 926 times

Last updated: Sep 08 '14