# Week 6 - Stability and Equilibria

We have shown that we can develop trajectories of different physical systems by solving the differential equations that describe them. This is a useful approach, but it often means we are focused on a single trajectory. This might be fine if all the trajectories are the same or roughly so, say like the 1D falling ball, or the simple harmonic oscillator. 

Systems can produce multiple families of trajectories depending on the parameter choices, and the initial conditions associated with the problem you are solving. A more general approach that starts us down the road of characterizing the many potential behaviors that a physical system can exhibit is to consider [stability](https://en.wikipedia.org/wiki/Stability_theory). As we will build the toolkit to investigate classical systems, understanding equilibrium points and their stability is a useful step. 


## Why do we study stability and equilibria?

First, because nature is often moving towards a state of equilibrium because those states are associated, as we will see, with the lowest local energy state. It takes energy to move away from stable equilibrium, and physical systems tend to minimize their energy -- because those configurations are often quite stable. 

Much of the physics that we do today focuses on [non-equilibrium systems](https://en.wikipedia.org/wiki/Non-equilibrium_thermodynamics). These are systems that are typically driven by external interactions to ensure the system remains out of equilibrium. The responses of these systems to this driving and how they might relax to equilibrium are often studied.

Second, we can often start from the equilibrium points of a system and then perturb the system to see how it responds. We know how to solve problems around equilibrium points, and working with fully non-equilibrium systems is often much harder. 

We have gotten much better at working in non-equilibrium spaces, especially as we have developed computing tools that can help us simulate the behavior of systems that are far from equilibrium.

## The Simple Harmonic Oscillator Models Many Systems

You have used the simple harmonic oscillator frequently. 

There's a reason for that. 

It provides the simplest example of a system that exhibits periodic motion. It also is a system with one of the simplest energy landscapes -- a parabola; and it has a global stable equilibrium point at the bottom of the potential well.

There are many systems that we can transform into a simple harmonic oscillator. And it is not because the world is full of springs and masses. It is because the simple harmonic oscillator is a good model for many systems near their local equilibrium points. In fact, as you will see, it is the leading (non-constant) term in every Taylor expansion of a 1D potential energy function near a local minimum.

### Another SHO Example - A Pendulum

Consider a pendulum of mass $m$ and length $L$ that is displaced from the vertical by an angle $\theta$. We can show that the complete equation of motion (without drag) is:

$$mL\ddot{\theta} = - mg\sin \theta,$$

$$\ddot{\theta} = -\frac{g}{L}\sin \theta.$$

Typically we limit to small angles, so $\sin \theta \approx \theta$, and the equation becomes: 

$$\ddot{\theta} = -\frac{g}{L}\theta.$$

This is a second order differential equation that we have solved before. The general EOM for a simple harmonic oscillator is:

$$\ddot{x} = -\omega^2 x.$$

A general solution to this equation is:

$$x(t) = A\cos(\omega t + \phi),$$

where $A$ is the amplitude of the oscillation, $\omega$ is the angular frequency of the oscillation, and $\phi$ is the phase of the oscillation.

This model of an SHO works with many systems, not just pendulums. Here's some examples along with the equivalent natural oscillation frequency, $\omega^2$, for each system:

| System | Equation of motion | $\omega^2$ |
|--------|--------------------|------------|
| Mass-spring system | $m\ddot{x} = -kx$ | $k/m$ |
| Pendulum | $\ddot{\theta} = -\frac{g}{L}\theta$ | $g/L$ |
| LC circuit | $L\ddot{q} = -\frac{q}{C}$ | $1/LC$ |
| Water in a U-shaped tube | $\ddot{h} = -\frac{2g\rho A}{M} h$| $\frac{2g\rho A}{M}$ |


### Stability of the SHO

Regardless of the choice of physical model, the SHO equation is the same second order differential equation, which we write in general as:

$$\frac{d^2 x}{dt^2} = -\omega^2 x$$

For a given system, this results in a potential energy that is proportional to the square of the variable $x$ (the "stretch") and to the square of the frequency $\omega$. This potential energy is always positive, and it can have a non-zero minimum.

$$U(x) = \frac{1}{2} \xi \omega^2 x^2 + U_0$$

where $\xi$ is a positive constant (with units!) of proportionality. In the case of a mass on a spring, $\xi = m$. We can find the equilibrium points by setting taking the first derivative of the potential energy and setting it to zero.

$$\frac{dU}{dx} = \xi \omega^2 x = 0$$

This gives us the equilibrium point at $x = 0$. We might have expected this, as the potential energy is a parabola, and the minimum of a parabola is at the vertex. We can also determine the stability of this equilibrium point by looking at the second derivative of the potential energy, and evaluating it at the equilibrium point.

$$\frac{d^2U}{dx^2} = \xi \omega^2 > 0$$

This number is always positive, indicating that for an SHO, the equilibrium point is stable. This is a general result for the SHO, and it is true for all the systems listed above.

## Interpreting your Analysis

Above, we completed an analysis of the simplest system that we will work with. It lead us to find a global minimum in the potential energy, so that suggests a few things for us to think about:

1. **The SHO is a conservative system - the total energy of the system is conserved.** So any trajectory will oscillate between kinetic and potential energy, but the total energy will remain constant. This is not something that will always be true.
2. **The SHO has a global minimum in potential energy - a globally stable equilibrium point.** Oscillations will always occur around this point. Global stability is a very strong form of stability; it is also rare in that most systems have multiple equilibrium points: some are stable, some are not, and some are [metastable](https://en.wikipedia.org/wiki/Metastability).
3. **If the SHO starts at rest at the equilibrium point, it will remain there.** It will take energy put into the system to move away from the equilibrium point. Because this a global minimum, all trajectories will oscillate around this point. However, in systems with local equilibrium points, the system can be perturbed away from the equilibrium point, and end up in a different equilibrium point. This is a common feature of many systems.
4. **If there are interactions that remove energy from the system, the system will eventually come to rest at the equilibrium point.** This is a common feature of many systems.


## Where are we going?

This work we are doing to understand equations of motion, stability, and equilibrium points is foundational. Some of the most exciting physics we see today is rooted in understanding how systems move away from equilibrium, and how they respond to external driving. [Chaos theory](https://en.wikipedia.org/wiki/Chaos_theory) is a field that has grown out of understanding how systems can be very sensitive to initial conditions, and how they can exhibit complex behavior. 

We will start to use these ideas from this week into next week as we build a set of additional tools like [phase space diagrams](https://en.wikipedia.org/wiki/Phase_space) and using asymptotic behavior to investigate and explain the behavior of physical systems. 

To introduce some of those initial ideas here are two videos from different physics perspectives on the topic of chaos.


### Veritasium - THe Butterfly Effect and Chaotic Systems (13 minute video)

In this video, Derek Muller uses the typical example of the Butterfly Effect to introduce the idea of chaos theory. The philosophical aspects of the butterfly effect are interesting, but not real in any physical sense. Instead, it's a metaphor for the idea that small changes in initial conditions can lead to large changes in the system. Muller contrasts our understanding of determinism with uncertainty; he introduces the concepts of sensitivity to initial conditions and discusses the idea of an attractor. 

[![Chaos Theory](images/06_start_fDek6cYijxI.jpg)](https://www.youtube.com/watch?v=fDek6cYijxI)

### University of Bristol - Chaos Theory and Randomness (8 minute video)

In this video, two researchers from the University of Bristol ([Jens Marklof](https://people.maths.bris.ac.uk/~majm/) and [Henna Koivusalo](https://people.maths.bris.ac.uk/~te20281/)) discuss the idea of chaos theory from a more mathematical perspective - remdining us of the differences between randomness and chaos. The overlap between physicists and mathematicians in the study of chaos is significant. One important contribution is [Dynamical systems](https://en.wikipedia.org/wiki/Dynamical_system), which is a mathematical framework that is used to study these behaviors. The researchers who do this work are mathematicians, physicists, engineers, and computer scientists. They do experiments, but they also do a lot of mathematical modeling.

[![Chaos Theory](images/06_start_5fRhasVmcUE.jpg)](https://www.youtube.com/watch?v=5fRhasVmcUE)


