1D flows seem to have one of two behaviour
Apart from this we may have a behaviour where
We will study here the bifurcations of flows on a 1D line Let's consider the first example: $\dot{x} = r + x^2$
import numpy as np;
import matplotlib.pyplot as plt;
plt.rcParams.update({"text.usetex":True});
%config InlineBackend.figure_format = "svg"
from ipywidgets import interactive
from scipy.optimize import fsolve
def see_fixed_pts(r=1):
x = np.linspace(-2, 2);
xd = r + x**2;
plt.plot(x, xd);
plt.plot(x, 0*x, '-k');
w = interactive(see_fixed_pts, r = (-2, 2, 0.2));
w
We can then plot the equilibrium points as the parameter r
is varied. Along with that we can also plot whether that particular point is a stable or unstable point. This gives a clear identification of the nature of the roots.
def f(x, r):
return r + x**2;
def dfdx(x, r):
return 2*x;
x = np.linspace(-2, 2);
r_a = np.linspace(-2, 2);
for r in r_a:
sol = fsolve(f, [-2, 2], args=(r), full_output=True);
if sol[2] == 1: # Solution has convered
for i in np.arange(0, np.size(sol[0])):
root = sol[0][i];
slope_at_root = dfdx(root, r)
if slope_at_root > 0:
plt.plot(r, root, 'bx')
else:
plt.plot(r, root, 'ro')
ax = plt.gca(); ax.set_aspect(1);
plt.xlim(np.min(r_a), np.max(r_a))
plt.axhline(0); plt.axvline(0)
plt.xlabel("r");
plt.ylabel("x*");
plt.title("Saddle node bifurcation")
The above diagram clearly elucidates how increasing the parameter r
beyond 0 yields no equilibrium point while for $r<0$ we have one stable and one unstable branch. This is an example of a saddle node bifurcation.
slope_at_root = dfdx(sol[0][0], r); print(slope_at_root)
In the example below, we show the same saddle node bifurcation in a slightly distored form. The normal form of the equation below, i.e. $\dot{x} = r - x - \exp{-x}$ is of the same form as $\dot{x} = r + x^2$
def f(x, r):
return r - x - np.exp(-x);
def dfdx(x, r):
return -1 + np.exp(-x);
x = np.linspace(-2, 2);
r_a = np.linspace(-2, 2, 200);
for r in r_a:
sol = fsolve(f, [-2, 2], args=(r), full_output=True);
if sol[2] == 1: # Solution has convered
for i in np.arange(0, np.size(sol[0])):
root = sol[0][i];
slope_at_root = dfdx(root, r)
if slope_at_root > 0:
plt.plot(r, root, 'bx')
else:
plt.plot(r, root, 'ro')
ax = plt.gca(); ax.set_aspect(1);
plt.xlim(np.min(r_a), np.max(r_a))
plt.axhline(0); plt.axvline(0)
plt.xlabel("r");
plt.ylabel("x*");
plt.title("Saddle node bifurcation")
plt.text(0.5, -1.2, "Unstable branch")
plt.text(0.5, 1.2, "Stable branch")
plt.axvline(1)