Computational Science Stack Exchange is a question and answer site for scientists using computers to solve scientific problems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm interesting in numerically simulating (with my own code, not an off-the-shelf package) the motion of a single electrically charged particle in a magnetic field. The field will vary in time and space but probably not fast compared to the cyclotron frequency or the Larmor radius.

There are many well known methods for integrating equations of motion for particles in fields. But the force due to the magnetic field has some special properties such as not changing the kinetic energy of the particle. Are there some numerical procedures that are better adapted to this special case eg. that will give a more accurate simulation and better conserve adiabatic invariants (when they should be conserved)?

share|improve this question

migrated from Feb 26 '13 at 0:05

This question came from our site for active researchers, academics and students of physics.

Hi sigfpe, and welcome to Scicomp! Do you have a specific set of equations that you're working with? If so, could you include them in your question or perhaps a link to the equations? – Paul Feb 26 '13 at 4:38
up vote 4 down vote accepted

I believe what you are looking for is a sympletic method; see:

They are designed to conserve energy exactly; however by trading up for accuracy one area, your simulation will have greater errors in other quantities (i.e. position as a function of time) compared to your usual Runge-Kutta methods.

share|improve this answer
Looking it some of the references to that wikipedia page I see that this is exactly what I'm after. – sigfpe Feb 26 '13 at 15:28
@jeffdk I got curious about what said "have greater errors in position as a function of time". Could you point me to an example? – Hui Zhang Apr 11 '13 at 17:24

Further research eventually yielded the Boris method. For a constant B field it produces stable circular orbits.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.