Asymptotic Behavior

๐Ÿ‘ค Sรฉbastien Boisgรฉrault

Control Engineering with Python

Symbols

๐Ÿ Code ๐Ÿ” Worked Example
๐Ÿ“ˆ Graph ๐Ÿงฉ Exercise
๐Ÿท๏ธ Definition ๐Ÿ’ป Numerical Method
๐Ÿ’Ž Theorem ๐Ÿงฎ Analytical Method
๐Ÿ“ Remark ๐Ÿง  Theory
โ„น๏ธ Information ๐Ÿ—๏ธ Hint
โš ๏ธ Warning ๐Ÿ”“ Solution

๐Ÿ Imports

from numpy import *
from numpy.linalg import *
from scipy.linalg import *
from matplotlib.pyplot import *
from mpl_toolkits.mplot3d import *
from scipy.integrate import solve_ivp

๐Ÿ Streamplot Helper

def Q(f, xs, ys):
    X, Y = meshgrid(xs, ys)
    v = vectorize
    fx = v(lambda x, y: f([x, y])[0])
    fy = v(lambda x, y: f([x, y])[1])
    return X, Y, fx(X, Y), fy(X, Y)

โ„น๏ธ Assumption

From now on, we only deal with well-posed systems.

๐Ÿท๏ธ Asymptotic

Asymptotic = Long-Term: when \(t \to + \infty\)

โš ๏ธ

Even simple dynamical systems may exhibit

complex asymptotic behaviors.

Lorenz System

\[ \begin{array}{lll} \dot{x} &=& \sigma (y - x) \\ \dot{y} &=& x (\rho - z) \\ \dot{z} &=& xy - \beta z \end{array} \]

Visualized with Fibre

Hadley System

\[ \begin{array}{lll} \dot{x} &=& -y^2 - z^2 - ax + af\\ \dot{y} &=& xy - b xz - y + g \\ \dot{z} &=& bxy + xz - z \end{array} \]

Visualized with Fibre

๐Ÿท๏ธ Equilibrium

An equilibrium of system \(\dot{x} = f(x)\) is a state \(x_e\) such that the maximal solution \(x(t)\) such that \(x(0) = x_e\)

  • is global and,

  • is \(x(t) = x_e\) for any \(t > 0\).

๐Ÿ’Ž Equilibrium

The state \(x_e\) is an equilibrium of \(\dot{x} = f(x)\)

\[\Longleftrightarrow\]

\[f(x_e) = 0.\]

Stability

About the long-term behavior of solutions.

  • โ€œStabilityโ€ subtle concept,

  • โ€œAsymptotic Stabilityโ€ simpler (and stronger),

  • โ€œAttractivityโ€ simpler yet, (but often too weak).

Attractivity

Context: system \(\dot{x} = f(x)\) with equilibrium \(x_e\).

๐Ÿท๏ธ Global Attractivity

The equilibrium \(x_e\) is globally attractive if for every \(x_0,\) the maximal solution \(x(t)\) such that \(x(0)=x_0\)

  • is global and,

  • \(x(t) \to x_e\) when \(t \to +\infty\).

๐Ÿท๏ธ Local Attractivity

The equilibrium \(x_e\) is locally attractive if for every \(x_0\) close enough to \(x_e\), the maximal solution \(x(t)\) such that \(x(0)=x_0\)

  • is global and,

  • \(x(t) \to x_e\) when \(t \to +\infty\).

๐Ÿ” Global Attractivity

The system

\[ \begin{array}{cc} \dot{x} &=& -2x + y \\ \dot{y} &=& -2y + x \end{array} \]

  • is well-posed,

  • has an equilibrium at \((0, 0)\).

๐Ÿ Vector field

def f(xy):
    x, y = xy
    dx = -2*x + y
    dy = -2*y + x
    return array([dx, dy])

๐Ÿ“ˆ Stream plot

figure()
x = y = linspace(-5.0, 5.0, 1000)
streamplot(*Q(f, x, y), color="k")
plot([0], [0], "k.", ms=20.0)
axis("square")
axis("off")

๐Ÿ” Local Attractivity

The system

\[ \begin{array}{cc} \dot{x} &=& -2x + y^3 \\ \dot{y} &=& -2y + x^3 \end{array} \]

  • is well-posed,

  • has an equilibrium at \((0, 0)\).

๐Ÿ Vector field

