Skip to content
Tutorials Center
My learning

Topics

Lesson 45 of 46 ยท Projects and Practice

Cheat sheet: chapters 5 to 8 on one page

A one-page recap of the key formulas and checks for ODE models, optimization, stochastic simulation and validation, with a poster and runnable calculators.

This page is the one you will come back to. It puts the key formulas and habits of the second half of the course on a poster and in a table, and gives you a handful of small calculators so you can check numbers quickly. Print it, or keep it open while you work on a model.

Four columns of key formulas for ODEs, optimization, stochastic models and validation, above the modelling cycle: question, assume, build, solve, check, report.
The whole second half of the course: formulas on top, the modelling cycle underneath.

What you will learn

  • Where to find each key formula in a second.
  • Which check to run before you trust an answer.
  • How to use small calculators for common questions.

Key terms

Cycle: question, assume, build, solve, check, report; repeat until the model is good enough.

Sanity check: a quick test on units, size and limiting cases.

Formula card: a short list of equations you can use without rederiving them.

Formulas

Topic Formula Notes
Exponential y = yโ‚€ยทe^(kยทt) half-life is ln 2 divided by the size of k
Newton cooling T = T_env + (Tโ‚€ โˆ’ T_env)ยทe^(โˆ’kยทt) gap decays exponentially
Logistic N(t) = K / (1 + ((K โˆ’ Nโ‚€)/Nโ‚€)ยทe^(โˆ’rยทt)) fastest growth at K/2
Harvesting H_max = rยทK/4; N* = K(1 โˆ’ E/r) constant versus proportional
SIR Rโ‚€ = ฮฒ/ฮณ; peak at S = 1/Rโ‚€ threshold 1 โˆ’ 1/Rโ‚€ immune
Lotka-Volterra equilibrium (c/d, a/b) closed cycles
Euler y + hยทf(t, y) error โˆ h
RK4 y + (h/6)(kโ‚ + 2kโ‚‚ + 2kโ‚ƒ + kโ‚„) error โˆ hโด
Calculus optimum fโ€ฒ(x) = 0, check fโ€ณ and ends can: h = 2r
LP optimum at a corner shadow price = value of a binding unit
Gradient descent ฮธ โ† ฮธ โˆ’ ฮทยทโˆ‡f stable if ฮท < 2/ฮป_max
Monte Carlo error โ‰ˆ ฯƒ/โˆšN 100ร— samples, 10ร— precision
Random walk spread โˆšn fair ruin: k/N
Markov chain ฯ€ยทP = ฯ€, rows sum to 1 spell length 1/(1 โˆ’ a)
M/M/1 ฯ = ฮป/ฮผ, W_q = ฯ/(ฮผ โˆ’ ฮป), L = ฮปยทW explodes as ฯ โ†’ 1
Least squares m = S_xy/S_xx, c = ศณ โˆ’ mยทxฬ„ Rยฒ = 1 โˆ’ SSE/SST
Elasticity (ฮ”out/out)/(ฮ”in/in) above 1 amplifies

The gradient-descent stability rule: for a quadratic loss with largest curvature ฮป_max (largest eigenvalue of the Hessian), the learning rate must be below 2/ฮป_max. For xยฒ + 5yยฒ the Hessian eigenvalues are 2 and 10, so ฮท < 0.2.

Three checks before you trust a result

  1. Units and limits. Do the units balance? Does the model give the right answer when a parameter is zero or very large?
  2. A second method. Solve it a second way: a formula and a simulation, or two step sizes.
  3. A range. Change the main inputs by 10 percent and report the resulting range.

Calculators

Python Quick calculators for the common formulas

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

The second tool draws the phase of the modelling cycle that you most often skip: a sensitivity bar chart from any numbers you provide. Replace the dictionary with your own model's inputs and outputs.

Python A tornado chart from your own numbers

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Look at price: it is already at its best value, so moving it either way loses exactly the same profit, and the two printed profits are equal. A tornado chart shows the loss from moving an input, so the bar for an input at its optimum extends only to one side. That is the flat top of the profit curve from Chapter 6 in another guise.

Check your understanding

Quick check ยท 5 questions

of 5 answered You scored / 5 ยท perfect!

  1. 1. Which formula gives the largest sustainable constant harvest of a logistic population?

    The growth rate peaks at N = K/2 where it equals rK/4.
  2. 2. For a quadratic loss with largest Hessian eigenvalue 10, the learning rate must be below:

    The condition is eta < 2 / lambda_max = 2/10.
  3. 3. A simulation's error is 0.05 with 10,000 runs. About how many runs give an error of 0.005?

    10 times less error needs 100 times more runs.
  4. 4. Which check helps catch a wrong formula?

    Independent methods that agree build confidence; disagreement reveals mistakes.
  5. 5. In M/M/1 with rho = 0.5 and mu = 1, the wait in line Wq is:

    Wq = rho / (mu - lambda) = 0.5 / 0.5 = 1.

Summary

  • Keep the formula table and the three checks next to every model.
  • Use calculators to test numbers fast; confirm with a second method.
  • A tornado chart ranks which inputs deserve attention.
  • The cycle never ends: question, assume, build, solve, check, report, repeat.

Next: Further study: where to go next