# Classical Mechanics


### Variational (Lagrangian) Formulation of Mechanics

Rather than specify a second order ODE $F=ma$ (or more explicitly, $\frac{d^2x}{dt^2}=\frac{1}{m}F(x)$) that determines a physical system, we can instead specify a functional equation $dA=0$, where $A=\int_{t_0}^{t_1}L(q(t),\dot{q}(t),t)dt$, and $L$ is the function called the Lagrangian. The classical inertial frame, Cartesian coordinate Lagrangian is $L(q(t),\dot{q}(t),t)=T-V=\frac{\dot{q}(t)^2}{2m}-V(q(t))$.

From variational calculus (see these notes) we can use the Euler-Lagrange equation to find a function $x$ which satisfies the equation. Intuitively, this is the curve in the state space which minimizes the action $A$. For the above value of $L$, we get back $F=ma$ from doing this. But the power of the above is that it’s very easy to change coordinate frames, and introduce different Lagrangians.

We say that the generalized momentum $p = \frac{\partial L}{\partial \dot{q}}$. For the Lagrangian above and Cartesian coordinates, this gives $p=mv$, but in general it doesn’t.

Important: if you using a Euclidean coordinate system, it turns out that $L=T-V$, for the standard kinetic and potential energies. But this isn’t true in coordinate systems which aren’t rotation and shift invariant. So for example, to express the behavior of a pendulum, you want to use $\theta$ as your degree of freedom, but write $T$ and $V$ in terms of the Cartesian coordinates (which you then differentiate wrt. $\theta$ and $p_{\theta}$).

Also important: $\pd{L}{t}$ and $\frac{dL}{dt}$ are totally different quantities, because $L$ depends on $t$ both directly, and through $q$ and $\dot{q}$.

### Hamiltonian Formulation of Mechanics

Consider $H := p_i\dot{q}_i - L$. Here, I’m using Einstein notation to sum over different dimensions indexed by $i$, since $q$ and $p$ can be multidimensional.

To see why this quantity (which is the Legendre transform of the Lagrangian) is important, first note that, :

$$\frac{dL}{dt} = \pd{L}{q_i}\dot{q}_i+\pd{L}{\dot{q}_i}\ddot{q}_i + \pd{L}{t}$$

Now, assuming that Euler-Lagrange is satisfied, $\pd{L}{q_i} = \frac{d}{dt}\pd{L}{\dot{q}_i} = \dot{p}_i$, so

$$\frac{dL}{dt} = \dot{p}_i\dot{q}_i + p_i\ddot{q}_i + \pd{L}{t} = \frac{dp_i\dot{q}_i}{dt} + \pd{L}{t}$$

Then $\frac{dH}{dt}=-\pd{L}{t}$, so $H$ is a time-conserved quantity (the Hamiltonian) if the Lagrangian is not explicitly dependent on time.

More interestingly:

$$\dot{p}_i = -\pd{H}{q_i}$$

$$\dot{q}_i = \pd{H}{p_i}$$

If we consider a space of all the $p$ and $q$ dimensions together (phase space), then this system of equations tells us how a point in that space evolves.

We know by Liouville’s theorem that a divergence-free flow is incompressible. $H$ gives a divergence free flow, so phase flow is incompressible.