1 | initial version |
Starting from the example given in the documentation that you could have bothered to read by typing desolve_system_rk4?
:
sage: from sage.calculus.desolvers import desolve_system_rk4
sage: x,y,t=var('x y t')
sage: P=desolve_system_rk4([x*(1-y),-y*(1-x)],[x,y],ics=[0,0.5,2],ivar=t,end_points=20)
you can see that the solution P
is a list of [t, x, y]
triplets. You can display the x
and y
functions by :
sage: line2d([[i, j] for i, j, k in P])
sage: line2d([[i, k] for i, j, k in P])
(line2d
interpolates between the points that list_plot
displays, which is aesthetically more pleasing).Your phase trajectory can therefore be displayed by :
sage: line2d([[j,k] for i, j, k in P])
HTH,