Infectious diseases ripple through communities as chains of transmission. Some individuals are susceptible, lacking immunity to the pathogen. Once exposed, a portion become infected and capable of passing the disease on. After a period of illness these individuals either recover with immunity or succumb, removing them from the pool of infectious agents. The SIR model captures this flow with remarkable economy, dividing a population into three compartments: S for susceptible, I for infectious, and R for recovered. Despite its simplicity, the model reproduces the familiar curve of rising and falling case numbers observed in countless outbreaks, from influenza to measles. By adjusting just two parameters—the infection rate β and recovery rate γ—one can explore how quickly an illness spreads, how high the peak infection fraction climbs, and how long an epidemic lasts.
The mathematics of the SIR framework first appeared in the work of Kermack and McKendrick in the early 1920s, decades before computers made numerical simulation routine. Their differential equations balance the rate at which susceptible individuals become infected against the rate at which infections resolve. In a closed population with size N and no births or deaths other than those caused by the disease, the governing equations are:
The first equation states that susceptibles decline as they encounter infectious individuals. The second reveals that the infected class grows when new infections occur and shrinks as people recover. The third tracks those recoveries. If the infection rate outweighs the recovery rate, infections accelerate; otherwise they die out. A central metric is the basic reproduction number R₀ = β/γ, representing the average number of secondary cases spawned by a single infection in an otherwise susceptible population. If R₀ exceeds one, an outbreak expands exponentially until the susceptible pool is depleted. If it is below one, the disease fails to propagate widely.
Analytically solving the SIR equations requires calculus and often leads to implicit expressions. For practical exploration this calculator employs a discrete forward Euler method. Starting from initial values S₀, I₀, and R₀, each time step advances the system by Δt days:
Iterating these updates provides an approximate trajectory of the outbreak. Smaller time steps yield greater accuracy at the cost of more computation. In the browser, the calculations happen instantly even for several hundred steps, allowing you to tweak β, γ, or the starting conditions and immediately see how the outbreak evolves. The output reports the final susceptible, infected, and recovered counts after the specified number of steps, giving a snapshot of the epidemic’s ultimate toll.
Suppose a town of 1,000 people experiences an outbreak with β = 0.3 day⁻¹ and γ = 0.1 day⁻¹, yielding R₀ = 3. With just one initial infection, the disease spreads rapidly. The calculator shows infections peaking around day 30 with more than half the population simultaneously ill. By day 160, almost everyone has either recovered or, in a more severe disease, died. If measures like vaccination or social distancing cut β in half, R₀ drops to 1.5 and the peak shrinks dramatically, illustrating why public health efforts focus on reducing contact rates. If β falls below 0.1, R₀ dips under one and the outbreak fizzles after only a handful of cases.
The SIR model makes many simplifying assumptions. It treats individuals as identical and mixes them homogeneously, ignoring age structure, spatial clustering, and behavioral changes. It assumes permanent immunity after recovery and a fixed population size, conditions that fail for diseases with reinfection, births, or deaths. Nonetheless, the model provides valuable intuition. Its epidemic threshold R₀ > 1 underlies vaccination strategies: immunizing a fraction 1 − 1/R₀ of the population achieves herd immunity. The model also guides estimates of hospital demand by predicting when infections peak.
Because β and γ can be difficult to estimate directly, epidemiologists often work with R₀ values gleaned from early outbreak data. The table below lists approximate reproduction numbers for a few well-known diseases to provide context for your simulations.
Disease | Estimated R₀ |
---|---|
Seasonal influenza | 1.3 |
SARS-CoV-2 (original strain) | 2–3 |
Measles | 12–18 |
Ebola | 1.5–2.5 |
Chickenpox | 8–10 |
The SIR framework is a gateway to more sophisticated epidemiological models. Adding an exposed compartment yields the SEIR model, capturing incubation periods. Allowing births and natural deaths produces endemic equilibrium. Incorporating stochastic effects reveals the chance of fade-out even when R₀ exceeds one. Network-based models track individual contacts, while agent-based simulations capture heterogeneity in behavior or environment. Each refinement builds on the core insight that disease dynamics arise from the interplay between infection and recovery rates. The calculator presented here focuses on the original deterministic system so that the fundamental relationships remain clear.
As you experiment, note how the peak infection fraction and epidemic duration respond to parameter changes. Reducing the time step exposes finer structure in the curves, while extending the number of steps reveals the long tail of lingering infections. You might also explore the impact of initial conditions: starting with 10 infected instead of 1 advances the peak and slightly increases its height because the disease gains an early foothold. Such explorations mirror the sensitivity analyses performed by epidemiologists when advising policy makers.
Numerical experiments like those enabled by this tool foster intuition about public health interventions. For instance, increasing γ by improving medical treatment shortens infectious periods, lowering R₀ and flattening the curve. Reducing β through mask mandates or isolation has a similar effect. Combining both strategies can prevent healthcare systems from being overwhelmed. These insights, distilled into a few equations, underpin real-world decisions that save lives.
Ultimately, the SIR model reminds us that disease spread is not inevitable. Parameters under human control can push the reproduction number below unity, halting transmission. By understanding how infections progress and how interventions modify the parameters, societies can respond swiftly to emerging threats. This calculator, running entirely in your browser, invites you to experiment with those levers and gain a deeper appreciation for the mathematics that shapes epidemic outcomes.
Convert engine torque and RPM to horsepower or kilowatts. Learn how torque relates to power output and why both values matter for vehicles and machinery.
Compute the volume and surface area of a cylinder instantly by entering its radius and height. Perfect for estimating storage tanks, pipes, or any cylindrical object.
Convert earthquake magnitude to energy release and TNT equivalent. Learn how seismic energy scales with magnitude and why these numbers matter for hazard assessment.