How do you overlay trajectory graphs on vector fields?

asked 2016-02-04 06:06:41 +0200

jeannedarc gravatar image

updated 2020-06-01 14:36:53 +0200

FrédéricC gravatar image

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!

edit retag flag offensive close merge delete


Your code does not work, how is sol defined ?

tmonteil gravatar imagetmonteil ( 2016-02-04 11:33:18 +0200 )edit

Probably the list of solutions to something?

kcrisman gravatar imagekcrisman ( 2016-02-04 14:43:44 +0200 )edit