← Learning map

MATHEMATICAL MODELING WORKSHOP / 03

Mechanisms become trajectories

How do contact assumptions and intervention timing reshape a curve?

About 150 minutesSynthetic teaching experimentv1.0.0Reading local draft…
Learning objectives & prerequisites

Coupled ODEs, arrays and the mixing-tank workflow.

  • Derive a closed-population SIR model from contact events.
  • Interpret a threshold conditional on the susceptible fraction.
  • Verify population conservation across a discontinuous intervention.

01 / 08 · 10 MIN

Observe

Start with a synthetic closed population of 1000: 990 susceptible, 10 infectious and none recovered. Contacts are summarized by a rate rather than an observed social network. The lesson is about mathematical mechanisms, not disease forecasting or public-health recommendations.

YOUR TURN

Draw arrows between compartments and say which transitions are excluded.

02 / 08 · 10 MIN

Ask

Choose an outcome: peak infection, peak time or cumulative recovered population. The same intervention may rank differently on different outcomes. Fix your metric before comparing intervention dates.

YOUR TURN

State a testable question comparing day-10 and day-50 interventions.

03 / 08 · 15 MIN

Assume

Assume homogeneous mixing, permanent recovery, no demographic changes and constant rates within each intervention segment. Frequency-dependent incidence βSI/N has persons/day units. A density-dependent βSI model would give β different units and different scaling with population size.

YOUR TURN

Record the distinction between the two incidence conventions in the model card.

04 / 08 · 20 MIN

Formulate

Each new infection subtracts one from S and adds one to I. Each recovery transfers one from I to R, so the three derivatives sum to zero. Infection initially grows when βS/(γN)>1, not simply whenever β is positive.

S˙=βSI/N,I˙=βSI/NγI,R˙=γI,Reff=βSγN\dot S=-\beta SI/N,\quad \dot I=\beta SI/N-\gamma I,\quad \dot R=\gamma I,\qquad \mathcal R_{\mathrm{eff}}=\frac{\beta S}{\gamma N}
YOUR TURN

Derive all three rates and calculate the initial effective reproduction ratio.

05 / 08 · 15 MIN

Design

A sudden intervention changes β at a known time. Split integration at that time so an adaptive step cannot smooth over the discontinuity. Euler is first order; RK4 is fourth order for a sufficiently smooth segment. Conservation alone cannot establish accuracy.

YOUR TURN

Explain why a numerically inaccurate trajectory can still conserve S+I+R.

06 / 08 · 25 MIN

Experiment

Complete the three rates in student_model. Compare the reference compartments with your Euler infection trajectory. Keep the intervention rule fixed while halving h, then change intervention timing as a separate experiment.

YOUR TURN

Compare h=1 and h=0.5; then compare intervention dates 10 and 50 with reduction=0.5.

07 / 08 · 25 MIN

Challenge

Set β=0. Susceptible population must remain fixed and infection must decay as I0 exp(−γt). A very large Euler step can produce negative compartments while preserving the total. Those negatives are a discretization failure, not meaningful population predictions.

YOUR TURN

Create a nonnegative-check failure using a large step and fast recovery. Explain the mechanism.

08 / 08 · 15 MIN

Communicate

Report the exact incidence convention, intervention schedule, metric and numerical checks. State that changing contact heterogeneity, importations or recovery assumptions would change the model, even if the solver stayed identical.

YOUR TURN

Write a bounded conclusion and propose one network or age-structured extension with a validation target.

Need a little guidance?

1. Concept hint

Every flow appears once with a minus sign and once with a plus sign.

2. Mathematical / algorithm hint

incidence=beta*S*I/1000 and recovery=gamma*I. Return three derivatives in S,I,R order.

3. Reference implementation guide

Read the reference and check the derivative sum before plotting.

Compare the reasoning before applying it. Your current code is backed up before replacement.

Experiment protocol: comparison, failure & extension

Required comparison

Vary intervention timing after first establishing step-size convergence.

Failure experiment

Large h and fast recovery can break nonnegativity even when total population is conserved.

Research extension

Compare homogeneous mixing with two age groups under a specified contact matrix.

PYTHON WORKBENCH

Predict. Then run.

Parameters & random seed

Edit directly above or open the syntax-highlighting editor. The starter's unfinished student_model should fail relevant checks; use your derivation to complete it.

The runtime downloads only when started. Each experiment uses a fresh namespace and a 30-second limit.

Unable to load? Download the standalone notebook and run it in Python with NumPy, SciPy and Matplotlib. Reference notebook

Connect this lesson to your bookshelf.

Lecture & writing Notes

Book chapters (PDF and print pages separated)

  • Segel & Edelstein-Keshet — A Primer on Mathematical Models in Biology
    6: Developing an infection model
    PDF 122–123 · Print 103–104
  • Mickens — Mathematical Modelling with Differential Equations
    8: SIR models
    PDF 176–177 · Print 161–162
Full source map

Confirm draft change

Baseline and my run

The baseline uses the specified synthetic data; the right column shows only your last completed run.