## Magnetic Field Deflection

### Activity Information

#### Learning Goals

• Understanding the relationship between force and motion
• Calculating cross products
• Ask questions about data to determine the factors that affect the strength of electric and magnetic forces ( MS-PS2-3)

#### Prior Knowledge Required

• Lorentz force
• $F=qE+qv \times B$
• Vector manipulation
• Graphing data points

#### Code Manipulation

• Copying/pasting code
• Modifying existing code
• Using while loops
• Translating physical quantities and equations into code

—-

### Activity

#### Handout

Magnetic Field Deflection

In this activity you will be simulating the effect of a charged particle moving perpendicularly through a uniform magnetic field. The starter code assumes a positive particle moving to the right (+x direction) moving through a magnetic field oriented out of the screen (+z direction). Load the provided code (below) into your GlowScript workspace.

Run the code. The red particle passes straight through the region defining the magnetic field without deflection. Your task is to add to the existing code so that the program will simulate the motion of the particle as it experiences the effect of the magnetic force. Use the provided charge, mass, velocity, and field strength values as you add the necessary lines of code to accurately simulate the deflection effect.

Once the code is working properly, answer the following questions. Be sure to take note of the initial values for charge, mass, velocity, and field strength (assume standard SI units):

1. Increase the initial speed of the charged particle. What effect does this have on the radius of the curved path compared to the original path?
2. Reset the speed to the initial conditions. Now, increase the magnitude of the charge of the particle. What effect does this have on the radius of the curved path compared to the original path?
3. Reset the charge to the initial conditions. Now, increase the mass of the particle. What effect does this have on the radius of the curved path compared to the original path?
4. Reset the mass to the initial conditions. Now, increase the magnetic field strength. What effect does this have on the radius of the curved path compared to the original path?
5. Based on your observations, describe the relationship between the radius of curvature and:
1. speed
2. charge
3. mass
4. field strength
6. Make the charge of the particle negative and run the code. What happened?
7. What effect does the influence of the magnetic field have on the particle velocity? How can you check this with the program code?

#### Code

GlowScript 2.8 VPython scene.width = 824scene.height = 568 #consider the charge to be positive and the magnetic field to be in the positive z direction--out of the screen.field = box(pos=vector(0,0,0), size=vector(200,200,10), axis=vector(1,0,0), color=color.white, opacity=0.3)charge = sphere(pos=vector(-150,90,0), radius=2, color=color.red, make_trail=True)qval = 2E-4vcharge = vector(5,0,0)mass = 0.1mom = mass*vchargeB = vector (0,0,30.0) dt = .1 while charge.pos.y > 0:  rate(120)  charge.pos = charge.pos + vcharge*dt

#### Handout

1. Increasing the initial speed of the charged particle results in a curved path with a larger radius,
2. Increasing the magnitude of the charge of the particle results in a curved path with a smaller radius,
3. Increasing the mass of the charged particle results in a curved path with a larger radius,
4. Increasing the strength of the magnetic field results in a curved path with a smaller radius
5. The relationship between the radius of curvature and:
1. speed: positive
2. charge: negative (inverse)
3. mass: positive
4. field strength: negative (inverse)
6. If you make the charge of the particle negative, than the radius of the path stay the same, but the direction changes; instead of curving downward (in the -y direction) the particle's path curves upwards (in the +y direction)
7. Generally, the stronger the magnetic field, the higher the magnitude of the particle velocity. You can check this by using the “print” command to display the magnitude of the particle's velocity at the end of the program (line 29)

#### Code

GlowScript 2.8 VPython scene.width = 824scene.height = 568 #consider the charge to be positive and the magnetic field to be in the positive z direction--out of the screen.field = box(pos=vector(0,0,0), size=vector(200,200,10), axis=vector(1,0,0), color=color.white, opacity=0.3)charge = sphere(pos=vector(-150,90,0), radius=2, color=color.red, make_trail=True) qval = 2E-4vcharge = vector(5,0,0)mass = 0.1mom = mass*vchargeB = vector (0,0,30.0) dt = .1 while charge.pos.y > -150 and charge.pos.x >= -150:  rate(120)  if charge.pos.x < -100:      charge.pos = charge.pos + vcharge*dt  else:    if charge.pos.x < 100 and charge.pos.y > -100:      force = qval*cross(vcharge,B)      mom = mom + force*dt      charge.pos = charge.pos +mom/mass*dt      vcharge = mom/mass    else:      	charge.pos = charge.pos + vcharge*dt print(mag(vcharge))