# Testing Second-Order Integrators for Motion of a Charge in a Homogeneous Magnetic Field

Requires a Wolfram Notebook System

Interact on desktop, mobile and cloud with the free Wolfram Player or other Wolfram Language products.

Consider the nonrelativistic motion of a point charge in a plane that cuts a homogeneous magnetic field perpendicularly. Two properties of this system are of interest in this context. First, the exact solution is simple: a circular orbit through which the particle moves with constant angular velocity. Second, the force term depends on the velocity (and only on the velocity, independent of time and position). This Demonstration lets you see the deviations from the exact solution for various time-stepping algorithms ("methods") in various formats ("modes").

[more]
Contributed by: Ulrich Mutze (June 2016)

Open content licensed under CC BY-NC-SA

## Snapshots

## Details

Snapshot 1: the Runge–Kutta method gives an orbit that spirals out to infinity

Snapshot 2: The averaged leapfrog method gives an orbit that spirals towards the origin. It deviates from the exact orbit (shown in green) considerably slower than in the Runge–Kutta case.

Snapshot 3: the non-averaged leapfrog method gives orbits that always stay close to the exact one

Snapshot 4 and 5: The tiny radial error varies in a characteristically different way with time for the ALF and DALF methods. It scales with so that halving the time step divides the error by 16.

Snapshots 5 and 6: ADALF and Runge–Kutta show a radial error that scales with . For Runge–Kutta, the error is about a factor of four larger than for ADALF. Notice that the sign of the error is different in the two cases.

Snapshot 7: The phase error scales in all cases with and always grows linearly with time. So even for very short time steps, the computed position and the exact position eventually run out of phase.

The integrators under consideration are formulated for an ODE of the general form , where the number of vector components of only appears in the initial values for and ; the linear algebra used to formulate the integration step is dimension generic in the Wolfram Language. In the simple case actually treated, is independent of and and is of the form . The asynchronous leapfrog integrators under consideration are described in [1].

Reference

[1] U. Mutze, "An Asynchronous Leapfrog Method II." arxiv.org/abs/1311.6602.

## Permanent Citation