Simulating an epidemic

Experiments with toy SIR models
Home page:
Brought to you by you:

Awesome fan-made interactives:
Simulations by Harry Stevens at the Washington Post:
Simulations by Kevin Simler at Melting Asphalt:
Excellent visualization of each country's current growth from Minutephysics and Aatish Bhatia:
Another good interactive to see what effect various parameters have on the shape of the curve:
If you want to hear a mathematician/epidemiologist's summary of COVID-19, I found this MSRI talk very worthwhile:
Marcel Salathé on Contact Tracing:

These animations are largely made using manim, a scrappy open-source python library:
If you want to check it out, I feel compelled to warn you that it's not the most well-documented tool, and it has many other quirks you might expect in a library someone wrote with only their own use in mind.
The source code for this video is visible at the link below, but the, er, awkward part is that it was made on a branch of manim where I'm reworking a lot of other things and have yet to work out all the kinks or add any documentation, so I'm not entirely sure how easy it will be for others to get running. In either case, you should be able to easily see how all the simulations worked.

Honestly, given that the code for that video is meant for demo purposes, and not meant to reflect the true data of COVID-19, if you want to apply these ideas to the current situation I'd recommend looking for more professional epidemiological modeling tools that are less centered around animations and pedagogy and more focused on accurate predictions. For example, the Institute for Disease Modeling has a lot of models free for people to look at and play with.
Opening music:
Candlepower by Chris Zabriskie is licensed under a Creative Commons Attribution license (
Other music by Vincent Rubinetti.
Download the music on Bandcamp:

Stream the music on Spotify:

If you want to contribute translated subtitles or to help review those that have already been made by others and need approval, you can click the gear icon in the video and go to subtitles/cc, then "add subtitles/cc". I really appreciate those who do this, as it helps make the lessons accessible to more people.


3blue1brown is a channel about animating math, in all senses of the word animate. And you know the drill with DE-visions, if you want to stay posted on new videos, subscribe:

Various social media stuffs:

Video herunterladen


  • 18:01 Grant predicted SpaceX's launch 2 months ago.

    Yordan DarakchievYordan DarakchievVor Tag
  • Awesome video. Take away for me: Please please governments, pour money to put together effective contact tracing and mass testing. Even if it costs money, it still beats lockdowns both in terms of deaths and economic impact.

    srelmasrelmaVor Tag
  • Спасибо за труд.

    AzazelAzazelVor 2 Tage
  • Dry boy 11

    Василий ГавриленкоВасилий ГавриленкоVor 3 Tage
  • Why dis have 1K DIsLiKES

    Ariel Isaac Vega CaroAriel Isaac Vega CaroVor 3 Tage
  • Wonderful content, as usual. I'd like to see another round of simulations with controlled infection strategies - a "pre-flattening the curve", so to speak. I think the multi-city case is best for it. It would go like this, for instance: 1) A central city originates the infection just the same as in your simulations. 2) After a certain R rate in the originator city is achieved, adjacent cities select best-chance citizens for controlled infection. The process allows for the infection of these citizens to fold out without infecting other citizens. Note: the infection happens through samples of the virus that are brought before the virus reaches that city naturally. Perhaps consider a small chance of a bad outcome for the individual. 3) (Optional) Recovered citizens substitute not infected citizens in their travels back and forth between home locations and common locations (e.g., recovered citizens buying groceries for the not-yet-infected). What do you think? Others please feel free to add suggestions.

    Ricardo HalfeldRicardo HalfeldVor 3 Tage
  • what software or programming language used in the simulation? Thanks

    Dean WilmingtonLandlordDean WilmingtonLandlordVor 3 Tage
  • Pity you did not run the simultations on big populations like in NY city. I guess you didn't because the numbers are truely frightening.

    David BrisbaneDavid BrisbaneVor 3 Tage
  • Can I know what does "R" stand for? And what formula is used to calculate it?

    SF NgiengSF NgiengVor 3 Tage
  • WOW, i Love this one! early on, decided to share it (but first i'll watch it to the end) then to like, and thought that"s not enough, so also to subscribe (first time here on the channel, by "accident", not an easy "subscriber", even less to post a comment) then i realized, sharing (helps) makes it viral or even (hopefully) pandemic ! ;) Thanks for the hard work and the inspiration, it is now clearer how i want to use my programming skills just when i needed it! Thanks!

    Mehdy LeclaireMehdy LeclaireVor 4 Tage
  • again how you come up with R0???

    Alonso VAlonso VVor 4 Tage
  • I really love that you made this video. I wonder what you did to make that? And you deserve a sub. Thank You!

    Eugene B.Eugene B.Vor 5 Tage
  • A Virus can only spread via injection! Its not a living thing FFS.

    MufflermanMufflermanVor 5 Tage
  • which animation software using for making this videos...its nice and cool

    B Santhosh dhanaB Santhosh dhanaVor 5 Tage
  • What font does he use?

  • which software or packages are you using for the simulation? I would like to try it by myself. Is it R?

    002 ttdkx002 ttdkxVor 6 Tage
  • What you should take in consideration is also the stupidity of people, that don't believe in the virus or vaccine efficiency. Those individuals elongate the curve tail for sure.

  • Should have said first that the model and and graphics are absolutely brilliant!

    David BrownDavid BrownVor 7 Tage
  • The way that the reproduction number, 'R', is calculated seem reasonable, but I don't understand why the value sometimes starts low and rises before falling again. I would have expected the value to start at 'R0' then fall. Also, R should drop below 1 when the herd immunity condition is reached, which is when the remaining number of susceptible people as a proportion of the population becomes less than 1/R0.

    David BrownDavid BrownVor 7 Tage
  • This is really a superlative example of how mathematical modelling should be used. Clearly, from a logical standpoint, in the absence of real-world statistics - and good quality statistics at that - no model can be made to serve as a predictor of the future. But what CAN be done is what has been done here - by making various assumptions of what is happening we can develop valuable insights in to what is important and what is not when formulating rules for public behaviour. This particular work rightly focuses on what common sense would indicate are important factors of social behaviour and protocols for handling the sick. What would also be interesting is some computer simulation of the physical process of virus transmission by aerosol. This is mainly a physics problem. Results could be used to refine our ideas of what constitutes effective social distancing for instance, or whether it is safer to be in hot humid air or cold and dry .....

    Harold L POTTSHarold L POTTSVor 7 Tage
  • Indeed now, two months after this video, we are clearly seeing those long tails forming in some countries. Many of them are getting tired of the social distancing and lockdowns and they are starting "controlled reopening". Hope we don't get to that second wave :/

    Ylli ImeriYlli ImeriVor 7 Tage
  • Hello from southeastern Brazil (the new epicenter of the pandemic) for everyone in 3Blue1Brown. Congratulations on the video. It’s a really great job. However, thinking of the video as a tool to be used in classrooms (including those in which English is the native language), I leave here a suggestion. How about producing a version 2.0, with the audio a little slower? (Say, instead of the current 23 minutes, something between 28 and 30 minutes.)

    M EitererM EitererVor 7 Tage
  • LOLitotallyforgotihadapatreon shout out to that person lol

    It’s TYPE!!It’s TYPE!!Vor 7 Tage
  • Nice presidentation

    Timothy WongTimothy WongVor 7 Tage
  • all this takeway is making me hungry

    CrimsonDoesColouringCrimsonDoesColouringVor 7 Tage
  • i get this may not be possible but there should totally be a downloadable version of this for playing around with.

    CrimsonDoesColouringCrimsonDoesColouringVor 7 Tage
  • No doubt a great lecture, but I cannot hear the presenter's voice over the stupid music.

    Barry PoulsonBarry PoulsonVor 7 Tage
  • I notice that in every simulation, the vast majority of dots end up in the removed category, which is very different from what seems to be happening. Am I reading the graph correctly? That seems very different from what is happening.

    Corona PodcastCorona PodcastVor 8 Tage
  • 22:16 - Well, some places. In others you might just get nonsense that undoes that good work spreading just as fast...

    DamienDamienVor 8 Tage
  • Pandemic *

    Abhey aroraAbhey aroraVor 9 Tage
  • Great vid although one minor correction... by definition Infectious means how quickly the disease makes person fall sick, Contagious means spread. Going by that your use of term Infectious should be actually Contagious. Now if you were using that term w.r.t. death or severity of symptoms or hospitals occupancy etc. then Infectious would have been an apt word to use.

    Vinit SankheVinit SankheVor 9 Tage
  • Great Tuto ,the info on this video are so Precious, thanks for sharing 👍

    nounou Citynounou CityVor 9 Tage
  • Hi, I'm a data point. Nice to meet you!

    American CitizenAmerican CitizenVor 9 Tage
  • I can easily stop the pandemic by going in and tweaking the software.

    American CitizenAmerican CitizenVor 9 Tage
  • See the latest issue of SIAM News for various models. SIAM=Society for Industrial and Applied Mathematics.

    TranspowerTranspowerVor 9 Tage

    TheGaming100TheGaming100Vor 9 Tage
  • Two things: the model should include 'houses' or chance of not being on the grid at a given time - plus sufficient space for all nodes to space, plus the 'cheaters' in social distance would be affecting those who did not cheat - whereas thse people would be isolated from the cheaters, there can be lower chance based on state 'shopping' etc, or set-up volumes with certain contamination characteristics - maybe even leave contamination in the environment (emitted by the dots) as dots are not causing contamination at all points, also not everyone goes to the same space. Also the thing at 22:00 is one of the good guys and infects bacteria! @3Blue1Brown

    Glorious AssamGlorious AssamVor 9 Tage
  • Great video. You asked questions even most journalists wouldn't ask. One of my favorite sayings is "numbers don't lie, people and politicians do." This is why I love numbers-based simulations. Sure, people program those simulations, but when randomized such as this, does it really matter? Also, I wonder what it would look like if you added a few central locations vs a single one. This to simulate opening/closing certain places and not others. More reflective of current reality. I wonder what that model would look like. It might answer the question, "what if we did this differently," or "who could we have done this differently" as applied with "non-essential" vs "essential" business closures. Closing places down causes those who would go out anyway to congregate in a single location. I would think this would nullify any effect it was designed to nullify. Especially when packed into 1 place vs spread out in say 4. (lack of social distancing.)

    George BrandonGeorge BrandonVor 10 Tage
  • this is great info right here, i love to know more about statistics and graphs, especially on important things. Your videos are great, i'm glad i have subscribed to you

    Andrei IuscoAndrei IuscoVor 10 Tage
  • These models are based on the rather absurd assumption that everyone moves around randomly. In reality there are people with lots of interactions and others with few interactions. So I would expect that the spread is fast as long as the guys with many interactions are not immune. But ones those guys are immune, things should slow down substantially.

    sait Rensait RenVor 10 Tage
    • Application of these kind of models for most recent studies lead to quite astonishing results how accurate the models fitted the reality. Check the models shown in this video with no addl. measures - the effect of reducing numbers of infected caused by increased number of removed (or immune as you say) kicks in after at least 20..30 % removed in a population. In current pandemic, we are far away from this percentage. And - imho - even this is difficult to accept - the behaviour of us humans seen by the eye of a virus is not highly individual as we assume ourselves behaving individually. Does not matter if a manager travels for business talks or a truck driver to deliver groceries. And for smaller communities, the interactions can be as small as even possible and still effective for transmission of a virus (be it aircraft carriers, home for underpaid meat factory workers, home for elderly or refugee camps).

      Felix LohrerFelix LohrerVor 7 Tage
  • Awesome video! I’d like to comment on the central hubs and the asymptomatic people. - Central hubs: I see that there are fundamentally different types of hubs (let me call it social gathering hot spots): markets (with limited intimate contact between participants); sport events (stadiums, where after a game supporters will hug each other and go out to drink some biers in large groups); and pubs, bars,discotheques (where people get physically very close to a large number of other people). I’d believe that the R on every of these types of hot spots is very different, so to determine what kind of event should be allowed at a given phase of a lockdown phase, it would be interesting to simulate them separately. - Rate of infection: I wonder if asymptomatic people (some of the yellow dots in your simulation), are as infectious as those that have symptoms (and sneeze and caught). Not sure how much this would change the simulations though... Finally, I have the feeling that mobility is very hard to model accurately. When I look at the concrete cases around me, I see that people do not move socially randomly like mostly made in simulations I’ve seen. Rather, we tend have a large number of contacts inside our immediate family, then a bit less with the colleagues in same the office, finally much less frequently with our friends/sport pals, finally with the rest of the community (in supermarkets, restaurants, bars, etc). In the of the simulations, it’s as if you create another layer of boxes within each community box. Inside those smaller boxes it is very difficult to enforce social distancing, but between them it’s easier to do it (eg close all restaurants and stop sport events, etc). I would expect that one could relax the social distancing rules inside a “micro box” (eg family, close friends, maybe office colleagues) while enforcing strict rules for other interactions (eg in those social hot spots that I mentioned before) and still get similar results that one obtain by asking every single person to observe strict social distancing to absolutely everyone (outside own’s household). (Off course, risk persons need strict social distancing from everyone, in my opinion). The purpose of all this talk... is that it’s easier for a society to follow some sort of tolerant social rules for a long time rather than very stringent (and certainly very effective) rules. If the rules are very stringent, humans can only follow them for weeks, not months, and start being careless after some time. I live in Switzerland and I can observe that after several weeks of carefully the following social distance rules, recently almost everyone started not to follow them at all... In any case, huge appraisal for your work !

    Jose Alex GracioJose Alex GracioVor 10 Tage
  • Nice work! Love the range of simulations. Now do one where infected people are wheeled back into eldercare facilities as in NY.

    Chad HowarthChad HowarthVor 10 Tage
  • ("Busy elk 43")

    Wolf GameWolf GameVor 10 Tage
  • amazing!!!!!!! Excelente work man

    user123user123Vor 10 Tage
  • Wow, this is the kind of message that in my opinion works so much better than just to constantly tell people to stay at home. You truly show the effect of it. I think honestly if the whole world would put itself on hold for a month, in stead of slightly on hold for the time we are going to be in it now, we would have the virus eradicated so much more quickly than to wait for a vaccine. Though laws don't allow us to lock up the whole world (perhaps fortunately, but perhaps not)

    BoBuBoBuVor 10 Tage
  • What if you include both death rate and recovery. Add a maximum of healthcare so at a certain level of infection the death rate is higher. For that is now the case.

    Peter ScheenPeter ScheenVor 10 Tage
  • 22:20 the only lesson i learnt from history is that humans do not learn from history

    boris bryantboris bryantVor 11 Tage
  • is there an actual program, not an animation that reflects this?

    Charles TurkCharles TurkVor 11 Tage
  • a better video than that idiot "primer" people who have recovered are still a factor, they can doctor, they can get stuff for sick people

    Grand Flex Johnson: John Jhon Jon Jonathan IVGrand Flex Johnson: John Jhon Jon Jonathan IVVor 11 Tage
    • Woah, primer is a good friend of 3blue1brown. They both used to work at khan academy together

      Ajay RamachandranAjay RamachandranVor 9 Tage
  • Dirty mechanic 52

    Shtorm LiveShtorm LiveVor 11 Tage
  • I am more amazed to how you put up all this into scintillating presentation rather than the content itself. We already got tons of scientific journals and publications but good visualizers are what the world lacks now.

    Arwah SapiArwah SapiVor 11 Tage
  • And this is how they predicted the 2 200 000 death for Cvid... Modeling is cool and all, but it does not reflect reality. Map is not the terrain. It's because of these bullshit sim that we got locked up. Never forget that.

    Maxime ParataMaxime ParataVor 11 Tage
  • Pero les dicen no salgan de sus homes

    Ana HebradAna HebradVor 11 Tage
  • I'm triggered rn. Pandemic and Epidemic are NOT the same thing. Epidemic is in one country, whereas a Pandemic is in multiple countries or the whole world.

    Benedict FishyBenedict FishyVor 12 Tage
  • succesfully recovered from life

    gr4ozygr4ozyVor 12 Tage
  • And a month in a half later we realize that the problem was that coronavirus is so benign that possibly more than half of those infected showed almost no symptoms...i.e. the lockdown measures were pointless. A disease with this many people not knowing they are infected is impossible to contain.

    Tim CTim CVor 12 Tage
  • Really Superb

    ScotimagesScotimagesVor 13 Tage
  • I'm really glad you made this and brought up the central location problem, had that same hunch. It's this kind if introspection i doubt the local officials are doing. Is my local pool shared by 30 people really more dangerous than a grocery store visited by hundreds each day?

    JonathanJonathanVor 13 Tage
  • 5:27 New York City Subway during Rush Hour. Also JFK Airport connects to the A train at howard beach and Jamaica station ( LIRR and NYC Subway again )

    Joe HarneyJoe HarneyVor 13 Tage
  • you should have separated the "removed" from the "recovered", as recovered can still spread the virus to uninfected edit: also, the walls idea is kind of silly. you could have looped the walls around so that a person running into one wall comes out the opposite one.

    Duro DurDuro DurVor 13 Tage
  • Can you run some simulations showing what would happen if recovery only conferred immunity for a limited time?

    Jonathan HaasJonathan HaasVor 13 Tage
  • Que pasa si en el modelo de los centros comerciales, reduces el radio de infección pues la gente que va a lugares públicos tiende a cuidarse más ahí, pero en la casa no toman las mismas medidas.

    Paolo Andrés Sommerz RamírezPaolo Andrés Sommerz RamírezVor 13 Tage
  • "I'm not gas in a box" smells like one of those epidemic protesters.

    hdckighfkvhvgmkhdckighfkvhvgmkVor 13 Tage
  • Excellent graphics.

    Valerie AngellValerie AngellVor 13 Tage
  • An interesting thing that's come up is that infectiousness seems to be related to the age of the recipient, so the Carrier's R is modified by the potential Infectee. And that has impacts on central hubs - if it's a school full of low-R potentials the effective R of the Carriers travelling to that hub is going to be lower than if it's a market full of high-R potentials.

    Jonathan HarstonJonathan HarstonVor 13 Tage
  • What an incredible job!! Could you also simulate that 50% of infected cases are asymptomatic but can still spread the virus?

    Alexandre SteinhauslinAlexandre SteinhauslinVor 13 Tage
  • This is a very good model and much appreciated given the current times, but what if 1: half of the invected community never develops immunity to COVID 19. Secondly, do we really learn from history? My apologizes as this was really a great lesson and well thought out.

    Vince AdameVince AdameVor 14 Tage
  • .. cv19 was a model virus in the good old game call pandemic .. and Madagascar is almost covid free

    Bc CBc CVor 14 Tage
  • What's the font in these videos?

    Ethan PochnaEthan PochnaVor 14 Tage
  • It looks like you are assuming that, if a person recovers, they become immune. What if they have the same likelihood of being infected again?

    David CutlerDavid CutlerVor 14 Tage
    • ​@David Cutler Um... A vaccine is literally exposing someone to a dead or weakened virus, and letting the body create antibodies to it... I said nothing about not doing research into the disease. But even if there is 0% immunity received after having the illness. Can we justify stopping all of society? Are we just supposed to resign ourselves to living in little boxes because people will continue to get sick?

      Brack CarmonyBrack CarmonyVor 10 Tage
    • @Brack Carmony No. Building antibodies to stop infection a second time is a different mechanism from recovering. And the development of a vaccine is a different process from the body creating antigens naturally. Also, I think it's a bad course of action to 'give up'.

      David CutlerDavid CutlerVor 11 Tage
    • Then you have to ask how they were able to recover in the first place? And you also have to give up any reasonable hope of a vaccine.

      Brack CarmonyBrack CarmonyVor 11 Tage
    • ARN Virus. Probability is so low that is not considered.

      René Orlando García TorresRené Orlando García TorresVor 12 Tage
Simulating an epidemic