current position:Home>Python simulated Login, numpy module, python simulated epidemic spread

Python simulated Login, numpy module, python simulated epidemic spread

2022-01-30 00:48:37 Dai mubai

This article has participated in 「 Digging force Star Program


First of all, it must be stated that this is only a fictional example , Not a real event .

Before that zulko See some examples of dynamic visualization of data , It's fun , So there is today's article .

Part of the content is from maxberggren.

Let's start happily ~~~

Effect display :

The population density map of Nordic countries is used as an example , Stockholm was the first source of infection .

 Virus epidemic spread  (1).gif

For the specific implementation process, see the introduction of the home page to obtain the source code in the relevant files .

development tool

**Python edition :**3.6.4

Related modules :

numpy modular ;

matplotlib modular ;

PIL modular ;

As well as some Python Built in modules .

Environment building

install Python And add to environment variable ,pip Install the relevant modules required .

Introduction of the principle

Virus transmission model :

This paper adopts SIR Model , The core formula is :


Parameter interpretation :

among ,S Represents susceptible people ;I Represents the number of infected groups or zombies ;R Represents the amount of removal , That is, those who die or return to health .

β Indicates the infectious degree of the disease ;γ Indicates the rate of progression from infection to death .

S' Tell us the rate at which healthy people become zombies ;I' Tell us how infected people increase and the rate at which zombies enter the removal state ;R' Just add parameters γ Of I.

consider S/I/R After spatial distribution, it is modified as follows :


Eulafa :

Now we know u', So the prediction function u The calculation of can be approximated by Euler method , The following is derived :


copyright notice
author[Dai mubai],Please bring the original link to reprint, thank you.

Random recommended