Contagion

A Contagious Disease
infectious, suspicious, Recovered

SIR Model
I(t)
R(t)= 1/5days * I(t)

A model for infection
S(t):number of suspicious person
I(t):number of infectious person
I(t) = 5 * 10^-9 / day*person I(t)*S(t)

SIR Model
S(t)= -5*10^-9/day*person I(t)S(t)
I(t) = 5 * 10^-9 / day*person I(t)*S(t)
R(t)= 1/5days * I(t)
System, Explicit

from xxx import *

h = 0.5
transmission_coeff = 5e-9
latency_time = 1.
infectious_time = 5.

end_time = 60.0
num_steps = int(end_time / h)
times = h * numpy.array(range(num_steps + 1))

def seir_model():

	s = numpy.zeros(num_steps + 1)
	e = numpy.zeros(num_steps + 1)
	i = numpy.zeros(num_steps + 1)
	r = numpy.zeros(num_steps + 1)

	s[0] = 1e8 - 1e6 - 1e5
	e[0] = 0.
	i[0] = 1e5
	r[0] = 1e6

	for step in range(num_steps):

	return s, e, i, r

s, e, i, r = seir_model()

@show_plot
def plot_me():
    s_plot = matplotlib.pyplot.plot(times, s, label = 'S')
    e_plot = matplotlib.pyplot.plot(times, e, label = 'E')
    i_plot = matplotlib.pyplot.plot(times, i, label = 'I')
    r_plot = matplotlib.pyplot.plot(times, r, label = 'R')
    matplotlib.pyplot.legend(('S', 'E', 'I', 'R'), loc = 'upper right')
    
    axes = matplotlib.pyplot.gca()
    axes.set_xlabel('Time in days')
    axes.set_ylabel('Number of persons')
    matplotlib.pyplot.xlim(xmin = 0.)
    matplotlib.pyplot.ylim(ymin = 0.)

x(t)=-k*(t), k=const>0
x(h)=x(0)+h(-k*(h))