Cyclotron Motion

Order Details;

charge moving in a magnetic field


from visual import *

set up scene for visualization

scene = display(width = 1024,height = 768, x=100, y=100, background = color.white, range=(1,1,1) )

designate visibility parameter 1 = True

arrowvis = 1


set position parameters

xmax = .5

dx = xmax/5.


set up a set of locations to represent the B field

grid = []

for x in arange(-xmax, xmax+dx, dx):

grid.append(curve(pos=[(x,0,-xmax),(x,0,xmax)], color=(.6,.6,.6)))

for z in arange(-xmax, xmax+dx, dx):



set up B field representation

B0 = vector(0,0.5,0)



bscale = (xmax/3.)/mag(B0)

for x in arange(-xmax, xmax+dx, 2*dx):

for z in arange(-xmax, xmax+dx, 2*dx):

bfield.append(arrow(pos=(x,0,z), axis=B0*bscale, color=(0,.8,.8)))


set up particle: place it inside or outside area of uniform B and designate charge

there are several cases to try:

(For example)

Outside:       pos=(0.75xmax,dx,2xmax), charge positive

Inside:        pos=(-xmax/2.,dx,xmax/2.), charge positive

Outside:       pos=(-0.75xmax, dx ,2xmax), charge negative

Inside:        pos=(xmax/2.,dx, xmax/2. ), charge negative

Outside:       pos=(xmax/2.,dx, 2xmax – 3dx), charge negative

particle = sphere(pos=(xmax/2.,dx, 2xmax – 3dx), mass = 1.7e-27, charge= -1.6e-19,

v = vector(0,1.e6,-1e7),

color=(0,0,1), radius = dx/8, make_trail=True)

initial momentum

particle.p = particle.mass*particle.v


set up an arrow to show force on the particle

farrow = arrow(pos=particle.pos, axis=(0,0,0), color=(0.6,0.6,0.6))

scale and visualize arrow

fscale = 1.e11

farrow.visible = arrowvis

set up an arrow to show velocity on the particle

varrow = arrow(pos=particle.pos, axis=(0,0,0),

scale and visualize arrow

vscale = 1e-8

varrow.visible = arrowvis


dt = (xmax/(mag(particle.p)/particle.mass))/1000.


t = 0.

dynamics loop – motion of particle through B field

constrain motion to area of interest

while particle.pos.z < xmax + 3.1*dx  and particle.pos.y < xmax:



set up B field in a specific location and nowhere else

if -xmax < particle.x < xmax and -xmax < particle.z < xmax:





caculate velocity


calculate force


calculate momentum


calculate position



update position and dimension of arrow

farrow.pos = particle.pos

farrow.axis = F*fscale

varrow.pos = particle.pos

varrow.axis = particle.v*vscale

update time


Computational Exercise 3 Worksheet: Cyclotron motion

  • What is cyclotron motion? (1pt)
  • Why does a charged particle moving in a direction perpendicular to a magnetic field move in a circle? (1pt)
  • What is the force from the magnetic field on a charged particle moving parallel to a magnetic field? What is the force on a charged stationary particle in a magnetic field? (1pt)
  • Write down the magnitude of the Lorentz force for a particle in a magnetic field. Write down the equation for the magnitude of the centripetal force. Set these two equations equal to each other, and solve for the radius. (1pt)
  • After you get the code working (you can ask your instructor for guidance), save a screenshot which includes the particle trajectory. Try changing the charge strength, particle mass, and field strength one at a time. Do these results agree with the equation you derived for the radius? Try it out and discuss what happened. Note: If the particle is much less massive, the code may stop working—decreasing the time step may help. Save a screenshot after making these changes.  (2pts)
  • What happens if the particle is initially moving in the opposite direction? (1pt)



  • Is it possible for the particle to travel such that it is undeflected? If so, explain how and change the code to show that this is possible. What did you change? Save a screenshot. (3pts)






Introduction (5-10 sentences): (6pts)

What were you simulating in this lab? What is cyclotron motion? What parameters (variables) could you change? A similar experiment was performed by J. J. Thomson in 1897 to measure the charge-to-mass ratio of the electron with incredible accuracy. Read about this experiment on your own and discuss how it relates to this lab.

Data sheets:

Worksheet + screenshots of particle trajectories (10pts—see above)

Conclusion (5-10+ sentences): (4pts)

Did the simulation agree with what you expected? What were the effects of changing the mass, velocity, and charge of the particle? What were the effects of changing the strength of the magnetic field? What are the limitations of the simulation (i.e. sources of error/differences between simulation and reality)?