0%

From Classical Mechanics to Hamiltonian Mechanics

By Z.H. Fu
https://fuzihaofzh.github.io/blog/

In the world of classical mechanics, the Newtonian framework, while foundational, encounters limitations when dealing with complex systems due to its intricate force analysis. To address these challenges, advanced systems like Lagrangian and Hamiltonian mechanics have been developed. These innovative methodologies shift the focus from forces to energy and phase space, respectively, providing a more holistic and simplified approach to understanding physical systems. In this article, we will delve into the intricacies of Lagrangian and Hamiltonian mechanics, exploring how they resolve the complexities of Newtonian mechanics and the unique insights they bring to our comprehension of the dynamics of the physical world.

Classical Mechanics

The Newtonian mechanics give the relationship between force and acceleration as

F=maF=ma

However, this definition involves too many forces. As a result, if we are analyzing a constrained system it incurs too much force here and there which makes it complex to analyze. What we care about are the displacement and the velocity. Is it possible we analyze with less force analysis? We recall that in high school, we learned about the energy conservation law which we can analyze some special states of the systems without analysis of detailed force. However, it becomes a little bit hard if we want to know the exact state at any time for the system which may need PDEs to express. This is why we need Lagrangian mechanics.

Lagrangian Mechanics

We define the Lagrangian as L=TV\mathcal{L}=T-V which has the unit of energy. Here, TT is the kinetic energy while VV is the potential energy. It should be noted that the Lagrangians do not need to have a physics meaning. I have tried a lot of time to get some intuition and one possible intuition is that we can imagine the system want to find a way that kinetic transfers least to the potential energy. But I still suggest we give up. Just admit it is a useful mathematic quantity or regard itself as a totally new physical quantity. The Lagrangian helps define a quantity called the action of the system defined as S=abLdtS=\int_a^b \mathcal{L} dt which is an integral of Lagrangian on the full path. We found all systems run to minimize the action which we called the Least action principle. As the system tries to minimize the action, we can derive the Euler-Lagrange Equation based on this setting.

Euler-Lagrange Equation

Euler-Lagrange Equation is given as follows, it gives the solution that minimizes the action S=abLdtS=\int_a^b \mathcal{L} dt. Minimizing this quantity needs some variational analysis tricks and we just give the answer as:

ddt(Lq˙)=Lq\frac{d}{d t}\left(\frac{\partial \mathcal{L}}{\partial \dot{q}}\right)=\frac{\partial \mathcal{L}}{\partial q}

This can also be interpreted with dimensional analysis. L\mathcal{L} has the unit for enery (kg m2/s2kg\ m^2/s^2) while q˙\dot{q} has the unit for velocity (m/sm/s) and qq has the unit for displacement (mm). On the left-hand side, take the derivative of energy w.r.t. q˙\dot{q}, and we get the unit of momentum (kg m/skg\ m/s). Then, take derivative w.r.t. tt, we a quantity with a unit of force (kg m/s2kg \ m/s^2). One the right handside, when L\mathcal{L} (kg m2/s2kg\ m^2/s^2) take derative w.r.t. qq (mm), we also get the unit of force (kg m/s2kg \ m/s^2).

A Spring System Example

We use a spring system as an example to show how Lagrangian mechanics implies the equation of motion by Newton’s law. Imagine a spring system where x is the position. The Kinetic energy is T=12mx˙2T=\frac{1}{2}m\dot{x}^2, potential energy V=12kx2V=\frac{1}{2}kx^2. Then, the Lagrangian can be calculated as

L=12mx˙212kx2\mathcal{L}=\frac{1}{2}m\dot{x}^2-\frac{1}{2}kx^2

We plug the Lagrange L\mathcal{L} into the Euler-Lagrange Equation, we get

