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 [2020/09/08 19:13]
porcaro1 [Activity]
repository:magnetic_field_deflection [2021/04/07 23:06] (current)
porcaro1 [Activity]
Line 18: Line 18:
 ====Activity==== ====Activity====
 ===Handout=== ===Handout===
-** Magnetic Field Deflection **  
  
 {{ :​repository:​magnetic_field_deflection.png?​nolink&​600|}} {{ :​repository:​magnetic_field_deflection.png?​nolink&​600|}}
-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. ​+ 
 +** 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. ​ 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 38: Line 40:
   - What effect does the influence of the magnetic field have on the particle velocity? How can you check this with the program code?   - What effect does the influence of the magnetic field have on the particle velocity? How can you check this with the program code?
 ===Code=== ===Code===
-[[https://​www.glowscript.org/#/​user/​plough/folder/StarterCode/program/MagFieldDeflectionStart ​| Link]]+[[https://​www.glowscript.org/#/​user/​porcaro1/folder/RepositoryPrograms/program/MagneticFieldDeflection-Incomplete ​| Link]]
 <code Python [enable_line_numbers="​true"​]>​ <code Python [enable_line_numbers="​true"​]>​
 GlowScript 2.8 VPython GlowScript 2.8 VPython
Line 63: 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 ma,​gnitude ​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,
   - Increasing the mass of the charged particle results in a curved path with a larger radius,   - Increasing the mass of the charged particle results in a curved path with a larger radius,
   - Increasing the strength of the magnetic field results in a curved path with a smaller radius   - Increasing the strength of the magnetic field results in a curved path with a smaller radius
Line 75: 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_li,​ne_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 = 800+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)
  
-#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
 +vcharge = vector(5,​0,​0)
 mass = 0.1 mass = 0.1
-vcharge = vector(5,​0,​0) 
 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 98: 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 111: Line 116:
 ---- ----
 ====See Also==== ====See Also====
-  *+  *[[forces_on_current_carrying_wire | Forces on Current Carrying Wire]]
   ​   ​
  • repository/magnetic_field_deflection.1599592388.txt.gz
  • Last modified: 2020/09/08 19:13
  • by porcaro1