The resolvent and Hamiltonian systems