PhysSandbox
Classical MechanicsWaves & SoundElectricity & MagnetismOptics & LightGravity & OrbitsLabs
🌙Astronomy & The Sky🌡️Thermodynamics🌍Biophysics, Fluids & Geoscience📐Math Visualization🔧Engineering🧪Chemistry

More from Math Visualization

Other simulators in this category — or see all 66.

View category →
NewUniversity / research

Three-Species Food Chain (Hastings–Powell)

Plants x → herbivores y → predators z; Holling II fᵢ(u)=aᵢu/(1+bᵢu); logistic x; chaotic attractors when b₁ is varied (1991).

Launch Simulator
NewSchool

Tumor Growth (Gompertz / Logistic)

V(t) → plateau K: Gompertz rV ln(K/V) or logistic rV(1−V/K); chemotherapy as linear kill −kV; RK4 vs untreated reference.

Launch Simulator
NewUniversity / research

Keller–Segel Chemotaxis

∂ₜn = Dₙ∇²n − χ∇·(n∇c), ∂ₜc = D_c∇²c + αn − βc; bacteria follow attractant; collapse at high χ; 96² grid.

Launch Simulator
NewUniversity / research

MinD / MinE Oscillation (E. coli Rod)

1D reaction–diffusion: membrane MinD u, fast MinE v; pole-to-pole oscillation; division plane at time-averaged MinD minimum.

Launch Simulator
NewSchool

Sandpile (SOC)

BTW abelian model: add grains, ≥4 topples to neighbors; critical avalanches.

Launch Simulator
NewUniversity / research

Flow Field Particles

Synthetic v(x,y,t); advection with wrap; optional arrow grid.

Launch Simulator
PhysSandbox

Interactive physics, chemistry, and engineering simulators for students, teachers, and curious minds.

Physics

  • Classical Mechanics
  • Waves & Sound
  • Electricity & Magnetism

Science

  • Optics & Light
  • Gravity & Orbits
  • Astronomy & The Sky

More

  • Thermodynamics
  • Biophysics, Fluids & Geoscience
  • Math Visualization
  • Engineering
  • Chemistry

© 2026 PhysSandbox. Free interactive science simulators.

PrivacyTermsContact
Home/Math Visualization/SEIR / SEIRS Epidemic Model

SEIR / SEIRS Epidemic Model

The SEIR model extends the classic SIR compartmental picture by splitting infected individuals into an exposed (latent) compartment E—people who have been infected but are not yet infectious—and an infectious compartment I. Normalized fractions satisfy S + E + I + R = 1 with mass-action transmission β S I, progression from latent to infectious at rate σ (mean latent time 1/σ), and recovery at rate γ (mean infectious time 1/γ). The SEIRS variant adds waning immunity: recovered individuals re-enter the susceptible pool at rate ω via the term ω R in S′ and the matching loss −ω R in R′, which can sustain endemic oscillations or repeated waves in this homogeneous deterministic setting. In this no-loss exposed stage, every exposed individual eventually becomes infectious, so the basic reproduction number is ℛ₀ = β/γ; σ changes the timing and shape of the outbreak rather than the invasion threshold. The simulator integrates the four ODEs with fixed-step fourth-order Runge–Kutta, clips negative compartments, renormalizes S + E + I + R after each step, plots all four fractions versus time with a peak marker on I(t), and shows a dashed herd-immunity reference line at y = 1 − 1/ℛ₀ only in pure SEIR mode (ω = 0) when ℛ₀ > 1. Sliders control β, σ, γ, optional ω, model mode (SEIR vs SEIRS), and initial fractions E(0), I(0), and R(0). As with SIR, births, deaths, seasonality, spatial and network structure, age stratification, and stochasticity are omitted—this is a teaching model for latent periods and immunity loss, not a disease-specific forecast.

Who it's for: Students of mathematical epidemiology, public health modeling, or ODE courses who already know SIR and want to see how a latent compartment and waning immunity change outbreak timing and long-term behavior.

Key terms

  • SEIR model
  • SEIRS model
  • Latent period
  • Exposed compartment
  • Waning immunity (ω)
  • Basic reproduction number (ℛ₀)
  • Runge–Kutta integration
  • Compartment ODE

Parameters (normalized N = 1)

0.55
0.35
0.2
0.01
0.004
0

Latent compartment E delays the epidemic peak vs SIR. In this no-loss exposed stage, ℛ₀ = β/γ; σ changes timing, not the threshold. SEIRS adds ωR → S so immunity can wane and waves may persist.

Shortcuts

  • •Space / Enter — play / pause
  • •R — reset time series

Measured values

S (now)0.986
E (now)0.010
I (now)0.004
R (now)0.000
ℛ₀ = β/γ2.750
Herd ≈ 1 − 1/ℛ₀0.636
Mean latent 1/σ2.9 d
Mean infectious 1/γ5.0 d

How it works

SEIR adds an exposed (latent) compartment before infectiousness; SEIRS allows recovered individuals to lose immunity at rate ω. Normalized fractions S + E + I + R = 1 with mass-action transmission βSI, progression σE, recovery γI, and optional waning ωR → S.

Key equations

S' = −βSI + ωR · E' = βSI − σE · I' = σE − γI · R' = γI − ωR

Frequently asked questions

Why is ℛ₀ still β/γ when there is a latent compartment?
For the equations shown here, E has only one exit: progression to I at rate σ. That means every new exposed individual eventually spends an average time 1/γ in the infectious compartment, so the expected number of secondary infections in a fully susceptible population is β/γ. A smaller σ delays infectiousness and shifts the peak later, but it does not remove infections from the pipeline.
How does the exposed compartment E change the epidemic curve?
Infectious incidence is still driven by β S I, but I is fed by σ E rather than directly by new infections. That delays the rise of I(t) and typically postpones and may slightly smooth the epidemic peak compared with SIR at the same ℛ₀, even when the eventual cumulative attack is similar.
What does turning on SEIRS (ω > 0) do?
Recovered individuals flow back to S at rate ω R, replenishing susceptibles. With ω > 0 the simple “one epidemic then herd protection forever” picture breaks down: the system can approach endemic equilibria or sustained oscillations depending on β, σ, γ, and ω. The herd line at 1 − 1/ℛ₀ is hidden in SEIRS mode because that threshold formula assumes permanent immunity.
Why renormalize S + E + I + R after each RK4 step?
Numerical integration of nonlinear ODEs can introduce tiny drift so the four fractions no longer sum exactly to one. Renormalization keeps the state on the simplex (a valid population partition) without changing the qualitative dynamics noticeably at the fixed step size used here.