Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupport News AboutSign UpSign In
| Download

All published worksheets from http://sagenb.org

Views: 168738
Image: ubuntu2004
#################################################### #SIR-Modell mit print Ausgabe ##################################################### N=10 a=1./11*6.8 b=1./11 S=[10000] I=[1000] R=[0] n=S[0]+I[0]+R[0] for i in range(N): S.append(S[i]-a/n*S[i]*I[i]) I.append(I[i]+a/n*S[i]*I[i]-b*I[i]) R.append(R[i]+b*I[i]) print "S:" print S print "\nI:" print I print "\nR:" print R
S: [10000, 9438.01652892562, 8657.75731120746, 7627.43574847465, 6360.60048536907, 4947.37494059700, 3555.15066357688, 2367.49945955605, 1490.48429172774, 915.082938633003, 564.339806479179] I: [1000, 1471.07438016529, 2117.59956332297, 2955.41207484460, 3953.57351296430, 5007.38328383053, 5944.39089868424, 6591.64293009741, 6869.41783155323, 6820.32665450676, 6551.04009079634] R: [0, 90.9090909090909, 224.643125469572, 417.152176680751, 685.826001666623, 1045.24177557247, 1500.45843773888, 2040.85761034654, 2640.09787671903, 3264.59040686023, 3884.62010272449]
##################################################### #SIR-Modell mit Plot Funktion ##################################################### N=100 a=1./11*6.8 b=1./11 S=[10000] I=[1000] R=[000] n=S[0]+I[0]+R[0] for i in range(N): S.append(S[i]-a/n*S[i]*I[i]) I.append(I[i]+a/n*S[i]*I[i]-b*I[i]) R.append(R[i]+b*I[i]) show(list_plot(S, axes_labels=["Tage","S"])) show(list_plot(I, axes_labels=["Tage","I"])) show(list_plot(R, axes_labels=["Tage","R"]))