Hamiltonova mehanika