What is the difference between Lagrangian and Hamiltonian?