Solution (source code)

= Solution

The canonical momentum is
$$
\frac{\partial L}{\partial\dot{\mathbf r}}=m\dot{\mathbf r}+q\mathbf A.
$$
In components, the <Euler-Lagrange equation> is
$$
m\ddot r_i+q\left(\partial_tA_i+\dot r_j\partial_jA_i\right)
=q\left(-\partial_i\phi+\dot r_j\partial_iA_j\right).
$$
Thus
$$
m\ddot r_i=q\left[-\partial_i\phi-\partial_tA_i
+\dot r_j(\partial_iA_j-\partial_jA_i)\right].
$$
The last term is the $i$th component of $\mathbf v\times(\nabla\times\mathbf A)$, so
$$
\boxed{m\ddot{\mathbf r}=q(\mathbf E+\mathbf v\times\mathbf B),}
$$
the <Lorentz force law>.