In [1]:

```
import math
#Variable declaration
k = 1.38e-023; # Boltzmann constant, J/K
N_A = 6.023e+023; # Avogadro's number
T = 293; # Room temperature, K
e = 1.6e-019; # Energy equivalent of 1 eV, J
#Calculations
# For a single molecule
K_bar_single = 3./2*k*T/e; # Mean translational kinetic energy of a single gas molecule, J
# For a 1 mole of molecules
K_bar_mole = K_bar_single*N_A*e; # Mean translational kinetic energy of 1 mole of gas molecules, J
#Results
print "The mean translational kinetic energy of the single idela gas molecule = %5.3f eV"%K_bar_single
print "The mean translational kinetic energy of the one mole of ideal gas molecules = %4d J"%(math.ceil(K_bar_mole))
#Answer differs due to rounding error
```

In [2]:

```
import math
#Variable declaration
k = 1.38e-023; # Boltzmann constant, J/K
u = 1.67e-027; # Mass equivalent of one atomic mass unit, kg
T = 293; # Room temperature, K
m_H = 1.008*u; # Gram atomic mass of hydrogen, kg
#Calculations&Results
m = 2*m_H; # Gram molecular mass of hydrogen molecule, kg
v_bar = 4/math.sqrt(2*math.pi)*math.sqrt(k*T/m); # Mean molecular speed in the light gas hydrogen, m/s
print "The mean molecular speed in the light gas hydrogen = %4d m/s"%(math.ceil(v_bar))
m = 222*u; # Gram atomic mass of Radon, kg
v_bar = 4/math.sqrt(2*math.pi)*math.sqrt(k*T/m); # Mean molecular speed in the heavy radon gas, m/s
print "The mean molecular speed in the heavy radon gas = %3d m/s"%(math.ceil(v_bar))
```

In [4]:

```
import math
import scipy
from scipy.integrate import quad
#Variable declaration
m = 1; # For simplicity assume mass of gas molecule to be unity, kg
k = 1.38e-023; # Boltzmann constant, J/K
T = 293; # Room temperature, K
#Calculations
bita = k*T; # Energy associated with three degrees of freedom, J
v_mps = math.sqrt(2/(bita*m)); # For simplcity assume most probable speed to be unity, m/s
C = (bita*m/(2*math.pi))**(3./2); # Constant in the distribution function
p = lambda v: 4*math.pi*C*math.exp(-1./2*bita*m*v**2)*v**2
P,err = scipy.integrate.quad(p,0.99*v_mps, 1.01*v_mps)
#Result
print "The fraction of molecules in an ideal gas in equilibrium which have speeds within 1 percent above and below the most probable speed = %5.3f"%P
```

In [5]:

```
import numpy
import math
#Variable declaration
k = 1.38e-023; # Boltzmann constant, J/K
T = [293, 5000, 1e+006]; # Room temperature, temperature at the surface of the star and temperature at the star interior respectively, K
e = 1.6e-019; # Energy equivalent of 1 eV, J
g_E1 = 2; # Possible configuration of the electrons in ground state of H-atom
g_E2 = 8; # Possible configuration of the electrons in the first excited state of H-atom
E1 = -13.6; # Energy of the ground state, eV
E2 = -3.4; # Energy of the first excited state state, eV
#Calculations&Results
n_ratio = numpy.zeros(3);
for i in range(0,3):
n_ratio[i] = g_E2/g_E1*math.exp(1./(k*T[i])*(E1 - E2)*e);
print "For T = %4.2e K, n_E2/n_E1 = %4.2e"%(T[i], n_ratio[i])
#Incorrect answer given in textbook for the first part
```

In [6]:

```
import math
#Variable declaration
e = 1.6e-019; # Energy equivalent of 1 eV, J
n = 8.47e+028; # Number density of conduction electrons in copper, per metre cube
k = 1.38e-023; # Boltzmann constant, J/K
h = 6.626e-034; # Planck's constant, Js
m = 9.11e-031; # Mass of an electron, kg
#Calculations
E_F = h**2/(8*m*e)*(3*n/math.pi)**(2./3); # Fermi energy for copper, eV
T_F = E_F*e/k; # Fermi temperature for copper, K
#Results
print "The Fermi energy for copper = %4.2f eV"%E_F
print "The Fermi temperature for copper = %4.2e K"%T_F
```

In [7]:

```
import math
#Variable declaration
R = 1; # For simplicity assume the molar gas constant to be unity, J/mol/K
T = 293; # Room temperature, K
T_F = 8.16e+004; # The Fermi temperature for copper
#Calculations&Results
C_V = math.pi**2*T/(2*T_F)*R; # Electronic contribution to the molar heat capacity for copper, J/mol/K
print "The electronic contribution to the molar heat capacity for copper = %6.4fR"%C_V
T_F = 6.38e+004; # The Fermi temperature for silver
C_V = math.pi**2*T/(2*T_F)*R; # Electronic contribution to the molar heat capacity for silver, J/mol/K
print "The electronic contribution to the molar heat capacity for silver = %6.4fR"%C_V
```