Q_i=-\frac{\partial U}{\partial q_i}=-\frac{\partial H}{\partial q_i}