Ask Your Question

Revision history [back]

solving a system of DEs numerically and plotting the solution

Hi everyone. I want to hand Sage a system of nonlinear DEs with initial values, and I'd like a plot of the solutions. Is there a best way to do this? For example, to solve this system: ds/dt=-si, di/st=si-2i, dr/dt=2i, s(0)=1, i(0)= 0.00000127, r(0)=0, I did this in Sage:

sage: (s,i,r)=var('s,i,r')

sage: des=[-1si, si-2i, i]

sage: desolve_system_rk4(des, [s,i,r], ics=[0, 1, 0.00000127, 0], ivar=t, end_points=20)

Sage gave me a list of points, but I couldn't figure out a way to plot s, i, and r using the points it gave me. Thanks!