Lesson 13 of 15

Finding Equilibria

Finding Equilibria

An equilibrium (or fixed point) of dydt=f(y)\frac{dy}{dt} = f(y) is a value yy^* where the derivative is zero:

f(y)=0f(y^*) = 0

At an equilibrium, the system does not change. Equilibria are the long-term destinations (or starting points) of solutions.

Examples

SystemEquilibria
dydt=y\frac{dy}{dt} = -yy=0y^* = 0
dydt=y(1y)\frac{dy}{dt} = y(1 - y)y=0y^* = 0 and y=1y^* = 1
dydt=sin(y)\frac{dy}{dt} = \sin(y)y=nπy^* = n\pi for all integers nn

Numerical Root Finding: Bisection

To find equilibria numerically, we look for sign changes in ff over an interval. Between any two points where ff changes sign, there must be a zero (Intermediate Value Theorem).

For each sign change, we narrow down the root using bisection:

lo, hi = x0, x1
for _ in range(50):
    mid = (lo + hi) / 2
    if f(lo) * f(mid) <= 0:
        hi = mid
    else:
        lo = mid

50 bisection steps gives precision interval/2501015\approx \text{interval} / 2^{50} \approx 10^{-15}.

Your Task

Implement find_equilibria(f, a, b) that finds all zeros of ff in [a,b][a, b] using sign changes and bisection. Return a list of equilibrium values rounded to 6 decimal places.

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