In [1]:

```
import math
#Variable declaration
N_A = 6.022e+23; # Avogdaro's No., per mole
n = 1; # Order of diffraction
M = 58.5; # Molecular mass of NaCl, g/mol
rho = 2.16; # Density of rock salt, g/cc
two_theta = 20; # Scattering angle, degree
theta = two_theta/2; # Diffraction angle, degree
#Calculations
N = N_A*rho*2/(M*1e-006); # Number of atoms per unit volume, per metre cube
d = (1/N)**(1./3); # Interplanar spacing of NaCl crystal, m
lamda = 2*d*math.sin(theta*math.pi/180)/n ; # Wavelength of X-rays using Bragg's law, m
#Result
print "The wavelength of the incident X rays = %5.3f nm"%(lamda/1e-009)
```

In [2]:

```
import math
#Variable declaration
h = 6.63e-034; # Planck's constant, Js
c = 3e+008; # Speed of light, m/s
#Calculations&Results
# For a moving ball
m = 0.057; # Mass of the ball, kg
v = 25; # Velocity of ball, m/s
p = m*v; # Momentum of the ball, kgm/s
lamda = h/p; # Lambda is the wavelength of ball, nm
print "The wavelength of ball = %3.1e m"%lamda
# For a moving electron
m = 0.511e+006; # Rest mass of an electron, eV
K = 50; # Kinetic energy of the electron, eV
p = math.sqrt(2*m*K); # Momentum of the electron, kgm/s
lamda = h*c/(1.602e-019*p*1e-009); # Wavelength of the electron, nm
print "The wavelength of the electron = %4.2f nm"%lamda
```

In [3]:

```
import math
#Variable declaration
m = 9.1e-31; # Mass of the electron, kg
h = 6.63e-34; # Planck's constant, Js
c = 3e+008; # Speed of light, m/s
e = 1.6e-19; # Energy equivalent of 1 eV, J/eV
V0 = 54; # Potential difference between electrodes, V
#Calculations
lamda = h*c/(math.sqrt(2*m*c**2/e*V0)*e*1e-009); # de Broglie wavelength of the electron, nm
#Result
print "The de Broglie wavelength of the electron used by Davisson and Germer = %5.3f nm"%lamda
```

In [4]:

```
import math
#Variable declaration
h = 6.63e-34; # Planck's constant, Js
c = 3e+008; # Speed of light, m/s
e = 1.6e-19; # Energy equivalent of 1 eV, J/eV
m = 1.67e-27; # Mass of a neutron, kg
k = 1.38e-23; # Boltzmann constant, J/mol/K
T = [300, 77]; # Temperatures, K
#Calculations&Results
lamda = h*c/(math.sqrt(3*m*c**2/e*k/e*T[0])*e); # The wavelength of the neutron at 300 K, nm
print "The wavelength of the neutron at %d K = %5.3f nm"%(T[0], lamda/1e-09)
lamda = h*c/(math.sqrt(3*m*c**2/e*k/e*T[1])*e); # The wavelength of the neutron at 77 K, nm
print "The wavelength of the neutron at %d K = %5.3f nm"%(T[1], lamda/1e-09)
```

In [5]:

```
import math
#Variable declaration
h = 6.626e-34; # Planck's constant, Js
c = 3e+008; # Speed of light, m/s
e = 1.602e-019; # Energy equivalent of 1 eV, J/ev
d = 2000; # Distance between slit centres, nm
K = 50e+003; # Kinetic energy of electrons, eV
l = 350e+006; # Distance of screen from the slits, nm
#Calculations
lamda = 1.226/math.sqrt(K); # Non-relativistic value of de Broglie wavelength of the electrons, nm
E0 = 0.511e+006; # Rest energy of the electron, J
E = K + E0; # Total energy of the electron, J
p_c = math.sqrt(E**2 - E0**2); # Relativistic mass energy relation, eV
lambda_r = h*c/(p_c*e*1e-009); # Relativistic value of de Broglie wavelength, nm
percent_d = (lamda - lambda_r)/lamda*100; # Percentage decrease in relativistic value relative to non-relavistic value
sin_theta = lambda_r/d; # Bragg's law
y = l*sin_theta; # The distance of first maximum from the screen, nm
#Results
print "The percentage decrease in relativistic value relative to non-relativistic value = %1.0f percent"%percent_d
print "The distance between first two maxima = %3.0f nm"%y
```

In [6]:

```
#Variable declaration
dx = 17.5; # The uncertainty in position, m
h = 1.05e-034; # Reduced Planck's constant, Js
#Calculations&Results
dp_x = h/(2*dx); # The uncertainty in momentum, kgm/s
print "The uncertainty in momentum of the ball = %1.0e kg-m/s"%dp_x
dx = 0.529e-010; # The uncertainty in position, m
dp_x = h/(2*dx); # The uncertainty in momentum, kgm/s
print "The uncertainty in momentum of the electron = %1.0e kg-m/s"%dp_x
```

In [7]:

```
import math
#Variable declaration
a_0 = 5.29e-11; # Radius of H-atom, m
l = 2*a_0; # Length, m
h = 6.63e-34; # Planck's constant, Js
m = 9.1e-31; # Mass of electron, kg
#Calculations
K_min = h**2/(8*(math.pi)**2*m*l**2); # Minimum kinetic energy possesed, J
#Result
print "The minimum kinetic energy of the electron = %3.1f eV"%(K_min/1.6e-19)
```

In [8]:

```
import math
#Variable declaration
dx = 6e-015; # The uncertainty in position of the electron, m
h_bar = 1.054e-034; # PReduced Planck's constant, Js
e = 1.602e-019; # Energy equivalnet of 1 eV, J/eV
c = 3e+008; # Speed of light, m/s
E0 = 0.511e+006; # Rest mass energy of the electron, J
#Calculations
dp = h_bar*c/(2*dx*e); # Minimum electron momentum, eV/c
p = dp; # Momentum of the electron at least equal to the uncertainty in momentum, eV/c
E = math.sqrt(p**2+E0**2)/1e+006; # Relativistic energy of the electron, MeV
K = E - E0/1e+006; # Minimum kinetic energy of the electron, MeV
#Result
print "The minimum kinetic energy of the electron = %4.1f MeV"%K
```

In [9]:

```
import math
#Variable declaration
c = 3e+8; # Speed of light, m/s
dt = 1e-08; # Relaxation time of atom, s
h = 6.6e-34; # Planck's constant, Js
dE = h/(4*math.pi*dt); # Energy width of excited state of atom, J
lamda = 300e-009; # Wavelegth of emitted photon, m
#Calculations&Results
f = c/lamda; # Frequency of emitted photon, per sec
print "The energy width of excited state of the atom = %3.1e eV"%(dE/1.6e-019)
df = dE/h; # Uncertainty in frequency, per sec
print "The uncertainty ratio of the frequency = %1.0e"%(df/f)
```

In [10]:

```
#Variable declaration
e = 1.6e-019; # Energy equivalent of 1 eV, J/eV
c = 3e008; # Speed of light, m/s
h = 6.63e-034; # Planck's constant, Js
m = 9.1e-031; # Mass of the proton, kg
l = 0.1; # Length of one-dimensional box, nm
#Calculations&Results
for n in range(1,4):
E_n = n**2*(h*c/(e*1e-009))**2/(8*m*c**2/e*l**2); # Energy of nth level, eV
print "The first three energy levels are %3.0f eV"%(E_n)
```