def f(xy):
    x, y = xy
    dx = -2*x + y**3
    dy = -2*y + x**3
    return array([dx, dy])

๐Ÿ“ˆ Stream plot

figure()
x = y = linspace(-5.0, 5.0, 1000)
streamplot(*Q(f, x, y), color="k")
plot([0], [0], "k.", ms=10.0)
axis("square")
axis("off")

๐Ÿ” No Attractivity

The system

\[ \begin{array}{cr} \dot{x} &=& -2x + y \\ \dot{y} &=& 2y - x \end{array} \]

  • is well-posed,

  • has a (unique) equilibrium at \((0, 0)\).

๐Ÿ Vector field

def f(xy):
    x, y = xy
    dx = -2*x + y
    dy =  2*y - x
    return array([dx, dy])

๐Ÿ“ˆ Stream plot

figure()
x = y = linspace(-5.0, 5.0, 1000)
streamplot(*Q(f, x, y), color="k")
plot([0], [0], "k.", ms=10.0)
axis("square")
axis("off")

๐Ÿงฉ Pendulum

The pendulum is governed by the equation

\[ m \ell^2 \ddot{\theta} + b \dot{\theta} + m g \ell \sin \theta = 0 \]

where \(m>0\), \(\ell>0\), \(g>0\) and \(b\geq0\).

1. ๐Ÿงฎ

Compute the equilibria of this system.

2. ๐Ÿง 

Can any of these equilibria be globally attractive?

3. ๐Ÿ“ˆ

Assume that \(m=1\), \(\ell=1\), \(g=9.81\) and \(b=1\).

Make a stream plot of the system.

4. ๐Ÿ”ฌ

Determine which equilibria are locally attractive.

5. ๐Ÿ“ˆ Frictionless Pendulum

Assume now that \(b=0\).

Make a stream plot of the system.

6. ๐Ÿงฎ ๐Ÿง 

Prove that the equilibrium at \((0,0)\) is not locally attractive.

๐Ÿ—๏ธ Hint. Study how the total mechanical energy \(E\)

\[ E(\theta,\dot{\theta}) := m\ell^2 \dot{\theta}^2 / 2 - m g\ell \cos \theta \]

evolves in time.

๐Ÿ”“ Pendulum

1. ๐Ÿ”“

The 2nd-order differential equations of the pendulum are equivalent to the first order system

\[ \left| \begin{array}{rcl} \dot{\theta} &=& \omega \\ \dot{\omega} &=& (- b / m \ell^2) \omega - (g /\ell) \sin \theta \\ \end{array} \right. \]

Thus, the system state is \(x =(\theta, \omega)\) and is governed by \(\dot{x} = f(x)\) with

\[ f(\theta, \omega) = (\omega, (- b / m \ell^2) \omega - (g /\ell) \sin \theta). \]

Hence, the state \((\theta, \omega)\) is a solution to \(f(\theta, \omega) = 0\) if and only if \(\omega = 0\) and \(\sin \theta = 0\). In other words, the equilibria of the system are characterized by \(\theta = k \pi\) for some \(k \in \mathbb{Z}\) and \(\omega (= \dot{\theta}) = 0\).

2. ๐Ÿ”“

Since there are several equilibria, none of them can be globally attractive.

Indeed let \(x_1\) be a globally attractive equilibrium and assume that \(x_2\) is any other equilibrium. By definition, the maximal solution \(x(t)\) such that \(x(0) = x_2\) is \(x(t) = x_2\) for every \(t\geq0\). On the other hand, since \(x_1\) is globally attractive, it also satisfies \(x(t) \to x_1\) when \(t\to +\infty\), hence there is a contradiction.

Thus, \(x_1\) is the only possible equilibrium.

3. ๐Ÿ”“

m = l = b = 1; g=9.81

def f(theta_omega):
    theta, omega = theta_omega
    d_theta = omega
    d_omega = - b / (m * l * l) * omega
    d_omega -=  (g / l) * sin(theta)
    return (d_theta, d_omega)

figure()
theta = linspace(-2*pi*(1.2), 2*pi*(1.2), 1000)
d_theta = linspace(-5.0, 5.0, 1000)
streamplot(*Q(f, theta, d_theta), color="k")
plot([-2*pi, -pi, 0 ,pi, 2*pi], 5*[0.0], "k.")
xticks([-2*pi, -pi, 0 ,pi, 2*pi],
[r"$-2\pi$", r"$\pi$", r"$0$", r"$\pi$", r"$2\pi$"])
grid(True)

