# PDE from Hamiltonian density

For the wave equation Hamiltonian density is $$2H=\phi_t^2+\phi_x^2$$ while the Lagrangian density is $$2L=\phi_t^2-\phi_x^2$$. I can easily compute the pde from the Lagrangian density but how does one do it from Hamiltonian density?

• By using Hamilton's equations. Commented Jul 17, 2019 at 5:20

You need to write the Hamiltonian as a function of $$\phi,\,\phi_x,\,\pi:=\frac{\partial L}{\partial\phi_t}=\phi_t$$ but not $$\phi_t$$ before you can obtain Hamilton's equations. Since $$H=\frac12\left(\pi^2+\phi_x^2\right)$$, $$\phi_t=\frac{\partial H}{\partial\pi}=\pi$$ while $$\pi_t=-\frac{\partial H}{\partial\phi}+\partial_x\frac{\partial H}{\partial\phi_x}=\phi_{xx}$$. We can combine these to give $$\phi_{tt}=\phi_{xx}$$, the same equation obtainable from the Lagrangian.
• @bentenyson You can only use a Hamiltonian once you've written it in terms of $\pi$ instead of $\phi_t$ (although $\phi_x$ is allowed), so you do need to know enough about the Lagrangian to write your Hamiltonian in terms of $\pi$. You do not, however, have to obtain the Euler-Lagrange equation from the Lagrangian; you can use the Hamiltonian instead, but they will agree.