Download ModelDownload Sourceembed


Intro Page

The Wien (E x B) Filter

Developed by E. Behringer

This set of exercises guides the students to compute and analyze the behavior of a charged particle in a spatial region with mutually perpendicular electric and magnetic fields. It requires the student to determine the Cartesian components of hte forces acting on the particle and to obtain the corresponding equations of motion. The solutions to these equations are obtained through numerical integation, and the capstone exercise is the simulation of the E×B (Wien) filter.

Subject Area Electricity & Magnetism
Levels First Year and Beyond the First Year
Available Implementation Python
Learning Objectives

Students who complete this set of exercises will be able to:

  • generate equations predicting the Cartesian components of force acting on the charged particle and generate the equations of motion for the particle (Exercise 1);
  • calculate particle trajectories by solving the equations of motion (Exercise 2);
  • produce two-dimensional and three-dimensional plots of the trajectories (Exercise 2); and
  • simulate the operation of an E×B (Wien) filter (Exercise 3) and determine the range of particle velocities transmitted by the filter, and how these are affected by the geometry of the filter (Exercise 4).
Time to Complete 120 min
Exercise 1


Imagine that we have a particle of mass m, charge q, and velocity v=(vx,vy,vz) with vz>>vx,vyentering a region of uniform magnetic field B=Bxx^ and uniform electric field E=Eyy^. As shown below, Bx>0 and Ey<0. The length of the field region along the z-axis is L.

Neglecting any other forces (e.g., gravitational forces), show that the Cartesian components of the combined electric and magnetic forces are


resulting in the equations of motion


where the dot accents indicate differentiation with respect to time. Note that the particle will not experience any transverse acceleration if vz=vpass=Ey/Bx.

(a) Assume that Ey=105 V/m and Bx=2.00×103 T, and that all other field components are zero. Calculate, by hand, the Cartesian components of the acceleration at the instant when a Li+ ion of mass 7 amu and kinetic energy 100 eV enters the field region traveling along the direction u^=(x^+y^+100z^)/10002.

How will these acceleration components compare to those for a doubly ionized nitrogen ion (N+)?

(b) Write a code to perform the calculation in part (a). Note that, as soon as the particle enters the field region, the velocity components will change, and therefore so will the forces. To calculate an accurate trajectory, it is necessary to repeatedly calculate the forces, a task for which the computer is very well suited.

(c) What do you expect the trajectory of this ion to look like as it traverses the field region? Explain your answer. with Bug Fix




# This file is used to calculate

# the Cartesian components of the acceleration of

# a charged particle through

# an E x B velocity filter.


# Here, it is assumed that the axis of the filter

# is aligned with the z-axis, that the magnetic field

# is along the +x-direction, and that the electric field

# is along the -y-direction.


# By:

# Ernest R. Behringer

# Department of Physics and Astronomy

# Eastern Michigan University

# Ypsilanti, MI 48197

# (734) 487-8799 (Office)

# This email address is being protected from spambots. You need JavaScript enabled to view it.


# Last updated:


# 20110309 = March 9, 2011 ERB Initial writing in Matlab.

# 20160616 ERB conversion from Matlab.


from numpy import sqrt

import time


# Initialize parameter values


q = 1.60e-19 # particle charge [C]

m = 7.0*1.67e-27 # particle mass [kg]

KE_eV = 100.0 # particle kinetic energy [eV]

Ex = 0.0 # Ex = electric field in the +x direction [N/C]

Ey = -105.0 # Ey = electric field in the +y direction [N/C]

Ez = 0.0 # Ez = electric field in the +z direction [N/C]

Bx = 0.002 # Bx = magnetic field in the +x direction [T]

By = 0.0 # By = magnetic field in the +x direction [T]

Bz = 0.0 # Bz = magnetic field in the +x direction [T]

D = 2.0 # D = diameter of the exit aperture [mm]

L = 0.25 # L = length of the crossed field region [mm]

u = [1.0,1.0,100.0]/sqrt(10002.0) # direction of the velocity vector

# Derived quantities

qoverm = q/m # charge to mass ratio [C/kg]

KE = KE_eV*1.602e-19 # particle kinetic energy [J]

vmag = sqrt(2.0*KE/m) # particle velocity magnitude [m/s]

v1x = vmag*u[0] # v1x = x-component of the initial velocity [m/s]

v1y = vmag*u[1] # v1y = y-component of the initial velocity [m/s]

v1z = vmag*u[2] # v1z = z-component of the initial velocity [m/s]


# Calculate the Cartesian components of the acceleration


a_x = qoverm*(Ex + v1y*Bz - v1z*By)

a_y = qoverm*(Ey + v1z*Bx - v1x*Bz)

a_z = qoverm*(Ez + v1x*By - v1y*Bx)

print ("The magnitude of the initial velocity is %.3e"%vmag," m/s.") ##Frem:Added brackets

print ("The x-component of the acceleration is %.3e"%a_x," m/s\(^2\).") #Frem:Added brackets

print ("The y-component of the acceleration is %.3e"%a_y," m/s\(^2\).") #Frem:Added brackets

print ("The z-component of the acceleration is %.3e"%a_z," m/s\(^2\).") #Frem:Added brackets

time.sleep(10)##Frem:Added Time to prevent the program from closing too fast



Code Language Translator Run

Software Requirements


Android iOS Windows MacOS
with best with Chrome Chrome Chrome Chrome
support full-screen? Yes. Chrome/Opera No. Firefox/ Samsung Internet Not yet Yes Yes
cannot work on some mobile browser that don't understand JavaScript such as.....
cannot work on Internet Explorer 9 and below



Fremont Teng; Loo Kang Wee; based on codes by E. Behringer

end faq

Sample Learning Goals


For Teachers








Other Resources


end faq

1 1 1 1 1 1 1 1 1 1 Rating 0.00 (0 Votes)