Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupport News AboutSign UpSign In
| Download

All published worksheets from http://sagenb.org

Views: 168703
Image: ubuntu2004
from sage.calculus.desolvers import desolve_odeint var('x,y') f=[x*(1-y),-y*(1-x)] t=srange(0,20,0.01) basesol=desolve_odeint(f,[0.1,0.1],t,[x,y]) baseplot = list_plot(zip(basesol[:,0],basesol[:,1])) + point((0.1, 0.1), color="red") plotList = [baseplot] @interact def _(initPrey=(0.1,5), initPredator=(0.1,5), auto_update=False): sol=desolve_odeint(f,[initPrey,initPredator],t,[x,y]) phase_plane = list_plot(zip(sol[:,0],sol[:,1])) + point((initPrey, initPredator), color="red") plotList.append(phase_plane) #Show results layerPlot = plotList[0] for i in [1..len(plotList)-1]: layerPlot = layerPlot + plotList[i] show(layerPlot)