# Chapter 13 - Charged Particles in Electric and Magnetic Fields¶

## Example 1 - pg 434¶

In :
#pg 434
#calculate the x,t
#Given :
import scipy.integrate
# E = 2*10^9*t  V/m
# a_x = 3.52*10^20*t m/s^2
# v_x = integral of a_x dt
#(a)
#calculations and results
def f(t):
a_x = 3.530*10**20*t
return a_x

v_x = scipy.integrate.quad(f,0,50*10**-9); # electron speed in m/s at time = 50 ns
print "v_x =",round(v_x*10**-5,1),"x 10^5 m/s"
#(b)
#v_x = 1.76*10^20*t^2 m/s
def v(t):
vx=1.76*10**20*t**2
return vx

x =scipy.integrate.quad(v,0,50*10**-9);# distance covered in m  in 50 ns
print "x =",round(x*10**3,2),"mm"
#(c)
#x = 5.87*10^19*t^3 m
X = 5*10**-2; #distance between plates in m
t = (X/(5.87*10**19))**(1./3); # time required in s
print "t =",round(t*10**7,2),"x 10^-7 s"

v_x = 4.4 x 10^5 m/s
x = 7.33 mm
t = 0.95 x 10^-7 s


## Example 5 - pg 445¶

In :
#pg 445
#calculate the z-max, T and H
import math
#Given :
u = 5*10**5; #horizontal velocity in m/s
alpha = 35/57.3; # in radians
E = 200 ;# Electric field in V/m
e = 1.6*10**-19; # electron charge in C
m = 9.12*10**-31; # electron mass in kg
#calculations
a = (-e*E)/m; # horizontal range in m/s**2
#(a);
z_max = (-(u**2)*(math.sin(alpha))**2)/(2*a); # maximum penetration in m
#(b)
T = (-2*u*math.sin(alpha))/a; # Time of flight in s
#(c)
H = (-(u**2)*(math.sin(2*alpha)))/a; # horizontal range in m
#results
print "z_max (mm) = ",round(z_max*10**3,1)
print "T =",round(T*10**8,2),"x 10^-8 s "
print "H =",round(H*1000.,1),"mm"

z_max (mm) =  1.2
T = 1.63 x 10^-8 s
H = 6.7 mm


## Example 7 - pg 448¶

In :
#pg 448
#calculate the values of B,T and P
#Given :
import math
m = 9.12*10**-31;# electron mass in kg
e = 1.6*10**-19;# electron charge in C
u = 5*10**7; # electron speed in m/s
alpha = 30/57.3; # angle in radians
d = 0.5; # diameter in m
#calculations
#(a)
r = d/2; # radius in m
B = (m*u*math.sin(alpha))/(r*e); # magnetic flux density in Wb/m**2
#(b)
T = (2*math.pi*m)/(B*e);# time in s
#(c)
p = T*u*math.cos(alpha); # pitch in m
#results
print "B =",round(B*1000.,2),"x 10^-3 Wb/m**2"
print "T =",round(T*10**8,2),"x 10^-8 s"
print "p (m) = ",round(p,2)

B = 0.57 x 10^-3 Wb/m**2
T = 6.28 x 10^-8 s
p (m) =  2.72


## Example 9 - pg 449¶

In :
#pg 449
#calculate the value of T
import math
#Given :
m = 9.109*10**-31;# eletcron mass in kg
e = 1.6*10**-19; # electron charge in C
#calculations
#T = (2*pi*m)/(B*e) , here B is not given
T = (2*math.pi*m)/e;# time in s
#results
print "T =",round(T*10**11,2),"x 10^-11 / B "

T = 3.58 x 10^-11 / B


## Example 11 - pg 455¶

In :
#pg 455
#calculate the angle required
#Given :
import math
V1 = 250.; # potential in V
V2 = 500.;# potential in V
theta1 = 45.;# angle in degrees
#Law of electron refraction = sin(theta1)/sin(theta2)  = (V2/V1)^0.5
#calculations
theta2 = math.asin(((V1/V2)**(1./2))*math.sin(45/57.3))*57.3;
#results
print "theta2 (degrees) = ",round(theta2,0)

theta2 (degrees) =  30.0


## Example 12 - pg 463¶

In :
#pg 463
#calculate the difference of S2_S1
#Given :
M1 = 20.; # neon isotope mass in amu
M2 = 22.;#neon isotope mass in amu
E = 7*10**4; # Electric field in V/m
e = 1.6*10**-19;# electron charge in C
B = 0.5;# Magnetic field in Wb/m**2
B1 = 0.75; # Magnetic field in Wb/m**2
# Linear seperation = S2 - S1  = (2*E*(M2-M1))/(B*B1*e)
# 1 amu = 1.66*10**-27 kg
#calculations
S2_S1 =  (2*E*(M2-M1)*1.66*10**-27)/(B*B1*e) ; # linear seperation in m
#results
print "S2-S1 (mm) = ",round(S2_S1*10**3,0)

S2-S1 (mm) =  8.0


## Example 13 - pg 466¶

In :
#pg 466
#calculate the values of B,f and t
import math
#Given:
m = 2.01*1.66*10**-27; # deuteron mass in kg
q = 1.6*10**-19; # deuteron charge in C
#We know , 1/2(m*v**2) = q*V
#for a 5 MeV deuteron
#calculations
# 1 MeV = 10**6*1.6*10**-19 J
v =((2*5*10**6*1.6*10**-19)/m)**(1./2) ; # velocity in m/s
#(a)
R = 15; # inches
#1 inch = 2.54*10**-2 m
B = (m*v)/(q*R*2.54*10**-2);# magnetic field intensity in Wb/m**2
#(b)
f = (q*B)/(2*math.pi*m); # frequency in Hz
#(c)
t = 50/f; # time in s
#results
print "B (Wb/m^2) = ",round(B,1)
print "f (MHz) = ",round(f*10**-6,2)
print "t (mu s) =  ",round(t*10**6,2)

B (Wb/m^2) =  1.2
f (MHz) =  9.15
t (mu s) =   5.47