/sir-model

Modelo SIR no contínuo e dinâmico/SIR model continuous and dynamical

Primary LanguageC

SIR Model

Intro

Last year (2020) I tried to learn about epidemiological models, starting with Susceptible Infectious Recovered (SIR) 1. I tried to solve the equations using the Euler Method, but it did not went well. The Euler Method don't keep the population constant, this can be seen in the "euler_populacao.png". So I used the GSL to solve de coupled equations, the graphs can be seen in the "rkf_B*.png".

Later I did an dynamical code, where the particles move in a matrix. If a susceptible became neighbour with an infected it turns to infected. After some time the infected become recovered. One can be check the simulation in the "dynamics.gif", where purple is Susceptible, orange is Infectious and green is Recovered. The curves of this dynamical simulation have some resemblance of the continous simulations.

In all my models the particles/persons cannot die.

All comments are in portuguese.

Update / Presentation

I did a presentation about SIR Model for Introduction to Dynamical Systems. The pdf and tex source can be found in this repo.

I also updated the codes, there are new plots and gifs.

Running

To compile my codes you need to have the GSL installed in your computer, you can found more info in this repo. Open a terminal and go to de directory where the codes are. Then type:

gcc code.c -lgsl -lgslcblas -lm

then run with

./a.out

the 03-sir_dynamics.c compiles in the same way, but you need to pipe it's output. Doing:

./a.out | gnuplot

You need to have gnuplot installed.