A charged particle of mass $m$ and charge $q$ moving with a velocity $\boldsymbol{v}$ in an an electric field $\boldsymbol{E}$ and a magnetic field $\boldsymbol{B}$ is subject to a Lorentz force, $\boldsymbol{F}$, given by
$$
\boldsymbol{F} = q(\boldsymbol{E} + \boldsymbol{v}\times\boldsymbol{B}).
$$
The equation of motion for a single particle is therefore given by Newton's second law as
$$
\boldsymbol{\ddot{r}} = \frac{q}{m}(\boldsymbol{E} + \boldsymbol{v}\times\boldsymbol{B}).
$$
Here we will consider a uniform magnetic field, $\boldsymbol{B} = (0,0,B)$ and zero electric field, $E=0$. In this case, the trajectory of the particle can be obtained by solving the equation of motion analytically, but here we integrate it numerically using SciPy's `integrate.odeint`

method. Assuming the particle starts off with non-zero components of its velocity parallel ($v_\parallel$) and perpendicular ($v_\perp$) to the magnetic field, it moves in a *helix*, with radius given by
$$
\rho = \frac{mv_\perp}{|q|B},
$$
known as the *Larmor* or *cyclotron* radius (or gyroradius).

With the numerical approach the code is straightforward, and given in a Jupyter Notebook which is also hosted on my Github page. The motion of an electron and an ion are represented qualitatively: because the mass ratio between these particles is at least $\mu = m_e/m_p = 1836$, we compare only particles differing in mass by a factor of 3. Matplotlib's `animation.FuncAnimation`

method is used to produce an animated movie of the motion.

## Comments

## AndrewL 2 months, 1 week ago

Greate job, thanks a lot!

Link | Reply## New Comment