Susceptible Infectious (SI model)

Overview


Linear Algebra Specification


The basic SI equation can be stated simply using linear algebra notation.
{% V = \begin{bmatrix} S_t \\ E_t \\ I_t \\ R_t \\ \end{bmatrix} %}
{% M_t = \begin{bmatrix} 1-\lambda_t & 0 & 0 & 0 \\ \lambda_t & 1-f & 0 & 0 \\ 0 & f & 1-r & 0 \\ 0 & 0 & r & 1 \end{bmatrix} %}
{% V_{t+1} = M_t V_t %}

Code



let la = await import('/lib/linear-algebra/v1.0.0/linear-algebra.mjs');

let lambda = 0.1;
let r = 0.1;
let f = 0.1
let periods = 10;

let M = [[1-lambda, 0,0,0],
		[lambda, 1-f ,0,0],
		[0,f,1-r,0],
		[0,0,r,1]
];

let V = [[1000],[10],[0],[0]];
for(let i=0;i<periods;i++){
  V = la.multiply(M, V);
}
					
Try it!

Contents