[Physics] Hamiltonian mechanics really useful for numerical integration? Lagrange equations can become 1st-order by introducing extra variables

computational physicshamiltonian-formalismlagrangian-formalism

(I'm talking about the classical mechanics.)

Many texts say that Lagrange equations are difficult to treat numerically because they are second-order ODEs, ${f_i(\boldsymbol{q, \dot{q}, \ddot{q}}}) = 0$, and Hamilton equations are (at least computationally) great because they are first-order, or their forms are essentially ${\dot{p_i}=g_i(\boldsymbol{p, q})}$ and $\dot{q_i}=h_i(\boldsymbol{p, q})$.

I wonder if this statement is really valid? We can easily convert the Lagrange equations to first-order by, as a common technique, defining the new independent variables $v_i:=\dot{q_i}$.

Right, then we have to first solve the Lagrange equations for $\ddot{q_i}$ algebraically so that the equation can become $\dot{q_i}=v_i$ and $\dot{v_i}=(solved\ as\ \ddot{q_i})$. People say this is difficult and thus Hamilton's formalism is awesome.

However, in the process of Legendre transformation from Lagrangian $L$ to Hamiltonian $H$, we have to determine $\dot{q}$ as $\dot{q}(\boldsymbol{p, q})$ by algebraically solving the definitions
$$
p_i=\frac{\partial L}{\partial \dot{q_i}}
$$

which is a system of equations.

So, in the both cases, we have to solve a set of algebraic equations anyway.

Is the latter solving process actually easier than the former in general? If there is, please give me an example where we can't use the former (Lagrange) but can use the latter (Hamilton) to make it first-order.

Best Answer

Comments to the question (v8) concerning numerical integration:

  1. On one hand, to solve a Hamiltonian system numerically, there exist the numerical integration schemes of symplectic integrators (SI), where each (finite) numerical iteration step is a canonical transformation/symplectomorphism, which preserves certain properties, such as, e.g., energy, and which makes SIs suitable to solve long-term evolution problems numerically.

  2. On the other hand, transforming a 2nd-order coupled ODE system $$\ddot{q}^i~=~f^i(q,\dot{q},t)\tag{1}$$ into a 1st-order coupled ODE system $$\dot{v}^i~=~f^i(q,v,t), \qquad \dot{q}^i~=~v^i,\tag{2}$$ does not necessarily bring it on Hamiltonian form$^1$.

--

$^1$ If the Lagrangian is of the form $L(q,v,t)=\frac{1}{2}mv^2-V(q,t)$ so that momentum $p=mv$ is proportional to velocity, then the 1st-order system (2) is on Hamiltonian form. See also e.g. this Wikipedia page.

Related Question