Skip to content
Snippets Groups Projects
Commit 5bb467b1 authored by orestis.malaspin's avatar orestis.malaspin
Browse files

added tp edo in md

parent e21cbe3b
Branches
Tags
No related merge requests found
...@@ -37,6 +37,10 @@ deploy: all ...@@ -37,6 +37,10 @@ deploy: all
make -C tpIntegrales make -C tpIntegrales
cp tpIntegrales/*.pdf mti/tpIntegrales/ cp tpIntegrales/*.pdf mti/tpIntegrales/
cp tpIntegrales/tp_integrales_conv.html mti/tpIntegrales/index.html cp tpIntegrales/tp_integrales_conv.html mti/tpIntegrales/index.html
mkdir -p mti/tpEdo
make -C tpEdo
cp tpEdo/*.pdf mti/tpEdo/
cp tpEdo/tpEquadiffs.html mti/tpEdo/index.html
clean: clean:
rm -rf *.html *.pdf rm -rf *.html *.pdf
...@@ -2,7 +2,7 @@ import numpy as np ...@@ -2,7 +2,7 @@ import numpy as np
import matplotlib.pyplot as plt import matplotlib.pyplot as plt
swiss = np.array([2.100350058, 3.150525088, 4.900816803, 6.534422404, 10.501750292, 13.302217036, 24.970828471, 31.271878646, 39.323220537, 43.640606768, 57.292882147, 76.079346558, 100.116686114, 131.271878646, 158.576429405, 256.709451575, 256.709451575, 268.378063011, 309.218203034, 353.325554259, 453.675612602]) swiss = np.array([2.100350058, 3.150525088, 4.900816803, 6.534422404, 10.501750292, 13.302217036, 24.970828471, 31.271878646, 39.323220537, 43.640606768, 57.292882147, 76.079346558, 100.116686114, 131.271878646, 158.576429405, 256.709451575, 256.709451575, 268.378063011, 309.218203034, 353.325554259, 453.675612602])
swiss = np.array([18, 27, 42, 56, 90, 114, 214, 268, 337, 374, 491, 652, 858, 1125, 1359, 2200, 2200, 2300, 2650, 3028, 3888]) swiss = np.array([18, 27, 42, 56, 90, 114, 214, 268, 337, 374, 491, 652, 858, 1125, 1359, 2200, 2200, 2300, 2650, 3028, 3888]) / 0.02
days = np.array(range(1,len(swiss)+1)) days = np.array(range(1,len(swiss)+1))
...@@ -27,18 +27,21 @@ def timestep(S0, I0, R0, dt, beta, lamb, N): ...@@ -27,18 +27,21 @@ def timestep(S0, I0, R0, dt, beta, lamb, N):
S0 = 8000000 S0 = 8000000
I0 = swiss[0] I0 = swiss[0]
R0 = 0 R0 = 0
max_t = 50*days[len(swiss)-1] max_t = 3*days[len(swiss)-1]
n_steps = 10000 n_steps = 100000
dt = max_t / n_steps dt = max_t / n_steps
N = compute_n(S0, I0, R0) N = compute_n(S0, I0, R0)
lamb = 1.0 / 14.0 lamb = 1.0 / 14.0
beta_1 = 0.34 beta_1 = 0.35
beta_2 = beta_1 / 100 beta_2 = beta_1 / 10
beta = beta_1 beta = beta_1
R0 = beta / lamb
print(R0)
s_list = [S0] s_list = [S0]
r_list = [R0] r_list = [R0]
i_list = [I0] i_list = [I0]
...@@ -49,20 +52,21 @@ for i in range(0, n_steps): ...@@ -49,20 +52,21 @@ for i in range(0, n_steps):
i_list.append(I1) i_list.append(I1)
r_list.append(R1) r_list.append(R1)
t_list.append(t_list[i]+dt) t_list.append(t_list[i]+dt)
if (t_list[i+1] >= 27 and t_list[i+1] <= 127) : # if (R1 >= 0.9 * N):
beta = beta_2 # print(t_list[i]+dt)
else: # break
beta = beta_1 # if (t_list[i+1] < 27) :
# beta = beta_1
# elif (I1 > 0.01*N) :
# beta = beta_2
# else: # else:
# beta = 1 # beta = beta_1
s = np.array(s_list) s = np.array(s_list)
r = np.array(r_list) r = np.array(r_list)
ii = np.array(i_list) ii = np.array(i_list)
t = np.array(t_list) t = np.array(t_list)
s
print(t)
plt.semilogy(t, s, 'b') plt.semilogy(t, s, 'b')
plt.semilogy(t, r, 'r') plt.semilogy(t, r, 'r')
plt.semilogy(t, ii, 'k') plt.semilogy(t, ii, 'k')
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment