import math
##Example 5.1
##Electron refraction, calculation of potential difference
##given values
V1=250.;##potential by which electrons are accelerated in Volts
alpha1=50*math.pi/180.;##in degree
alpha2=30*math.pi/180.;##in degree
b=math.sin(alpha1)/math.sin(alpha2);
##calculation
V2=(b**2.)*V1;
a=V2-V1;
print'%s %.1f %s'%('potential difference(in volts) is:',a,'');
##Example 5.2&5.3
import math
##Cyclotron, calculation of magnetic induction,maximum energy
##given values
f=12*(10**6);##oscillator frequency in Hertz
r=.53;##radius of the dee in metre
q=1.6*10**-19;##Deuteron charge in C
m=3.34*10**-27;##mass of deuteron in kg
##calculation
B=2*math.pi*f*m/q;##
print'%s %.2f %s'%('magnetic induction (in Tesla) is:',B,'');
import math
##Cyclotron, calculation of magnetic induction,maximum energy
##given values
f=12.*(10**6);##oscillator frequency in Hertz
r=.53;##radius of the dee in metre
q=1.6*10**-19;##Deuteron charge in C
m=3.34*10**-27;##mass of deuteron in kg
##calculation
B=2*math.pi*f*m/q;##
E=B**2*q**2.*r**2./(2.*m);
print'%s %.2e %s'%('maximum energy to which deuterons can be accelerated (in J) is',E,'')
E1=E*6.24*10**18/10**6.;##conversion of energy into MeV
print'%s %.1f %s'%('maximum energy to which deuterons can be accelerated (in MeV) is',E1,'');
print('in text book ans is given wrong')
import math
##Example 5.4
##Mass spectrograph, calculation of linear separation of lines formed on photographic plates
##given values;
E=8.*10**4;##electric field in V/m
B=.55##magnetic induction in Wb/m*2
q=1.6*10**-19;##charge of ions
m1=20.*1.67*10**-27;##atomic mass of an isotope of neon
m2=22.*1.67*10**-27;##atomic mass of other isotope of neon
##calculation
x=2*E*(m2-m1)/(q*B**2);##
print'%s %.3f %s'%('separation of lines (in metre) is:',x,'')