Overview
The SIR model models two variables:
- {% S(t) %} - the number of susceptible individuals
- {% I(t) %} - the number of infected individuals
where the dynamics are specified by
{% S'(t) = -\beta S(t) I(t) %}
{% I'(t) = \beta S(t) I(t) - \alpha I(t) %}
Scripts
The script models the {% S %} and {% I %} as an array, [S,I]. The initial values are set as
let boundary = [763 - 25, 25];
The derivatives are specified by the derivative function
let derivative = function(values){
return [-1*beta*values[0]*values[1], beta * values[0]*values[1] - alpha*values[1]];
}
The evaluation of {% S %} and {% I %} over time is computed by using the euler function of the finite difference library.