CoCalc Public Files2020-01-17-015350.sagews
Author: Jacqueline Gomez Salazar
Views : 129
#4.2.1
var("G,H,P")
k1=0.2
k2=0.2
k3=0.2
n=5
t=srange(0,500,0.1)
sol=desolve_odeint([(1)/(1+G^n)-k1*H, H-k2*P, P-k3*G],ics=[1,2,3],dvars=[H,P,G],times=t)
list_plot(zip(t,sol[:,0]),plotjoined=true)+list_plot(zip(t,sol[:,1]),color="pink",plotjoined=true)+list_plot(zip(t,sol[:,2]),color="purple",plotjoined=true)


(G, H, P)
#4.2.1
var("G,H,P")
k1=0.2
k2=0.2
k3=0.2
n=15
t=srange(0,500,0.1)
sol=desolve_odeint([(1)/(1+G^n)-k1*H, H-k2*P, P-k3*G],ics=[1,2,3],dvars=[H,P,G],times=t)
list_plot(zip(t,sol[:,0]),plotjoined=true)+list_plot(zip(t,sol[:,1]),color="pink",plotjoined=true)+list_plot(zip(t,sol[:,2]),color="purple",plotjoined=true)


(G, H, P)
#when n<8, the systen goes to a stable equilibrium and when n>8  the systems becomes unstable and a stable oscillation is made.
#4.2.2
sol=desolve_odeint([(1)/(1+G^n)-k1*H, H-k2*P, P-k3*G], ics=[1,2,3], dvars=[H,P,G], times=t)
list_plot(zip(sol[:,0],sol[:,1],sol[:,2]),plotjoined=true)

3D rendering not yet implemented
sol2=desolve_odeint([(1)/(1+G^n)-k1*H, H-k2*P, P-k3*G], ics=[2,4,6], dvars=[H,P,G], times=t)
list_plot(zip(sol2[:,0],sol2[:,1],sol2[:,2]),plotjoined=true)

3D rendering not yet implemented
sol3=desolve_odeint([(1)/(1+G^n)-k1*H, H-k2*P, P-k3*G], ics=[3,6,9], dvars=[H,P,G], times=t)
list_plot(zip(sol3[:,0],sol3[:,1],sol3[:,2]),plotjoined=true)

3D rendering not yet implemented
#4.2.3
n=2
sol3=desolve_odeint([(1)/(1+G^n)-k1*H, H-k2*P, P-k3*G], ics=[1,2], dvars=[H,G], times=t)
list_plot(zip(t,sol3[:,0]), plotjoined=true)+list_plot(zip(t,sol3[:,1]),color="green",plotjoined=true)

Error in lines 2-2 Traceback (most recent call last): File "/cocalc/lib/python2.7/site-packages/smc_sagews/sage_server.py", line 1234, in execute flags=compile_flags), namespace, locals) File "", line 1, in <module> File "/ext/sage/sage-8.9_1804/local/lib/python2.7/site-packages/sage/calculus/desolvers.py", line 1705, in desolve_odeint mxhnil=mxhnil, mxordn=mxordn, mxords=mxords, printmessg=printmessg) File "/ext/sage/sage-8.9_1804/local/lib/python2.7/site-packages/scipy/integrate/odepack.py", line 244, in odeint int(bool(tfirst))) RuntimeError: The size of the array returned by func (3) does not match the size of y0 (2).
n=10
sol3=desolve_odeint([(1)/(1+G^n)-k1*H, H-k2*P, P-k3*G], ics=[1,2], dvars=[H,G], times=t)
list_plot(zip(t,sol3[:,0]), plotjoined=true)+list_plot(zip(t,sol3[:,1]),color="green",plotjoined=true)

Error in lines 2-2 Traceback (most recent call last): File "/cocalc/lib/python2.7/site-packages/smc_sagews/sage_server.py", line 1234, in execute flags=compile_flags), namespace, locals) File "", line 1, in <module> File "/ext/sage/sage-8.9_1804/local/lib/python2.7/site-packages/sage/calculus/desolvers.py", line 1705, in desolve_odeint mxhnil=mxhnil, mxordn=mxordn, mxords=mxords, printmessg=printmessg) File "/ext/sage/sage-8.9_1804/local/lib/python2.7/site-packages/scipy/integrate/odepack.py", line 244, in odeint int(bool(tfirst))) RuntimeError: The size of the array returned by func (3) does not match the size of y0 (2).