pharma · javascript · SIR model

Outbreak Curve Simulator

Three numbers — how fast something spreads, how long people stay contagious, and the day the spread slows down — decide the whole shape of an outbreak. Move the sliders and watch the curve rearrange itself.

teaching tool, not a forecast This is textbook arithmetic on a perfectly mixed crowd. Real outbreaks have ages, places, travel and luck. Use it to build intuition, never to predict anything.

curves—

numbers—

peak at once
—
—
affected in total
—
—
R0 at the start
—
—
R after slowdown
—
—

—

how it works
Everyone is in exactly one of three buckets, and people only ever move forward: not yet affected → sick right now → past it. That is the classic SIR model, three lines of calculus written in 1927:
dS/dt = −b · S · I / N dI/dt = +b · S · I / N − I / D dR/dt = +I / D
b is the spread rate (how many new cases one sick person starts per day when everyone around them is still healthy) and D is how many days a person stays contagious. Their product is the famous R0 = b · D — the number of people one case passes it to at the very beginning. Above 1 the curve grows, below 1 it fades.
The slowdown simply multiplies b from the chosen day onward. Nothing else changes — same crowd, same illness — which is exactly why the effect is so easy to read.
Solved with fourth-order Runge–Kutta at a tenth-of-a-day step over 360 days, recomputed from scratch on every slider move. No libraries, no network, about a hundred lines of arithmetic.
What to notice. The S·I/N term is why the curve eventually falls even with no slowdown at all: the disease runs out of people to reach. And it is why a late slowdown does almost nothing — by then the crowd has already done the flattening for you.

controlsdrag anything

the illness
—
new cases one sick person starts per day
—
how long someone can pass it on
the crowd
—
everyone is mixed together, evenly
—
where the whole thing starts
the slowdown
—
people meet less, spread rate falls
—
—
view

Try acted too late — the same slowdown, three weeks later, and almost the whole benefit disappears.