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.Thu, 04 Feb 2016 07:43:44 -0600How do you overlay trajectory graphs on vector fields?http://ask.sagemath.org/question/32439/how-do-you-overlay-trajectory-graphs-on-vector-fields/Hi, I'm doing a programming problem where I have to graph a vector field, then overlay trajectory graphs with different initial values on it.
So far this is what I have:
var('R, S')
plot_vector_field([3*R - R^2 - 2*R*S, 2*S - S^2 - R*S], (R,-50, 50), (S, -50, 50))
R = sol[:,0]
S = sol[:,1]
list_plot(zip(R,S), plotjoined=True)
The last line always produces a separate graph. I've tried using the "**+**" operator to "add" it to the vector field graph, but that gives me an error instead. I also don't know how to repeat the process (i.e. overlay additional trajectories) without having to make a new graph for each. Truth be told I'm only a beginning coder and have some trouble synthesizing different coding aspects together.
Any help would be greatly appreciated!
Wed, 03 Feb 2016 23:04:28 -0600http://ask.sagemath.org/question/32439/how-do-you-overlay-trajectory-graphs-on-vector-fields/Comment by kcrisman for <p>Hi, I'm doing a programming problem where I have to graph a vector field, then overlay trajectory graphs with different initial values on it. </p>
<p>So far this is what I have: </p>
<pre><code>var('R, S')
plot_vector_field([3*R - R^2 - 2*R*S, 2*S - S^2 - R*S], (R,-50, 50), (S, -50, 50))
R = sol[:,0]
S = sol[:,1]
list_plot(zip(R,S), plotjoined=True)
</code></pre>
<p>The last line always produces a separate graph. I've tried using the "<strong>+</strong>" operator to "add" it to the vector field graph, but that gives me an error instead. I also don't know how to repeat the process (i.e. overlay additional trajectories) without having to make a new graph for each. Truth be told I'm only a beginning coder and have some trouble synthesizing different coding aspects together.</p>
<p>Any help would be greatly appreciated!</p>
http://ask.sagemath.org/question/32439/how-do-you-overlay-trajectory-graphs-on-vector-fields/?comment=32444#post-id-32444Probably the list of solutions to something?Thu, 04 Feb 2016 07:43:44 -0600http://ask.sagemath.org/question/32439/how-do-you-overlay-trajectory-graphs-on-vector-fields/?comment=32444#post-id-32444Comment by tmonteil for <p>Hi, I'm doing a programming problem where I have to graph a vector field, then overlay trajectory graphs with different initial values on it. </p>
<p>So far this is what I have: </p>
<pre><code>var('R, S')
plot_vector_field([3*R - R^2 - 2*R*S, 2*S - S^2 - R*S], (R,-50, 50), (S, -50, 50))
R = sol[:,0]
S = sol[:,1]
list_plot(zip(R,S), plotjoined=True)
</code></pre>
<p>The last line always produces a separate graph. I've tried using the "<strong>+</strong>" operator to "add" it to the vector field graph, but that gives me an error instead. I also don't know how to repeat the process (i.e. overlay additional trajectories) without having to make a new graph for each. Truth be told I'm only a beginning coder and have some trouble synthesizing different coding aspects together.</p>
<p>Any help would be greatly appreciated!</p>
http://ask.sagemath.org/question/32439/how-do-you-overlay-trajectory-graphs-on-vector-fields/?comment=32441#post-id-32441Your code does not work, how is `sol` defined ?Thu, 04 Feb 2016 04:33:18 -0600http://ask.sagemath.org/question/32439/how-do-you-overlay-trajectory-graphs-on-vector-fields/?comment=32441#post-id-32441