Solution (source code)

= Solution

$m\ddot x=-\nabla V$. Dotting with $\dot x$ gives $d(\tfrac12m|\dot x|^2+V)/dt=0$.