In [1]:

```
#Variable declaration
m = 511.; # Mass of electron, KeV
M = 938*10**3; # Mass of incident charged particle, KeV
E = 10*10**3; # Energy of proton, KeV
#Calculations
E_l = 4*m*E/M; # Energy lost during collison, KeV
n = E/E_l; # Number of collisions,
N = round(n)
#Result
print "The energy lost during collision = %5.2f KeV \n Number of collision required = %d collisions"%(E_l,N)
```

In [2]:

```
import math
#Variable declaration
x = 0.2; # Thickness of Al material , m
I_r = 3./100; # Intensity ratios,
#Calculations
x_h = math.log(2)*x/math.log(1./I_r); # Half value thickness of Al, m
#Result
print "Half value thickness of Al : %6.4f m"%x_h
```

In [7]:

```
import math
#Variable declaration
u = 0.75; # Absorption coefficient , cm^-1
I_r = 1./100; # Intensity ratios,
#Calculations
x = math.log(1./I_r)*u; # Thckness of Pb, cm
#Result
print "Thickness of Pb : %5.3f cm"%x
```

In [8]:

```
import math
#Variable declaration
x_h = 5; # Half thickness of an absorber, mm
x = 20; # Thickness of an absorber, mm
#Calculations
u = math.log(2)/x_h; # Absorption coefficient, mm^-1
I_r = math.exp(-u*x); # Intensity ratios,
P_loss = I_r*100; # Percentage loss in intensity, percent
#Result
print "Percentage loss in intensity : %4.2f percent"%P_loss
```

In [9]:

```
import math
#Variable declaration
C = 3e+08; # Speed of light, m/s
h = 6.626e-034; # Planck's constant, Js
lamda = 2500e-010; # wavelength of light, m
e = 1.602e-019; # Charge of electron, C
w = 1.9; # Work function, J
m = 9.1e-031; # Mass of the electron, kg
#Calculations
E_c = h*C/(lamda*e); # Calculated energy, J
E_e = E_c-w; # Energy of photoelectron, J
v = math.sqrt((2*E_e*e)/m); # Velocity of photoelectron, m/s
#Result
print "The velocity of photoelectron : %4.2e m/s "%v
```

In [10]:

```
#Variable declaration
C = 3e+08; # Speed of light, m/s
h = 6.626e-034; # Planck's constant, Js
lamda = 250e-09; # Wavelength of light, m
w = 2.30; # Work function, eV
A = 2e-04; # Area of the surface, m^2
I = 2; # Intensity of light, W/m^2
e = 1.6e-019; # Charge of the electron, C
#Calculations
E_p = h*C/(lamda*e); # Energy of photoelectron, eV
E_max = E_p-w; # Maximum kinetic energy of photoelectron, eV
n_p = I*A/(E_p*e); # Number of photons reaching the surface per second, photons/s
R_p = 0.2/100*n_p; # Rate at which photoelectrons are emitted, photoelectrons/s
#Result
print "The maximum kinetic energy = %4.2f eV \n The rate at which photoelectrons are emitted = %4.2e photoelectrons/s "%(E_max, R_p)
```

In [11]:

```
#Variable declaration
C = 3e+08; # Speed of light, m/s
h = 6.626e-034; # Planck's constant, Js
T_lamda = 190e-09; # Threhold wavelength of light, m
e = 1.6e-019; # Charge of the electron, C
E_max = 1.1; # Maximum kinetic energy of photoelectron, eV
#Calculations
w = h*C/(T_lamda*e); # Work function, eV
E_t = E_max+w; # threshold energy, eV
lamda = h*C/(E_t*e); # Wavelength of light used, m
#Result
print "The wavelength of light used : %5.3e m"%lamda
```

In [12]:

```
import math
#Variable declaration
h = 6.62e-034; # Value of Planck's constant, J
m_e = 9.11e-031; # Mass of the electron,Kg
c = 3e+08; # Velocity of light, m/s
A = 65; # Angle between scattered radiation and incident radiation, degree
#Calculations
C_s = h/(m_e*c)*(1-math.cos(A*math.pi/180)); # Compton shift, m
#Result
print "Compton shift : %4.2e m"%C_s
```

In [13]:

```
import math
#Variable declaration
h = 6.626e-034; # Value of Planck's constant, J
m_e = 9.11e-031; # Mass of the electron,Kg
c = 3e-04; # Velocity of light, m/s
A = 135; # Angle between scattered radiation and incident radiation, degree
W_i = 1.87; # Wavelength of incident radiation, pm
#Calculations
W_s = W_i + (h*(1-math.cos(A*math.pi/180)))/(m_e*c); # Wavelength of scattered radiation, pm
#Result
print "Wavelength of scattered radiation : %4.2f pm"%W_s
```

In [14]:

```
import math
#Variable declaration
h = 6.626e-034; # Value of Planck's constant, J
m_e = 9.11e-031; # Mass of the electron,Kg
c = 3e-04; # Velocity of light, pm/s
A = 90; # Angle between scattered radiation and incident radiation, degree
W_s = 3.8; # Wavelength of scattered radiation, pm
#Calculations
W_i = (W_s - h/(m_e*c)*(1-math.cos(A*math.pi/180))); # Wavelength of incident beam of Xrays, pm
#Result
print "Wavelength of incident beam of X-rays : %4.2f pm"%W_i
```

In [15]:

```
import math
#Variable declaration
h = 6.626e-034; # Value of Planck's constant, J
m_e = 9.11e-031; # Mass of the electron,Kg
c = 3e+08; # Velocity of light, pm/s
A = 60; # Angle between scattered radiation and incident radiation, degree
v_0 = 3.2e+019; # Frequency of the incident photon, Hz
#Calculations
V = 1/v_0 + h/(m_e*c**2)*(1-math.cos(A*math.pi/180));
v =(1/V); # Frequency of the scattered photon, Hz
#Result
print "Frequency of the scattered photon: %4.2e Hz"%v
```

In [16]:

```
import math
#Variable declaration
h = 6.626e-034; # Value of Planck's constant, J
m_e = 9.11e-031; # Mass of the electron,Kg
c = 3e+08; # Velocity of light, pm/s
A = 180; # Angle between scattered radiation and incident radiation, degree
E_i = 1836; # Energy of the incident electron, KeV
#Calculations
E = 1./E_i + 1./511*(1-math.cos(A*math.pi/180));
E_s = round(1./E); # Energy of the sscattered photon, KeV
E_r = E_i-E_s; # Energy of the recoil electron, KeV
#Result
print "Energy of the scattered photon = %d KeV \n Energy of the recoil electron = %d KeV "%(E_s, E_r )
```

In [17]:

```
import math
#Variable declaration
E_s = 180; # Energy of the scattered X-rays, KeV
E_i = 200; # Energy of the incident X-rays, KeV
#Calculations
a = math.degrees(math.acos(1-((1./E_s-1./E_i)*511))); #
A = round(a); # Scattering angle of X-rays, degree
#Result
print "Scattering angle of X-rays: %d degree"%A
```

In [18]:

```
#Variable declaration
M_e = 0.511; # Rest mass of electron, MeV
M_p = 0.511; # Rest mass of positron, MeV
#Calculations
E_c = M_e+M_p; # Energy consumed, Mev
E_g = 5.0; # Given energy, MeV
E_l = E_g-E_c; # Energy left, Mev
E_k = E_l/2; # Kinetic energy of electron and positron, MeV
#Result
print "The kinetic energy of electron and positron : %5.3f Mev"%E_k
```