Project 11: The Epidemic Simulator (Exponential Growth)

Build a simulator that models exponential growth and simple infection spread.


Project Overview

Attribute Value
Difficulty Level 1: Beginner
Time Estimate Weekend
Main Language Python
Alternative Languages JavaScript, C++
Knowledge Area Exponential growth
Tools Plotting tool
Main Book “Calculus” by James Stewart

What you’ll build: A simulator that models population growth and a basic SIR-style infection curve.

Why it teaches math: Exponential growth explains compounding, epidemics, and why small changes have huge effects.

Core challenges you’ll face:

  • Implementing exponential growth formulas
  • Tracking populations over time
  • Visualizing curves clearly

Real World Outcome

You will run simulations and see how different growth rates change outcomes. The curves should show rapid growth and possible saturation.

Example Output:

$ python epidemic.py --r0 1.5 --days 60
Peak infected: day 31
Peak infected count: 428
Saved plot to epidemic.png

Verification steps:

  • Compare growth curves for different rates
  • Validate that higher rates peak sooner

The Core Question You’re Answering

“Why does exponential growth feel slow at first and then explode?”

This project turns abstract growth into visible consequences.


Concepts You Must Understand First

Stop and research these before coding:

  1. Exponential functions
    • How does repeated multiplication create growth?
    • Book Reference: “Calculus” by James Stewart, Ch. 1
  2. Basic SIR model
    • What are susceptible, infected, and recovered groups?
    • Book Reference: “Mathematical Models in Biology” by Leah Edelstein-Keshet, Ch. 2
  3. Doubling time
    • How do you calculate how fast something doubles?
    • Book Reference: “Calculus” by James Stewart, Ch. 1

Questions to Guide Your Design

  1. Model choice
    • Will you implement pure exponential growth first?
    • How will you add recovery or saturation?
  2. Visualization
    • Will you plot S, I, R curves on one chart?
    • How will you annotate peak infection?

Thinking Exercise

Doubling Time

If a population grows at 10 percent per day, how many days does it take to double?

Questions while working:

  • Why is doubling time a more intuitive measure than rate?
  • What happens if the rate is 2 percent instead?

The Interview Questions They’ll Ask

Prepare to answer these:

  1. “What is exponential growth?”
  2. “Why do epidemics accelerate quickly?”
  3. “What is the role of R0?”
  4. “How do you model recovery?”
  5. “Why does growth eventually slow in real systems?”

Hints in Layers

Hint 1: Starting Point Start with a simple exponential growth model.

Hint 2: Next Level Add a recovery term to model infection decline.

Hint 3: Technical Details Use discrete time steps and update populations each day.

Hint 4: Tools/Debugging Plot curves and check that totals remain consistent.


Books That Will Help

Topic Book Chapter
Exponential growth “Calculus” by James Stewart Ch. 1
SIR models “Mathematical Models in Biology” by Leah Edelstein-Keshet Ch. 2
Doubling time “Calculus” by James Stewart Ch. 1

Implementation Hints

  • Keep time step small enough to avoid instability.
  • Track totals to ensure conservation where applicable.
  • Label peaks and key points on plots.

Learning Milestones

  1. First milestone: You can simulate exponential growth accurately.
  2. Second milestone: You can visualize infection curves.
  3. Final milestone: You can explain growth, peaks, and saturation.