##Example 4.1
##Calculation of acceleration,time taken,distance covered and kinetic energy of an accelerating proton
##given values
m=1.67 *10**-27;##mass of proton in kg
q=1.602 *10**-19;##charge of proton in Coulomb
v1=0;##initial velocity in m/s
v2=2.5*10**6;##final velocity in m/s
E=500.;##electric field strength in V/m
##calculation
a=E*q/m;##acceleration
print'%s %.1f %s'%('acceleration of proton in (m/s^2) is:',a,'');
t=v2/a;##time
print'%s %.5f %s'%('time(in s) taken by proton to reach the final velocity is:',t,'');
x=a*t**2./2.;##distance
print'%s %.1f %s'%('distance (in m)covered by proton in this time is:',x,'');
KE=E*q*x;##kinetic energy
print'%s %.3e %s'%('kinetic energy(in J) at the time is:',KE,'');
import math
##Example 4.2
##electrostatic deflection
##given values
pi=3.141
V1=2000.;##in volts,potential difference through which electron beam is accelerated
l=.04;##length of rectangular plates
d=.015;##distance between plates
V=50.;##potential difference between plates
##calculations
alpha=math.atan(l*V/(2.*d*V1))*(180./pi);##in degrees
print'%s %.1f %s'%('angle of deflection of electron beam is:',alpha,'')
v=5.93*(10**5)*math.sqrt(V1);##horizontal velocity in m/s
t=l/v;##in s
print'%s %.3e %s'%('transit time through electric field is:',t,'')
import math
##Example 4.3
##electron projected at an angle into a uniform electric field
##given values
v1=4.5*10**5;##initial speed in m/s
alpha=37*math.pi/180.;##angle of projection in degrees
E=200.;##electric field intensity in N/C
e=1.6*10**-19;##in C
m=9.1*10**-31;##in kg
a=e*E/m;##acceleration in m/s**2
t=2*v1*math.sin(alpha)/a;##time in s
print'%s %.2e %s'%('time taken by electron to return to its initial level is:',t,'')
H=(v1**2.*math.sin(alpha)*math.sin(alpha))/(2.*a);##height in m
print'%s %.4f %s'%('maximum height reached by electron is:',H,'')
s=(v1**2.)*(2.*math.sin(alpha)*math.cos(alpha))/(2.*a);##print'%s %.1f %s'%lacement in m
print'%s %.4f %s'%('horizontal displacement(in m)when it reaches maximum height is:',s,'')
import math
##Example 4.4
##motion of an electron in a uniform magnetic field
##given values
V=200.;##potential difference through which electron is accelerated in volts
B=0.01;##magnetic field in wb/m**2
e=1.6*10**-19;##in C
m=9.1*10**-31;##in kg
v=math.sqrt(2.*e*V/m);##electron velocity in m/s
print'%s %.1f %s'%('electron velocity is:',v,'')
r=m*v/(e*B);##in m
print'%s %.4f %s'%('radius of path (in m)is:',r,'')
import math
##Example 4.5
##motion of an electron in a uniform magnetic field acting at an angle
##given values
v=3*10**7;##electron speed
B=.23;##magnetic field in wb/m**2
q=45*math.pi/180;##in degrees,angle in which electron enter field
e=1.6*10**-19;##in C
m=9.1*10**-31;##in kg
R=m*v*math.sin(q)/(e*B);##in m
print'%s %.5f %s'%('radius of helical path is:',R,'')
p=2*math.pi*m*v*math.cos(q)/(e*B);##in m
print'%s %.4f %s'%('pitch of helical path(in m) is:',p,'')
import math
##Example 4.6
##Magnetostatic deflection
##given values
D=.03;##deflection in m
m=9.1*10**-31;##in kg
e=1.6*10**-19;##in C
L=.15;##distance between CRT and anode in m
l=L/2.;
V=2000.;##in voltsin wb/
B=D*math.sqrt(2.*m*V)/(L*l*math.sqrt(e));##in wb/m**2
print'%s %.4f %s'%('transverse magnetic field acting (in wb/m^2)is:',B,'')
import math
##Example 4.7
##electric and magnetic fields in crossed configuration
##given values
B=2*10**-3;##magnetic field in wb/m**2
E=3.4*10**4;##electric field in V/m
m=9.1*10**-31;##in kg
e=1.6*10**-19;##in C
v=E/B;##in m/s
print'%s %.1f %s'%('electron speed is:',v,'')
R=m*v/(e*B);##in m
print'%s %.3f %s'%('radius of circular path (in m) when electric field is switched off',R,'')