4. ๐Ÿ”“

From the streamplot, we see that the equilibria

\[(\theta, \dot{\theta}) = (2k\pi, 0), \; k\in \mathbb{Z}\]

are asymptotically stable, but that the equilibria

\[(\theta, \dot{\theta}) = (2(k+1) \pi, 0),\; k\in \mathbb{Z}\]

are not (they are not locally attractive).

5. ๐Ÿ”“

b = 0
figure()
streamplot(*Q(f, theta, d_theta), color="k")
plot([-2*pi, -pi, 0 ,pi, 2*pi], 5*[0.0], "k.")
xticks([-2*pi, -pi, 0 ,pi, 2*pi],
[r"$-2\pi$", r"$\pi$", r"$0$", r"$\pi$", r"$2\pi$"])
grid(True)

6. ๐Ÿ”“

\[ \begin{split} \dot{E} &= \frac{d}{dt} \left(m\ell^2 \dot{\theta}^2 / 2 - m g\ell \cos \theta\right) \\ &= m\ell^2 \ddot{\theta}\dot{\theta} + m g \ell (\sin \theta) \dot{\theta} \\ &= \left(m\ell^2 \ddot{\theta} + m g \ell \sin \theta \right)\dot{\theta} \\ &= \left(- b \dot{\theta}\right)\dot{\theta} \\ &= 0 \end{split} \]

Therefore, \(E(t)\) is constant.

On the other hand,

\[ \min \, \{E(\theta, \dot{\theta}) \; | \; (\theta,\dot{\theta}) \in \mathbb{R}^2\} = E(0, 0) = -mgl. \]

Moreover, this minimum is locally strict. Precisely, for any \(0< |\theta| < \pi\), \[ E(0, 0) < E(\theta,\dot{\theta}). \]

If the origin was locally attractive, for any \(\theta(0)\) and \(\dot{\theta}(0)\) small enough, we would have \[ E(\theta(t), \dot{\theta}(t)) \to E(0, 0) \; \mbox{ when } \; t\to +\infty \] (by continuity). But if \(0 < |\theta(0)| < \pi\), we have

\[E(\theta(0), \dot{\theta}(0)) > E(0, 0)\]

and that would contradict that \(E(t)\) is constant.

Hence the origin is not locally attractive.

๐Ÿ’Ž Attractivity (Low-level)

The equilibrium \(x_e\) is globally attractive iff:

  • for any state \(x_0\) and for any \(\epsilon > 0\) there is a \(\tau \geq 0\),

  • such that the maximal solution \(x(t)\) such that \(x(0) = x_0\) is global and,

  • satisfies:

    \[ \|x(t) - x_e\| \leq \epsilon \; \mbox{ when } \; t \geq \tau. \]

โš ๏ธ Warning

  • Very close values of \(x_0\) could theoretically lead to very different โ€œspeed of convergenceโ€ of \(x(t)\) towards the equilibrium.

  • This is not contradictory with the well-posedness assumption: continuity w.r.t. the initial condition only works with finite time spans.

๐Ÿ” (Pathological) Example

\[ \begin{array}{lll} \dot{x} &=& x + xy - (x + y)\sqrt{x^2 + y^2} \\ \dot{y} &=& y - x^2 + (x - y) \sqrt{x^2 + y^2} \end{array} \]

Equivalently, in polar coordinates:

\[ \begin{array}{lll} \dot{r} &=& r (1 - r) \\ \dot{\theta} &=& r (1 - \cos \theta) \end{array} \]

๐Ÿ Vector Field

def f(xy):
    x, y = xy
    r = sqrt(x*x + y*y)
    dx = x + x * y - (x + y) * r
    dy = y - x * x + (x - y) * r
    return array([dx, dy])

๐Ÿ“ˆ Stream Plot

figure()
x = y = linspace(-2.0, 2.0, 1000)
streamplot(*Q(f, x, y), color="k")
plot([1], [0], "k.", ms=20.0)
axis("square")
axis("off")

Asymptotic Stability

Asymptotic stability is a stronger version of attractivity which is by definition robust with respect to the choice of the initial state.

๐Ÿท๏ธ Global Asympt. Stability

