Difference between revisions of "Epidemiology: The SIR model"

From JSXGraph Wiki
Jump to navigationJump to search
Line 45: Line 45:
 
I.hideTurtle();
 
I.hideTurtle();
 
R.hideTurtle();
 
R.hideTurtle();
 +
 +
function clearturtle() {
 +
  S.cs();
 +
  I.cs();
 +
  R.cs();
 +
  S.hideTurtle();
 +
  I.hideTurtle();
 +
  R.hideTurtle();
 +
}
 +
           
 +
function run() {
 +
  S.setPos(0,1.0-s.Value());
 +
  R.setPos(0,0);
 +
  I.setPos(0,s.X());
 +
               
 +
  delta = 0.1; // global
 +
  t = 0.0;  // global
 +
  loop();
 +
}
 +
           
 +
function turtleMove(turtle,dx,dy) {
 +
  turtle.lookTo([1.0+turtle.pos[0],dy+turtle.pos[1]]);
 +
  turtle.fd(dx*Math.sqrt(1+dy*dy));
 +
}
 +
           
 +
function loop() {
 +
}
 
              
 
              
 
</script>
 
</script>
 
</html>
 
</html>

Revision as of 18:41, 21 January 2009

Simulation of differential equations with turtle graphics using JSXGraph.

SIR model without vital dynamics

A single epidemic outbreak is usually far more rapid than the vital dynamics of a population, thus, if the aim is to study the immediate consequences of a single epidemic, one may neglect the birth-death processes. In this case the SIR system described above can be expressed by the following set of differential equations:

[math] \frac{dS}{dt} = - \beta I S [/math]
[math] \frac{dR}{dt} = \gamma I [/math]
[math] \frac{dI}{dt} = -(dS+dR) [/math]

The lines in the JSXGraph-simulation below have the following meaning:

* Blue: Rate of susceptible population
* Red: Rate of infected population
* Green: Rate of recovered population (which means: immune, isolated or dead)