Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
repository:magnetic_field_deflection [2021/04/07 22:50]
porcaro1 [Answer Key]
repository:magnetic_field_deflection [2021/04/07 23:06] (current)
porcaro1 [Activity]
Line 21: Line 21:
 {{ :​repository:​magnetic_field_deflection.png?​nolink&​600|}} {{ :​repository:​magnetic_field_deflection.png?​nolink&​600|}}
  
-** Magnetic Field Deflection **  +** 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 [[https://​www.glowscript.org/#/​user/​plough/​folder/​StarterCode/​program/​MagFieldDeflectionStart | provided code]] into your GlowScript workspace. ​+  
 +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. ​ 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. ​
Line 64: Line 65:
 ====Answer Key==== ====Answer Key====
 ===Handout=== ===Handout===
 +{{ :​repository:​magfielddeflect.png?​nolink&​600|}}
   - Increasing the initial speed of the charged particle results in a curved path with a larger radius,   - Increasing the initial speed of the charged particle results in a curved path with a larger radius,
   - Increasing the magnitude of the charge of the particle results in a curved path with a smaller radius,   - Increasing the magnitude of the charge of the particle results in a curved path with a smaller radius,
Line 76: Line 78:
   - 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)   - 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=== ===Code===
-[[https://docs.google.com/document/d/1oXPrv5-9olHCEXH1vM_wdHTbkySdZpx4CsvvI_hQGc8/edit | Link]] +[[https://www.glowscript.org/#/user/porcaro1/folder/​RepositoryPrograms/​program/​MagneticFieldDeflection-Solution ​| Link]] 
-<code Python [enable_line_numbers="​true",​ highlight_lines_extra="​16,18,​19,​20,​21,​22,​23,​24,​25,​26,​27,​29"​]>​+<code Python [enable_line_numbers="​true",​ highlight_lines_extra="​18,​19,​20,​21,​22,​23,​24,​25,​26,​27,​29,31"]>
 GlowScript 2.8 VPython GlowScript 2.8 VPython
 + 
 +scene.width = 824
 +scene.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)
  
-scene.width = 800 
- 
-#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(-149,​90,​0),​ radius=2, color=color.red,​ make_trail=True) 
 qval = 2E-4 qval = 2E-4
-mass = 0.1 
 vcharge = vector(5,​0,​0) vcharge = vector(5,​0,​0)
 +mass = 0.1
 mom = mass*vcharge mom = mass*vcharge
-B = vector(0,​0,​30.0) +B = vector (0,​0,​30.0) 
 + 
 dt = .1 dt = .1
- +  
-while charge.pos.y > -150 and charge.pos.x > -150:+while charge.pos.y > -150 and charge.pos.x >-150:
   rate(120)   rate(120)
   if charge.pos.x < -100:   if charge.pos.x < -100:
Line 99: Line 103:
   else:   else:
     if charge.pos.x < 100 and charge.pos.y > -100:     if charge.pos.x < 100 and charge.pos.y > -100:
-      force = qval*cross(vcharge,​B) +      ​force = qval*cross(vcharge,​B) 
-       mom = mom + force*dt +      mom = mom + force*dt 
-       charge.pos = charge.pos +mom/​mass*dt +      charge.pos = charge.pos +mom/​mass*dt 
-       vcharge = mom/mass+      vcharge = mom/mass
     else:     else:
       charge.pos = charge.pos + vcharge*dt       charge.pos = charge.pos + vcharge*dt
-      ​+ 
 print(mag(vcharge))</​code>​ print(mag(vcharge))</​code>​
  
Line 112: Line 116:
 ---- ----
 ====See Also==== ====See Also====
-  *+  *[[forces_on_current_carrying_wire | Forces on Current Carrying Wire]]
   ​   ​
  • repository/magnetic_field_deflection.1617835819.txt.gz
  • Last modified: 2021/04/07 22:50
  • by porcaro1