The equilibrium \(x_e\) is globally asympt. stable iff:

  • for any state \(x_0\) and for any \(\epsilon > 0\) there is a \(\tau \geq 0\),

  • and there is a \(r > 0\) such that if \(\|x_0' - x_0\| \leq r\),

  • such that the maximal solution \(x(t)\) such that \(x(0) = x_0'\) is global and,

  • satisfies:

    \[ \|x(t) - x_e\| \leq \epsilon \; \mbox{ when } \; t \geq \tau. \]

Set of Initial Conditions

Let \(f: \mathbb{R}^n \to \mathbb{R}^n\) and \(X_0 \subset \mathbb{R}^n\).

Let \(X(t)\) be the image of \(X_0\) by the flow at time \(t\):

\[ X(t) := \{x(t) \; | \; \dot{x} = f(x), \; x(0)= x_0, \; x_0 \in X_0 \ \}. \]

๐Ÿ’Ž Global Asympt. Stability

An equilibrium \(x_e\) is globally asympt. stable iff

  • for every bounded set \(X_0\) and any \(x_0 \in X_0\) the associated maximal solution \(x(t)\) is global and,

  • \(X(t) \to \{x_e\}\) when \(t\to +\infty\).

๐Ÿท๏ธ Limits of Sets

\[ X(t) \to \{x_e\} \]

to be interpreted as

\[ \sup_{x(t) \in X(t)} \|x(t) - x_e\| \to 0. \]

๐Ÿท๏ธ Hausdorff Distance

\[ \sup_{x(t) \in X(t)} \|x(t) - x_e\| = d_H(X(t), \{x_e\}) \]

where \(d_H\) is the Hausdorff distance between sets:

\[ d_H(A, B) := \max \left\{ \sup_{a \in A} d(a, B), \sup_{b\in B} d(A, b) \right\}. \]

๐Ÿท๏ธ Local Asymptotic Stability

The equilibrium \(x_e\) is locally asympt. stable iff:

  • there is a \(r>0\) such that for any \(\epsilon > 0\),

  • there is a \(\tau \geq 0\) such that,

  • if \(\|x_0 - x_e\| \leq r\), the maximal solution \(x(t)\) such that \(x(0) = x_0\) is global and satisfies:

    \[ \|x(t) - x_e\| \leq \epsilon \; \mbox{ when } \; t \geq \tau. \]

๐Ÿ’Ž Local Asympt. Stability

An equilibrium \(x_e\) is locally asympt. stable iff:

There is a \(r>0\) such that for every set \(X_0\) such that

\[ X_0 \subset \{x \; | \; \|x - x_e\| \leq r \}, \]

and for any \(x_0 \in X_0\), the associated maximal solution \(x(t)\) is global and

\[ X(t) \to \{x_e\} \mbox{ when } t\to +\infty. \]

๐Ÿท๏ธ Stability

An equilibrium \(x_e\) is stable iff:

  • for any \(r>0\),

  • there is a \(\rho \leq r\) such that if \(|x(0) - x_e| \leq \rho\), then

  • the solution \(x(t)\) is global,

  • for any \(t\geq 0\), \(|x(t) - x_e| \leq r\).

๐Ÿงฉ Vinograd System

Consider the system:

\[ \begin{array}{rcl} \dot{x} &=& (x^2 (y-x) +y^5) / (x^2 + y^2 (1 + (x^2 + y^2)^2 )) \\ \dot{y} &=& y^2 (y - 2x) / (x^2 + y^2 (1 + (x^2 + y^2)^2 )) \end{array} \]

๐Ÿ Vector field

def f(xy):
    x, y = xy
    q = x**2 + y**2 * (1 + (x**2 + y**2)**2)
    dx = (x**2 * (y - x) + y**5) / q
    dy = y**2 * (y - 2*x) / q
    return array([dx, dy])

๐Ÿ“ˆ Stream plot

figure()
x = y = linspace(-1.0, 1.0, 1000)
streamplot(*Q(f, x, y), color="k")
xticks([-1, 0, 1])
plot([0], [0], "k.", ms=10.0)
axis("square")
axis("off")

1. ๐Ÿงฎ

Show that the origin \((0, 0)\) is the unique equilibrium.

2. ๐Ÿ“ˆ๐Ÿ”ฌ

Does this equilibrium seem to be attractive (graphically) ?

3. ๐Ÿง 

Show that for any equilibrium of a well-posed system:

๐Ÿ’Ž (locally) asymptotically stable \(\Rightarrow\) stable

4. ๐Ÿงช๐Ÿ“ˆ

Does the origin seem to be stable (experimentally ?)

Conclude accordingly.

๐Ÿ”“ Vinograd System

1. ๐Ÿ”“

\((x,y)\) is an equilibrium of the Vinograd system iff

\[ \begin{array}{rcl} (x^2 (y-x) +y^5) / (x^2 + y^2 (1 + (x^2 + y^2)^2 )) &=& 0 \\ y^2 (y - 2x) / (x^2 + y^2 (1 + (x^2 + y^2)^2 )) &=& 0 \end{array} \]

or equivalently

\[ y^2 (y - 2x) = 0 \; \mbox{ and } \; x^2 (y-x) +y^5 = 0. \]

If we assume that \(y=0\), then:

  • \(y^2 (y - 2x) = 0\) is satisfied and

  • \(x^2 (y-x) +y^5 = 0 \, \Leftrightarrow \, -x^3 = 0 \, \Leftrightarrow \, x=0.\)

Under this assumption, \((0,0)\) is the only equilibrium.

Otherwise (if \(y\neq 0\)),

  • \(y^2 (y - 2x) = 0\) yields \(y = 2x\),

  • The substitution of \(y\) by \(2x\) in \(x^2 (y-x) +y^5 = 0\) yields \[x^3(1+32x^2)=0\] and therefore \(x=0\).

  • \(y^2 (y - 2x) = 0\) becomes \(y^3=0\) and thus \(y=0\).

The initial assumption cannot hold.

Conclusion:

The Vinograd system has a single equilibrium: \((0, 0)\).

2. ๐Ÿ”“

Yes, the origin seems to be (globally) attractive.

As far as we can tell, the streamplot displays trajectories that ultimately all converge towards the origin.

3. ๐Ÿ”“

Letโ€™s assume that \(x_e\) is a (locally) asymptotically stable of a well-posed system.

Let \(r>0\) such that this property is satisfied and let

\[ B := \{x \in \mathbb{R}^n \; | \; \|x - x_e\| \leq r \} \subset \mathrm{dom} \, f. \]

The set \(x(t, B)\) is defined for any \(t\geq 0\) and since \(B\) is a neighbourhood of \(x_e\), there is \(\tau \geq 0\) such that for any \(t \geq \tau\), the image of \(B\) by \(x(t, \cdot)\) is included in \(B\).

\[ t\geq \tau \, \Rightarrow \, x(t, B) \subset B. \]

Additionally, the system is well-posed.

Hence there is a \(r' > 0\) such that for any \(x_0\) in the closed ball \(B'\) of radius \(r'\) centered at \(x_e\) and any \(t \in [0, \tau]\), we have

\[ \|x(x_0, t) - x(x_e, t) \| \leq r. \]

Since \(x_e\) is an equilibrium, \(x(t, x_e) = x_e\), thus \(\|x(x_0, t) - x_e \| \leq r.\) Equivalently,

\[ 0\leq t \leq \tau \, \Rightarrow \, x(t, B') \subset B. \]

Note that since \(x(0, B') = B'\), this inclusion yields \(B' \subset B\). Thus, for any \(t \geq 0\), either \(t\in [0, \tau]\) and \(x(t, B') \subset B\) or \(t\geq \tau\) and since \(B' \subset B\),

\[x(t, B') \subset x(t, B) \subset B.\]

Conclusion: we have established that there is a \(r > 0\) such that \(B \subset \mathrm{dom} \, f\) and a \(r'>0\) such that \(r' \leq r\) and

\[ t\geq 0 \, \Rightarrow x(t, B') \subset B. \]

In other words, the system is stable! ๐ŸŽ‰

4. ๐Ÿ”“

No! We can pick initial states \((0, \varepsilon)\), with \(\varepsilon >0\) which are just above the origin and still the distance of their trajectory to the origin will exceed \(1.0\) at some point:

def fun(t, xy):
    return f(xy)
eps = 1e-10; xy0 = (0, eps)
sol = solve_ivp(
  fun=fun,
  y0=xy0,
  t_span=(0.0, 100.0),
  dense_output=True)["sol"]

t = linspace(0.0, 100.0, 10000)
xt, yt = sol(t)
figure()
x = y = linspace(-1.0, 1.0, 1000)
streamplot(*Q(f, x, y), color="#ced4da")
xticks([-1, 0, 1])
plot([0], [0], "k.", ms=10.0)
plot(xt, yt, color="C0")