︠e5435f69-48c4-47d5-a419-7d8768b2bae6s︠ #Plotting All Populations separately var ("P, H, G, C") K=20 r=0.27 a1=1 b1=1 a2=1 b2=1 a3=1 b3=1 a4=1 b4=1 d1=0.3 d2=0.8 d3=.3 k2=.2 #manipulating k1 so we do not define it here #P_Prime=r*P*(1-(P/K)) - ((a1*P)/(1+b1*P))*H -((a4*P)/(1+b4*P))*G #H_Prime=c1*((a1*P)/(1+b1*P))*H - (d1*H) - ((a2*H)/(1+(b2*H)))*C -k1*H*G #G_prime =c3*((a3*P)/(1+b3*P))*G - (d3*G) - ((a4*G)/(1+(b4*G)))*C -k2*H*G #C_Prime=c2*((a2*H)/(1+(b2*H)))*C - (d2*C) + c4*((a4*G)/(1+(b4*G)))*C t=srange(0,4000) P_prime=0.1*P*(1-P/500) - (P/(100+P))*H - (P/(100+P))*G H_prime=0.3*(P/(100+P))*H -.09*H - (H/(100+H))*C -(50*H*G) G_prime=0.6*(P/(100+P))*G -.3*G -(G/(100+G))*C -(30*H*G) C_prime=0.7*(H/(100+H))*C + 1.8*(G/(100+G))*C -.1*C #solving the four differential equations #Model=desolve_odeint([(r*P*(1-(P/K)) - ((a1*P)/(1+b1*P))*H -((a4*P)/(1+b4*P))*G,c1*((a1*P)/(1+b1*P))*H - (d1*H) - ((a2*H)/(1+(b2*H)))*C -(k1*H*G),(c3*((a3*P)/(1+b3*P))*G - (d3*G) - ((a4*G)/(1+(b4*G)))*C -(k2*H*)G), c2*((a2*H)/(1+(b2*H)))*C - (d2*C) + c4*((a4*G)/(1+(b4*G)))*C)], dvars=[P,H, G, C], times=t, ics=[10,20, 15, 5]) Model=desolve_odeint([P_prime,H_prime,G_prime,C_prime], dvars=[P,H,G,C], times=t,ics=[3,2,2,1]) #plotting the four equations for P,H,G,C list_plot(list(zip(t,Model[:,0])), color="green", legend_label="Plants", plotjoined=True, axes_labels=["$Time$", "$Population Sizes$"], thickness=2) list_plot(list(zip(t,Model[:,1])), color="brown", legend_label="Herbivore 1", plotjoined=True, thickness=2) list_plot(list(zip(t,Model[:,2])), color="darkblue", legend_label="Herbivore 2", plotjoined=True, thickness=2) list_plot(list(zip(t,Model[:,3])), color="violet", legend_label="Carnivore", plotjoined=True, thickness=2) #try: #increase interspecies competition #make half densities higher #make growth rates lower ︡3f8a5cc2-aa1d-4b4d-8903-c91dff7037e3︡{"stdout":"(P, H, G, C)\n"}︡{"file":{"filename":"/home/user/.sage/temp/project-1d07646b-e7ca-424e-b60c-d2930be726ff/990/tmp_l2o49689.svg","show":true,"text":null,"uuid":"f65ee24c-7e4e-46d7-b5d5-ee62a09f2561"},"once":false}︡{"file":{"filename":"/home/user/.sage/temp/project-1d07646b-e7ca-424e-b60c-d2930be726ff/990/tmp_ukhco02z.svg","show":true,"text":null,"uuid":"20a61760-6cb9-4415-a798-58eb003f3b80"},"once":false}︡{"file":{"filename":"/home/user/.sage/temp/project-1d07646b-e7ca-424e-b60c-d2930be726ff/990/tmp_n82r30xu.svg","show":true,"text":null,"uuid":"fc5fa9a5-0a42-49cd-9406-e79f21c7728b"},"once":false}︡{"file":{"filename":"/home/user/.sage/temp/project-1d07646b-e7ca-424e-b60c-d2930be726ff/990/tmp_8murc13r.svg","show":true,"text":null,"uuid":"750cc358-9559-43e5-af53-292e2a3da048"},"once":false}︡{"done":true} ︠9571fc22-c3f1-4329-bb83-a33e5b485b21︠ #Possible constants of interaction between herbivores #decreasing sigmoid f(x)=(1/(1+x^2)) plot(f, xmin=0,xmax=30, ymin=0) ︡43de5d94-ed21-4fd9-a25e-45261efe4330︡{"file":{"filename":"/home/user/.sage/temp/project-1d07646b-e7ca-424e-b60c-d2930be726ff/739/tmp_dt889j6b.svg","show":true,"text":null,"uuid":"891729a2-d244-421a-9e3a-8b7b58039acc"},"once":false}︡{"done":true} ︠b024de28-2930-430e-b994-6c7bfc068ddb︠ #increasing sigmoid h(x)=(x/(1+x^3)) plot(h, xmin=0, ymin=0) ︡47b40c4e-caf6-4bc6-b73f-c473086ea10a︡{"file":{"filename":"/home/user/.sage/temp/project-1d07646b-e7ca-424e-b60c-d2930be726ff/739/tmp_84y3dmup.svg","show":true,"text":null,"uuid":"6f024804-0be2-4a11-a95e-e7c99d3e26a8"},"once":false}︡{"done":true} ︠1b1e3589-47a2-463e-97b7-0432ab8753acs︠ #inverted parabola g(x)=(-(x^2)-15)+35 plot(g) ︡074c9733-52cd-433e-8d8f-87b97a2b4008︡{"file":{"filename":"/home/user/.sage/temp/project-1d07646b-e7ca-424e-b60c-d2930be726ff/514/tmp_jab80o43.svg","show":true,"text":null,"uuid":"09eb7eff-ae9e-4987-854f-f962bc42635b"},"once":false}︡{"done":true} ︠b2e2c396-609b-487c-a837-dbdf1b891e75︠