This preview shows pages 1–2. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.View Full Document
Unformatted text preview: d scene.autoscale=0 #Turns off autoscaling. Set to 1 to turn it back on. s ## Loop # while proton.x<5e-10: rate(10) # For each magnetic field vector: # 1. Calculate r and rhat r1 = barrow1.pos - proton.pos rmag1 = mag(r1) rhat1 = r1/rmag1 r2 = barrow2.pos - proton.pos rmag2 = mag(r2) rhat2 = r2/rmag2 r3 = barrow3.pos - proton.pos rmag3 = mag(r3) rhat3 = r3/rmag3 r4 = barrow4.pos - proton.pos rmag4 = mag(r4) rhat4 = r4/rmag4 # 2. Calculate the magnetic field vector B1 = mofp*(q*cross(velocity, rhat1))/rmag1**2 B2 = mofp*(q*cross(velocity, rhat2))/rmag2**2 B3 = mofp*(q*cross(velocity, rhat3))/rmag3**2 B4 = mofp*(q*cross(velocity, rhat4))/rmag4**2 # 3. Calculate the new axis of the arrow. Scale it appropriately. barrow1.axis = B1*bscale barrow2.axis = B2*bscale barrow3.axis = B3*bscale barrow4.axis = B4*bscale # Update the proton's position proton.pos = proton.pos + velocity*deltat...
View Full Document
This note was uploaded on 09/12/2011 for the course PHYISCS 2212 taught by Professor Shatz during the Spring '10 term at Georgia Institute of Technology.
- Spring '10