ASKSAGE: Sage Q&A Forum - Individual question feedhttp://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Mon, 08 Sep 2014 14:46:20 -0500How to plot the output of A.eigenvectors_right()?http://ask.sagemath.org/question/24042/how-to-plot-the-output-of-aeigenvectors_right/ 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. Sun, 07 Sep 2014 23:06:34 -0500http://ask.sagemath.org/question/24042/how-to-plot-the-output-of-aeigenvectors_right/Answer by FrédéricC for <p>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. </p>
http://ask.sagemath.org/question/24042/how-to-plot-the-output-of-aeigenvectors_right/?answer=24043#post-id-24043Something 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)Mon, 08 Sep 2014 02:22:59 -0500http://ask.sagemath.org/question/24042/how-to-plot-the-output-of-aeigenvectors_right/?answer=24043#post-id-24043Comment by DVD for <p>Something like that maybe ?</p>
<pre><code>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)
</code></pre>
http://ask.sagemath.org/question/24042/how-to-plot-the-output-of-aeigenvectors_right/?comment=24064#post-id-24064It works!...Mon, 08 Sep 2014 14:46:20 -0500http://ask.sagemath.org/question/24042/how-to-plot-the-output-of-aeigenvectors_right/?comment=24064#post-id-24064Answer by tmonteil for <p>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. </p>
http://ask.sagemath.org/question/24042/how-to-plot-the-output-of-aeigenvectors_right/?answer=24044#post-id-24044As 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])
Mon, 08 Sep 2014 03:57:01 -0500http://ask.sagemath.org/question/24042/how-to-plot-the-output-of-aeigenvectors_right/?answer=24044#post-id-24044Comment by DVD for <p>As you can see, <code>v1</code> is a list containing a single tuple:</p>
<pre><code>sage: v1
[(1, 1.618033988749895?)]
</code></pre>
<p>You want to plot the vector described by the inner tuple, not the list. The following should work:</p>
<pre><code>sage: plot(v1[0])
</code></pre>
http://ask.sagemath.org/question/24042/how-to-plot-the-output-of-aeigenvectors_right/?comment=24063#post-id-24063Looks like "flatten()" is needed (see below)...Mon, 08 Sep 2014 14:44:47 -0500http://ask.sagemath.org/question/24042/how-to-plot-the-output-of-aeigenvectors_right/?comment=24063#post-id-24063