Hamiltonian in terms of Lagrangian is H=p⋅x−L, where p=∂x˙∂L=2x˙. H is a function of p,x.
Hence, H=2x˙⋅x˙−x˙2+ω2x2=x˙2+ω2x2=4p2+ω2x2.
Hamiltonian equations are x˙=∂p∂H, p˙=−∂x∂H.
Using Hamilton above: x˙=2p, p˙=−2ω2x.
Substituting p=2x˙ from the first equation into the second, obtain 2x¨=−2ω2x, or x¨+ω2x=0, which is the equation of motion of harmonic oscillator.
Comments