Ask Your Question

My first question: When using desolve_system_rk4(), is there a way to see the plots of the dependent variables vs. the independent variable? Thanks.

asked 2015-03-23 18:13:06 -0500

GeoffH gravatar image

updated 2015-03-23 19:30:14 -0500

calc314 gravatar image
 x,y,t=var('x y t')
Q=[ [i,j] for i,j,k in P]
# Q=[ [j,k] for i,j,k in P]
Q=[ [j,k] for i,j,k in P]
plot(x);plot(y) #Doesn't work
edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2015-03-23 19:34:34 -0500

calc314 gravatar image

The command desolve_system_rk4 returns a list of lists of the form [time pt, x value, y value]. You can use a list comprehension as below to pull out coordinate pairs. Then, you can plot using the line command.

x,y,t=var('x y t')
tx = [[q[0],q[1]] for q in P]
ty =  [[q[0],q[2]] for q in P]
edit flag offensive delete link more


wow...I'm amazed at how helpful that is. I didn't understand how desolve_system_rk4 worked, so I couldn't work out how to get the tx and ty curves. Now I have a much better idea of both...thanks!

GeoffH gravatar imageGeoffH ( 2015-03-23 23:05:31 -0500 )edit

Then you should accept the answer by clicking on the check mark.

rws gravatar imagerws ( 2015-03-24 01:58:32 -0500 )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

1 follower


Asked: 2015-03-23 18:13:06 -0500

Seen: 336 times

Last updated: Mar 23 '15