ddt((12z˙212(x2)x˙)=(12x˙212(xx2)x ma net force =kxspring force  \begin{aligned} \frac{d}{d t}\left(\frac{\partial\left(\frac{1}{2} \dot{z}^2-\frac{1}{2}\left(x^2\right)\right.}{\partial \dot{x}}\right)&=\frac{\partial\left(\frac{1}{2} \dot{x}^2-\frac{1}{2}\left(x x^2\right)\right.}{\partial x} \\ & \Downarrow \\ \underbrace{\text { ma }}_{\text {net force }}&=\underbrace{-kx}_{\text {spring force }} \end{aligned}

which is the Equation of motion given by Newton’s law. Therefore, apply the Least action principle on the Lagrangian, we automatically get the Equation of motion which is the same as Newton’s law.

Why do we use complicated Lagrangian?

At the first glance, the Lagrangian is much more complicated than Newton’s law or just an analysis of energy conservation. However, it has the following advantages:

  1. Lagrangian mechanics gives an equation of motion without considering forces at all, only using energy (Newton’s law cannot do this)
  2. This is more convenient for complicated systems with multiple forces to be considered
  3. Great for dealing with multiple coordinates
  4. Can give a PDE of the system so that we can track the exact state at any time. (energy conservation cannot do this)

Hamiltonian mechanics

Lagrangian mechanics provide us with a tool to analyze systems in the phase space and this is the starting point of our analytical mechanics. However, it has some disadvantages. First, the E-L equation is a second-order PDE which is not easy to solve. Besides, the form is not easy to memorize. Can we transform it into a more easy-to-handle form?

Hamiltonian

Hamiltonian is defined as the the Legendre transformation of L\mathcal {L} which written as $$H=\dot{q}\frac{\partial \mathcal{L}}{\partial \dot{q}}-\mathcal{L}$$

Legendre transformation transforms a function L\mathcal{L} into another form expressed with derivative and the intercept, it preserves all information contained by the original function and makes the function easier to analyze. In our case, it is the sum of the kinetic energy and the potential energy, which is shown as H=T+VH=T+V. (It should be noted that the definition is not always like this in other systems). Then, the Euler-Lagrange equation which is a second-order equation for (q,q˙)(q,\dot{q}) in Rn\mathbb{R}^n(nn variables) becomes the Hamiltonian equation which is the first order equation for (p,q)(p,q) in R2n\mathbb{R}^{2n} (2n2n variables) as

dqdt=Hp,dpdt=Hq\frac{dq}{dt}=\frac{\partial H}{\partial p}, \frac{dp}{dt}=-\frac{\partial H}{\partial q}

The Hamiltonian equation has 3 advantages. First, it is only a first-order PDE which is easier to solve. Second, the form is quite a symmetry and easy to memorize with interesting intuition. The systems’ state is determined by the displacement and its momentum. By Hamiltonian, the change of momentum is determined by current displacement while the change of displacement is determined by current momentum. Finally, The Hamiltonian HH is the total energy. Therefore, the system will always run on a contour of the same energy in the phase space defined by Hamiltonian.

The spring system again

Let’s revisit the spring system example. It should be noted that the variable here is the momentum p=mx˙p=m\dot{x} and the displacement xx. We write the Hamiltonian for the above spring system as

H=12mx˙2+12kx2=12p2m+12kx2H=\frac{1}{2}m\dot{x}^2+\frac{1}{2}kx^2=\frac{1}{2}\frac{p^2}{m}+\frac{1}{2}kx^2

Then, we set

dxdt=Hpx˙=pmmx¨=dpdtdpdt=Hxdpdt=kx\begin{aligned} \frac{dx}{dt}=\frac{\partial H}{\partial p} &\Rightarrow \dot{x}=\frac{p}{m}\Rightarrow m\ddot{x}=\frac{dp}{dt}\\ \frac{dp}{dt}=-\frac{\partial H}{\partial x}&\Rightarrow \frac{dp}{dt}=-kx \end{aligned}

Combine them, we have $$ma=\frac{dp}{dt}=-kx$$
Then, we get the same equation of motion implies by Newton’s law.