The SIS model from epidemiology as an example of a model exhibiting a tipping point. This model allows us to calculate the percentage of a population that needs to be vaccinated in order to get population level herd immunity.

There's a nice animation here.

The discussion here is heavily based on the discussion of tipping points in Scott Page's very nice *coursera* course on Model Thinking. I essentially transcribed his algebra in SymPy.

The first model we develop is a simple diffusion model. It has no tipping, but shows that the spread of infectious diseases is an accelating process, that becomes quicker as more people are infected.

First some general definitions of symtobls.

In [31]:

```
import sympy as sm
sm.init_printing()
from sympy.abc import N, c, t, tau
Wt = sm.symbols('Wt')
Wtt, Penc = sm.symbols('Wtt,Penc',cls=sm.Function)
```

In [152]:

```
Penc = (Wt/N)*((N - Wt)/N)
```

In [153]:

```
Wtt=N*c*Penc*tau + Wt
```

In [154]:

```
Wtt
```

Out[154]:

In [41]:

```
Penc
```

Out[41]:

First, let's see what happens when $W_t$ is small and $N$ is large.

In [155]:

```
Penc.subs([(Wt,1)])
```

Out[155]:

In [156]:

```
Penc.subs([(Wt,1)]).subs([(N-1,N)])
```

Out[156]:

Or you can do it in one step

In [38]:

```
Penc.subs([(Wt,1),(N-1,N)])
```

Out[38]:

In [157]:

```
Penc.subs([(Wt,N)])
```

Out[157]:

*healthy* is very low, hence the probability of an encouter between a sick person and a health person is low. To complete the picture, let's check what happens when $W_t=N/2$

In [158]:

```
Penc.subs([(Wt,N/2)])
```

Out[158]:

Ha!

In [159]:

```
Wupdate=Wtt.subs([(N,100),(tau,0.5),(c,0.5)])
```

In [160]:

```
ws=[1]
for t in range(0,49):
ws.append(Wupdate.subs([(Wt,ws[-1:][0])]))
```

In [161]:

```
%pylab inline
```

In [162]:

```
pylab.plot(range(0,50),ws)
pylab.ylabel('Number of infected individuals')
pylab.xlabel('time')
pylab.title('Diffusion of infection')
```

Out[162]:

In [163]:

```
a = sm.symbols('a',negative=False, real=True)
Wtt_sis = sm.symbols('Wtt_sis',cls=sm.Function)
Wtt_sis = Wtt - a*Wt
```

In [167]:

```
Wtt_sis
```

Out[167]:

We are just interested in the change, so let's simplify things a bit:

In [168]:

```
change=sm.collect(Wtt_sis -Wt,Wt)
change
```

Out[168]:

Now assume $Wt<

In [169]:

```
change.subs([(N-Wt,N)])
```

Out[169]:

**Basic reproduction number**. If it is bigger than 1, the disease spreads. This (as opposed to that we saw in the diffusion model) is a true *tipping point*. $R_0$ values for several well-known diseases (via Wikipedia): Measles - 12-18; Mumps - 4-7; HIV - 2-5; Flu - 2-3; Ebola - 1.5-2.5. Ouch!

In [170]:

```
v,R = sm.symbols('v,R',negative=False, real=True)
R*(1-v)<1
```

Out[170]:

Thus

In [171]:

```
1-v<1/R
```

Out[171]:

In [172]:

```
v>1-1/R
```

Out[172]:

In [175]:

```
1-(1.0/18)
```

Out[175]: