= Solution
The <canonical momenta> are
$$
p_r=m\dot r,\qquad p_\phi=mr^2\dot\phi+\frac{qBr^2}{2}.
$$
The <Legendre transform> cancels the velocity-linear magnetic term, giving the energy expressed in velocities,
$$
\boxed{H=\frac m2\dot r^2+\frac{mr^2}{2}\dot\phi^2+2\pi^2k(r-r_0)^2.}
$$
But <Hamilton's equations> differentiate with respect to canonical coordinates and momenta, not velocities. In its proper <canonical variables> the same <Hamiltonian> is
$$
\boxed{H(r,\phi,p_r,p_\phi)
=\frac{p_r^2}{2m}+
\frac{(p_\phi-qBr^2/2)^2}{2mr^2}
+2\pi^2k(r-r_0)^2.}
$$
It explicitly contains $B$ because canonical <angular momentum> differs from mechanical <angular momentum>. This reconciles magnetic forces with the absence of magnetic work: the <magnetic field> can exchange radial and tangential motion without changing the total <mechanical energy>.
Back to article page