Hamiltonian and Lagrangian Mechanics