Solution (source code)

= Solution

Choose electric scalar potential $\Phi=-Ex$ and the <symmetric gauge> $\mathbf A=B(-y,x,0)/2$, whose curl is $B\hat{\mathbf z}$. <Minimal coupling> gives $L=m\dot{\mathbf r}^{\,2}/2-k\mathbf r^2/2+q\mathbf A\cdot\dot{\mathbf r}-q\Phi$. Since $x=\rho\cos\theta$ and $x\dot y-y\dot x=\rho^2\dot\theta$,
$$
\boxed{L=\frac m2(\dot\rho^2+\rho^2\dot\theta^2)-\frac k2\rho^2
+qE\rho\cos\theta+\frac{qB}{2}\rho^2\dot\theta.}
$$
The magnetic term is <velocity> dependent; it is not an ordinary position-only potential.