15.3 Epidemic Models ended on a coincidence that is no coincidence. The SIR product is the law of mass action of chemistry: molecules react at a rate proportional to how often they meet, and meetings are proportional to the product of concentrations. Rate constants here differ by factors of a thousand or a billion, one reaction races ahead and finishes, and an explicit solver pays for the race for the rest of the run. That is stiffness.
Transcript
- Last lesson ended on a coincidence that is no coincidence. The product S times I in SIR is the law of mass action: molecules react at a rate proportional to how often they meet, so A plus B making C runs at k times A times B. A network becomes differential equations by bookkeeping, c prime equals N times v of c. But chemical rate constants differ by factors of a thousand or a billion: one reaction races ahead and finishes, and an explicit solver pays for the race for the rest of the run. That is stiffness.
- Integrated rate laws. First order gives A equals A 0 times e to the minus k t, with a half-life of ln 2 over k that does not depend on A 0. Second order gives one over A equals one over A 0 plus k t, and a half-life that grows as the sample dilutes. Take A 0 equal to 2 and k equal to 0.5. At time 4, first order has left 0.2707, with half-life 1.386. Second order has left 0.4, with half-life exactly 1.
- Reversible reactions. A converts to B at rate k f and back at rate k r. A relaxes to A equilibrium equals k r over k f plus k r times A 0, at the rate k f plus k r, the nonzero eigenvalue. With k f equal 2 and k r equal 1, K is 2, A equilibrium is one third, and the rate is 3. A at time 3 is 0.3334, against the closed form 0.33342.
- Now a chain, A to B to C. The intermediate B rises, peaks, and falls. For k 1 equal 1 and k 2 equal 0.25 the peak is at 1.848 with height 0.6300, and C at time 8 is 0.8197. If k 2 is much larger than k 1, B is consumed as fast as it is made, so set B prime to zero: B is about k 1 over k 2 times A. This is the quasi-steady-state approximation. For k 2 equal to 20 the exact ratio is 1 over 19, or 0.0526, against 0.05.
- Enzymes. An enzyme E binds a substrate S, forms a complex C, and releases a product P. Binding is fast and the enzyme is scarce, so set C prime to zero. The product rate is V max times S over K m plus S, saturating at V max. It holds when epsilon, E 0 over K m plus S 0, is small. With k 1 equal 10, k minus 1 equal 5, k 2 equal 1, K m is 0.6 and S 0 is 1. The largest gap is 0.22 percent of S 0 at epsilon 0.00625, 2.2 percent at 0.0625, and 10.7 percent at 0.3125.
- Can chemistry oscillate? Hold two reservoirs constant and the Brusselator can. Its fixed point is a, b over a, with trace b minus 1 minus a squared and determinant a squared. For a equal 1 the trace changes sign at b equal 2: a Hopf bifurcation. At b equal 1.8 the eigenvalues are minus 0.1 plus or minus 0.995 i, a stable spiral. At b equal 3 they are 0.5 plus or minus 0.866 i, and every start winds out to a closed curve, with period 7.157 and x from 0.3706 to 3.7518.
- Now stiffness, measured. Take the chain with k 1 equal 1 and k 2 equal 1000. By time 0.01 the fast mode is 4.5 times 10 to the minus 5: invisible. Yet RK4 forces h below 2.785 times 10 to the minus 3, whatever accuracy requires. At h equal 0.0027 RK4 takes 1852 steps and is accurate to 10 to the minus 13. At 0.0028 it blows up at step 644. Backward Euler at h equal 0.1 needs 50 steps, 37 times fewer.
- Robertson's problem is the standard stiff chemical test, with rates 0.04, 10 to the 4, and 3 times 10 to the 7. The Jacobian has an eigenvalue of minus 3392.8, so RK4 needs h below 8.2 times 10 to the minus 4. It is stable at 8 times 10 to the minus 4 with 50000 steps, and blows up near t equal 31 at 10 to the minus 3. The trapezoid rule is A-stable, yet at h equal 1 it returns a negative concentration: it rings instead of dying.
- Everything so far assumed a well-stirred flask. In a gel or a tissue the species also diffuse, and the Jacobian becomes J minus q squared times the diagonal of D x and D y. A mode grows when b exceeds 1 plus a times the square root of D x over D y, all squared. With a equal 1, D x equal 1 and D y equal 10, the threshold is 1.7325, below the Hopf value 2. At b equal 1.9 the reaction alone is stable, yet q squared equal 0.4 has determinant minus 0.6 and grows. That is a Turing instability, the subject of the next lesson, on reaction diffusion.
Mass action: networks as ODEs
An elementary reaction such as with rate constant proceeds at the rate : the product of the reactant concentrations, one factor per molecule that takes part. A network becomes a system of ODEs by bookkeeping: reaction has rate and a stoichiometric column (the net change in each species per event), so
For : and . SIR is the same recipe: at rate and at rate .
Two things follow without solving. Conservation laws: any with makes constant; here and , as in SIR. And non-negativity: every rate vanishes when its reactant is absent.
Orders and integrated rate laws. A reaction is of order in if . First order separates to with half-life , independent of : radioactive decay. Second order, , gives and half-life , which grows as the sample dilutes. Take and . First order gives and a half-life of . Second order gives and a half-life of exactly . The order is measured, by how the half-life depends on ; it equals the molecularity only for an elementary step.
Reversible reactions and equilibrium
Let with forward constant and reverse constant . Then , and with this is one linear equation: . The solution relaxes to the equilibrium
The rate is the sum , the nonzero eigenvalue of the system. With and , : , , the relaxation rate is , and against the closed form (sim and scipy). At equilibrium each reaction is balanced by its reverse (detailed balance), which is why is a ratio of rate constants. The relaxation rates of any first-order network are eigenvalues of its rate matrix: 7.2 Linear Systems & the Eigenvalue Method.
Consecutive reactions and the quasi-steady state
Now from . Then and , a linear equation with solution
The intermediate rises, peaks where , that is at , and falls. For , : and , and (closed form, sim and scipy agree).
The quasi-steady state. Suppose instead : is consumed as fast as it is made, so it stays small and nearly constant relative to . Setting gives
This is the quasi-steady-state approximation (QSSA): a fast variable is slaved to the slow ones. For and the exact ratio after the first transient is , against the QSSA’s : a relative error of . The transient itself is short: peaks at with the tiny value . The error is small exactly when the rates are far apart, which is also when the problem is stiff.
Lindemann’s mechanism is the classical use. A molecule gains energy by collision with and then reacts: (constants , ), (). Setting gives and an effective rate
At low this is , second order (collisions limit). At high it is , first order. The crossover is at . Take , , and hold fixed, so the system is linear. Its slow eigenvalue (the exact decay rate of ) against , with the fast one:
| exact slow rate | fast rate | ||
|---|---|---|---|
(Eigenvalues from the sim’s solver and numpy; the last column is the magnitude of the fast eigenvalue.) The relative error settles near , which is : the QSSA ignores the small reservoir held in .
Michaelis-Menten kinetics
An enzyme binds a substrate , forms a complex and releases product : , with constants , , . Mass action, with the enzyme conserved (), gives
Binding is fast and the enzyme is scarce, so settles quickly to a slowly drifting value. Set (the Briggs-Haldane form of the QSSA):
This is the Michaelis-Menten law: rate proportional to when (first order), saturating at when (zero order, the enzyme is the bottleneck).
When is the QSSA valid? The complex forms on the time and the substrate depletes on the much longer time . A sufficient condition is that the enzyme is a small fraction of what is available,
(Segel and Slemrod’s condition, from memory). The reduced model treats the substrate locked in as zero, so it errs by about . Test it with , , () and , and compare the full ODE with the reduced equation:
| largest gap between the two products | % of | at time | ||
|---|---|---|---|---|
(Sim and scipy Radau at tolerance agree to four digits.) The error grows roughly in proportion to , and at the reduced curve is visibly wrong.
Oscillating reactions: the Brusselator
Can a chemical system oscillate? Not for the closed reactions above: they relax monotonically to equilibrium or are driven by constant reservoirs, as in a living cell. Hold the reservoirs and constant in the Brusselator scheme: , then (autocatalysis), , and . Mass action gives, with rate constants set to ,
The only fixed point is . The Jacobian there is , so
The determinant is positive, so the point is a node or spiral, stable iff . As passes the trace changes sign and the eigenvalues cross the imaginary axis at : a Hopf bifurcation, exactly the mechanism of 7.9 Limit Cycles & Hopf Bifurcations, with period near at onset. For the threshold is . At the eigenvalues are , a stable spiral. At they are and every start winds out to a closed curve (the cycle’s existence follows from the Poincare-Bendixson theorem, from memory).
| period | range of | ||
|---|---|---|---|
| to | |||
| to | |||
| to | |||
| to |
(Sim and scipy agree on periods to and on ranges to four digits.) The period just above onset is close to and drifts up as the cycle grows; for , it is far from . The amplitude grows like for a supercritical Hopf: half-ranges of are and at and , a ratio of against .
The real Belousov-Zhabotinsky reaction (bromate, malonic acid and a metal catalyst, cycling through colours) is modelled by the three-variable Oregonator (from memory, not run here): autocatalysis plus delayed negative feedback again, and widely separated timescales that make it stiff.
Stiffness, measured
Take the chain with a fast second step: and , from to . The Jacobian has eigenvalues , and . By the fast mode is : invisible, and the solution is smooth, . Yet recall from 4.5 Stability Regions & Stiffness that RK4 on is stable iff with , which holds for (the root of , recomputed here). The fast mode forces
whatever accuracy requires. The measurements:
| method | step | steps | max error at |
|---|---|---|---|
| RK4 | |||
| RK4 | exceeds at step | ||
| backward Euler | |||
| backward Euler | |||
| backward Euler | |||
| trapezoid | |||
| trapezoid | |||
| trapezoid |
(Errors against the exact solution; sim and numpy agree to four digits.) At the per-step factor is , and the fast mode grows by over the run. RK4 at is accurate to : it pays steps for accuracy nobody asked for, while backward Euler at meets a tolerance with steps, times fewer. Steps are not cost: an implicit step solves a linear system (a Newton iteration if the right side is nonlinear). But the explicit limit scales as and the implicit step does not care: at the RK4 count grows a thousandfold and the implicit count stays put.
Robertson’s problem, the standard stiff chemical test of 4.5 Stability Regions & Stiffness, uses rates , and . The sim reruns it with fixed steps on from . Radau and BDF at tolerance give , and the Jacobian there has an eigenvalue , so RK4 needs .
| method | step | steps | and its error |
|---|---|---|---|
| RK4 | (error ) | ||
| RK4 | blows up at | none | |
| backward Euler | () | ||
| backward Euler | () | ||
| trapezoid | (, with ) | ||
| trapezoid | () |
The RK4 row sits right on the predicted limit: stable at , dead at . The trapezoid rule is A-stable but at it returns a negative concentration, and at it is three and a half times worse than backward Euler. The reason is the amplification factor at large : , so the fast transient rings instead of dying, while (L-stability). This is the stable-is-not-accurate warning of the stiffness lesson, now on chemistry; production codes use BDF and Radau.
Where this goes next
Everything above assumed a well-stirred flask. In a gel or a tissue the species also diffuse, and the Brusselator becomes , . Diffusion is stabilising for a single species, yet it can destabilise the pair. Perturb about with : the Jacobian becomes , with determinant . This can go negative, and a mode grows, iff
With , , the threshold is , below the Hopf value . At the reaction alone is a stable spiral (trace ), but the mode has determinant and grows: a Turing instability, where a stable chemistry plus a faster-diffusing inhibitor makes stationary stripes and spots. That is the subject of 15.5 Reaction–Diffusion & Turing Patterns, together with Gray-Scott patterns and the travelling fronts of Fisher-KPP. One honest limit: this only shows where the uniform state loses stability; the pattern itself needs a nonlinear simulation, built next lesson.
The exercise: Michaelis-Menten, Lindemann, backward Euler and the Brusselator
First the playground: the stiff chain with RK4 and backward Euler written as matrix powers, so the stability threshold is visible.
Concept checks
Problems
A first-order reaction has a half-life of s. Find and the time for of the reactant to be consumed.
Show worked solution
. For consumed, , so s (about half-lives, as ).
For with and and , : find , and , and the time for to come within of its equilibrium.
Show worked solution
, , and . Setting gives , so .
An enzyme has and (in consistent units). Find the rate at , the substrate level where the rate is , and the substrate level where the rate is half of . What does the answer say about ?
Show worked solution
. For : , so and . For : gives . So is the half-saturation substrate level.
(a) For , find the Hopf value of and the oscillation period at onset. (b) For the chain with and run to , how many RK4 steps does stability force, and how many does backward Euler need at ?
Show worked solution
(a) , the determinant is and at onset the eigenvalues are , so the period is . (b) Stability needs , so : at least steps, or evaluations of the right side at four per step. Backward Euler at takes steps, whatever is.
Key Takeaways
- Mass action: rate the product of reactant concentrations, ; SIR is a reaction network.
- First-order half-lives are constant, second-order ones grow; a reversible reaction relaxes at to .
- For , peaks at ; the quasi-steady approximation has relative error about .
- Michaelis-Menten, , follows from and holds when is small ( error at , at ).
- The Brusselator has fixed point , trace , determinant : a Hopf bifurcation at , with period near at onset ( at , ).
- Stiffness is a step set by stability, not accuracy: RK4 on a rate of needs ( steps) while backward Euler takes steps at for accuracy.
- A-stability is not enough: on Robertson the trapezoid rule at gives a negative concentration; backward Euler is off.
- Add diffusion to the Brusselator and the stable state can become unstable to patterned modes when : the Turing instability of 15.5 Reaction–Diffusion & Turing Patterns.