---
title: Frameworks and Review
allDay: false
startTime: 12:30
endTime: 14:30
date: 2024-09-09
completed: null
type: single
---
# Introduction
Where do nonlinearities come from?
Well, a couple of places...
1. Geometric nonlinearities (pendulum)
2. External fields
3. Material properties
So we're stuck with them. Bjupyter labut how do we deal with noninearities?

## A nonlinear equation
$$ \dot{x} = \frac{dx}{dt} = 1-2\cos x$$
How do you solve this? You can't use Laplace, you can't separate...
*insert very long expression that Bajaj wrote.*
Getting an analytical solution can be a PITA to obtain. For this reason:
**The general case is that nonlinear equations are unsolvable.**
This doesn't mean we can't learn things. We can describe these systems *qualitatively*.

Really our options come down to:
- Solve exactly (Not likely to happen)
- Solve numerically
- Analyze qualitatively (~geometrically)
- Solve an approximation to the problem
We mix and match these approaches. 
## Geometric (Qualitative) Methods
Geometric analysis answers questions like "is this stable?" "what's the response look like?"
### Linear Systems
$$ \dot{x} = Ax$$
This is a simple linear dynamic system. 
How many equilibria does this system have?
**One.**
The system is at equilibrium where $\frac{dx}{dt} = 0$. It won't move from this point.

Is this system stable? Check the eigenvalues of A.
### Nonlinear Systems
**Recall: $\dot{x} = 1-2\cos x$**
We can qualitatively describe systems using the phase plane:
*Insert graphics from class*

How is this useful to us engineers?
We are going to see systems that are nonlinear, and they can give us ideas about where things could blow up. In our second example, we have generally a pretty safe area below x = 2. Anywhere below there, we know we're going to end up at x = -2, but above x =2, all hell breaks loose.

This is what we care about. We want to know where in our nonlinear system domains things can become dangerous.
# How do we numerically get a time domain response?
Numericaly:
$$ \dot x = f(x) $$
$$\frac{dx}{dt} = \lim_{\Delta t \rightarrow 0} \frac{f(x(t+\Delta t))-f(x(x))}{\Delta t} $$
This is the tangent (or the secant while $\Delta t =/ 0$)
>[!note] Euler's Method
>Therefore, for finite $\Delta t$:
> $$ f(x(t+\Delta t)) = \frac{dx}{dt} \Delta t +  f(x(t))$$
> Limitations: innaccurate if time steps are large.
> There are better methods!
> ode45() <- Variable Step Runge-Kutta 

We're going to use a lot of odeint in SciPy
*Insert code here*.

# Geometric Analyses in Higher Dimensions
We want to do geometric analysis with n-dimensions, not just one.
## Linear stability for a nonlinear system
1. Find the fixed equilibrium points
$$\dot x = 0 = f(x)$$
This equation is solved by points $x^\star$
Define: $$ \epsilon(t) = x(t) - x^\star \rightarrow x(t) = x^\star + \epsilon(t)$$
$$\frac{dx}{dt} = f(x)$$
$$\frac{d\epsilon}{dt} = f(x^\star +\epsilon)$$
$$= f(x^\star) + \epsilon f'(x^\star) + \Theta(\epsilon^2)\rightarrow \epsilon f'(x^\star) + \Theta(\epsilon^2)$$
$$\frac{d\epsilon}{dt} = \epsilon f'(x^\star) + \Theta(\epsilon^2) \rightarrow \epsilon f'(x^\star)$$
- If $\epsilon f'(x^\star) > 0 \rightarrow \text{Unstable}$
- If $\epsilon f'(x^\star) < 0 \rightarrow \text{Stable}$
- If $\epsilon f'(x^\star) = 0 \rightarrow \text{Inconclusive}$
## Energy Motivation
$$\dot{x} = f(x) = -\frac{dV}{dt} \text{V = potential}$$
$$\frac{dV}{dx} = -\frac{dx}{dt}$$
$$\frac{dV}{dt} <0 \rightarrow V \text{continuously decreasing in time until } \frac{dV}{dt} = 0$$
- Stable fixed poitn: $V(x^\star)$ is (a local) minimum of $V(x)$
- Unstable fixed point: $V(x^\star)$ is (a local) maximum of $V(x)$. 
# A review of Linear Differential Equations
## Foundation
$$\dot{\vec{x}} = \frac{dx}{dt} = \bf{A} \vec{x} + \vec{F}$$
Homogeneous (no input/forcing):
$$\dot{\vec{x}} = \bf{A} \vec{x}$$
$$\vec{x}(t) = C e^{\bf{A}t}$$
This e to the matrix A is kinda gross. We represent this as follows:
$$ e^{\bf{A}} = \sum_{k=0}^\inf \frac{\bf{A}^k}{k!}$$so then:
$$ e^{\bf{A}t} = \sum_{k=0}^\inf \frac{\bf{A}^k t^k}{k!}$$
But since $\frac{d}{dt}e^{\bf{A}t} = \bf{A}e^{\bf{A}t}$
Some proof that xdot = Ax

## Diagonalization
Suppose:
$$ \dot{\vec{x}} = \bf{A}\vec{x} $$
with A diagonal. Then
$$ \dot{x}_n = a_{nn} x_n$$
This is nice. So we should try and diagonalize things...
- Find $\bf{P}$ such that $\bf P^{-1} \bf A \bf P = \bf D$
Then we have new coordinates:
- $\vec{x} = \bf{P} \vec y$
- $\vec{\dot{x}} = \bf{P} \vec{\dot{y}}$
- then $\dot{\vec{y}} = \bf{P^{-1}AP}\vec{y}$
Choose P to be column wise eigenvectors of A, with diagonal matrix D having the eigenvalues of A. 
This isn't always possible.
## Fundamental Matrix
$$ e^{\bf{A}t} = \Psi(t) = \text{Fundamental matrix of } \dot{\vec{x}} = \bf{A} \vec{x}$$
How do we calculate this thing?
- series calculation of $A^m$
- Smarter computer program
- Laplace Transform
Consider: $\dot{\vec{x}} = \bf{A}\vec{x} + \vec{F}$
$$ \vec{x}(t) = \bf{\Psi} \vec{c} \leftarrow \text{autonomous}$$
or the total solution:
$$ \vec{x}(t) = \bf{\Psi} \vec{c} + \int_{t_0}^t \bf{\Psi}^{-1}(\bf{I}) \bf{F}(I)dI + \bf{\Psi}(t_0)\vec{c}$$
$$ \vec{x}(t_0) = \bf{\Psi}(t_0)\vec{c}$$
Then the solution is 
$$\vec{x}(t) = e^{\bf{A}t}\vec{c} + e^{\bf{A}t} \int_{t_0}^t e^{-\bf{A}I} F(T) \delta T$$
Then using the Laplace transform:
$$e^{\bf{A}t} = \mathcal{L}^{-1} \{ (sI-\bf{A})^-1 \} $$
# Written Notes

![[How do we deal with nonlinearities?.png]]
![[Mode Diagram.png]]