Hamiltonian and Lagrangian Dynamics