Lesson 14 of 15

Stability Analysis

Stability Analysis

Finding an equilibrium is only half the story. We also need to know: will the system stay near the equilibrium, or drift away?

Linearization

For dydt=f(y)\frac{dy}{dt} = f(y) near an equilibrium y∗y^*:

f(y)≈f(y∗)+f′(y∗)⋅(y−y∗)=f′(y∗)⋅(y−y∗)f(y) \approx f(y^*) + f'(y^*) \cdot (y - y^*) = f'(y^*) \cdot (y - y^*)

since f(y∗)=0f(y^*) = 0. The small perturbation δ=y−y∗\delta = y - y^* satisfies:

dδdt=f′(y∗)⋅δ\frac{d\delta}{dt} = f'(y^*) \cdot \delta

This is just exponential growth/decay! The solution is δ(t)=δ(0)⋅ef′(y∗)⋅t\delta(t) = \delta(0) \cdot e^{f'(y^*) \cdot t}.

Stability Criterion

ConditionBehaviorClassification
f′(y∗)<0f'(y^*) < 0Perturbations decayStable
f′(y∗)>0f'(y^*) > 0Perturbations growUnstable
f′(y∗)=0f'(y^*) = 0Need higher-order analysisNeutral

Example

For logistic growth f(y)=y(1−y)f(y) = y(1 - y):

  • f′(y)=1−2yf'(y) = 1 - 2y
  • At y∗=0y^* = 0: f′(0)=1>0f'(0) = 1 > 0 → unstable (population grows away from 0)
  • At y∗=1y^* = 1: f′(1)=−1<0f'(1) = -1 < 0 → stable (population returns to carrying capacity)

Numerical Derivative

We estimate f′(y∗)f'(y^*) using the central difference:

f′(y∗)≈f(y∗+ε)−f(y∗−ε)2εf'(y^*) \approx \frac{f(y^* + \varepsilon) - f(y^* - \varepsilon)}{2\varepsilon}

Your Task

Implement stability(f, x_eq, eps=1e-5) that classifies an equilibrium as "stable", "unstable", or "neutral".

Pyodide loading...
Loading...
Click "Run" to execute your code.