In [7]:

```
#Variable Declarations
h = 6.626e-34 #Planks constant, J.s
k = 1.38e-23 #Boltzman constant, J/K
c = 3.0e8 #speed of light, m/s
l = 0.01 #Box length, m
n1,n2 = 2,1 #Energy levels states
m = 5.31e-26 #mass of oxygen molecule, kg
#Calculations
dE = (n1+n2)*h**2/(8*m*l**2)
dEcm = dE/(h*c*1e2)
#Results
print 'Difference in energy levels is %3.2e J or %3.2e 1/cm'%(dE,dEcm)
```

In [9]:

```
from math import pi, sqrt
#Variable Declarations
h = 6.626e-34 #Planks constant, J.s
k = 1.38e-23 #Boltzman constant, J/K
c = 3.0e8 #speed of light, m/s
v = 1.0 #Volume, L
T = 298.0 #Temeprature of Ar, K
m = 6.63e-26 #Mass of Argon molecule, kg
#Calculations
GAMA = h/sqrt(2*pi*m*k*T)
v = v*1e-3
qT3D = v/GAMA**3
#Results
print 'Thermal wave length is %3.2e m and\nTranslational partition function is %3.2e'%(GAMA,qT3D)
```

In [2]:

```
#Variable Declarations
h = 6.626e-34 #Planks constant, J.s
k = 1.38e-23 #Boltzman constant, J/K
c = 3.0e8 #speed of light, m/s
J = 4 #Rotational energy level
B = 8.46 #Spectrum, 1/cm
#Calculations
T = (2*J+1)**2*h*c*100*B/(2*k)
#Results
print 'Spectrum will be observed at %4.0f K'%(T)
```

In [3]:

```
from math import exp
#Variable Declarations
h = 6.626e-34 #Planks constant, J.s
k = 1.38e-23 #Boltzman constant, J/K
c = 3.0e8 #speed of light, m/s
B = 60.589 #Spectrum for H2, 1/cm
T = 1000 #Temperture of Hydrogen, K
#Calculations
qR = k*T/(2*h*c*100*B)
qRs = 0.0
#for J in range(101):
# print J
# if (J%2 == 0):
# qRs = qRs + (2*J+1)*exp(-h*c*100*B*J*(J+1)/(k*T)
# else:
# qRs = qRs + 3*(2*J+1)*exp(-h*c*100*B*J*(J+1)/(k*T))
#print qRs/4
#Results
print 'Rotation partition function of H2 at %4.0f is %4.3f'%(T,qR)
```

In [7]:

```
#Variable Declarations
h = 6.626e-34 #Planks constant, J.s
k = 1.38e-23 #Boltzman constant, J/K
c = 3.0e8 #speed of light, m/s
B = 0.0374 #Spectrum for H2, 1/cm
T = 100.0 #Temperture of Hydrogen, K
sigma = 2.
#Calculations
ThetaR = h*c*100*B/k
qR = T/(sigma*ThetaR)
#Results
print 'Rotation partition function of H2 at %4.0f K is %4.3f'%(T,qR)
```

In [8]:

```
from math import pi, sqrt
#Variable Declarations
h = 6.626e-34 #Planks constant, J.s
k = 1.38e-23 #Boltzman constant, J/K
c = 3.0e8 #speed of light, m/s
Ba = 1.48 #Spectrum for OCS, 1/cm
Bb = [2.84,0.191,0.179] #Spectrum for ONCI, 1/cm
Bc = [9.40,1.29,1.13] #Spectrum for CH2O, 1/cm
T = 298.0 #Temperture of Hydrogen, K
sigmab = 1
sigmac = 2
#Calculations
qRa = k*T/(h*c*100*Ba)
qRb = (sqrt(pi)/sigmab)*(k*T/(h*c*100))**(3./2)*sqrt(1/Bb[0])*sqrt(1/Bb[1])*sqrt(1/Bb[2])
qRc = (sqrt(pi)/sigmac)*(k*T/(h*c*100))**(3./2)*sqrt(1/Bc[0])*sqrt(1/Bc[1])*sqrt(1/Bc[2])
#Results
print 'Rotation partition function for OCS, ONCI, CH2O at %4.0f K are %4.0f, %4.0f, and %4.0f respectively'%(T,qRa,qRb,qRc)
```

In [9]:

```
from math import pi, exp
#Variable Declarations
h = 6.626e-34 #Planks constant, J.s
k = 1.38e-23 #Boltzman constant, J/K
c = 3.0e8 #speed of light, m/s
Ba = 1.48 #Frequency for OCS, 1/cm
Bb = [2.84,0.191,0.179] #Frequency for ONCI, 1/cm
Bc = [9.40,1.29,1.13] #Frequency for CH2O, 1/cm
T298 = 298.0 #Temperture of Hydrogen, K
T1000 = 1000 #Temperture of Hydrogen, K
nubar = 208
#Calculations
qv298 = 1./(1.-exp(-h*c*100*nubar/(k*T298)))
qv1000 = 1./(1.-exp(-h*c*100*nubar/(k*T1000)))
#Results
print 'Vibrational partition function for I2 at %4d and %4d are %4.2f K and %4.2f respectively'%(T298, T1000,qv298, qv1000)
```

In [17]:

```
from math import exp
#Variable Declarations
h = 6.626e-34 #Planks constant, J.s
k = 1.38e-23 #Boltzman constant, J/K
c = 3.0e8 #speed of light, m/s
T = 298 #Temeprature, K
nubar = [450, 945, 1100] #Vibrational mode frequencies for OClO, 1/cm
#Calculations
Qv = 1.
for i in nubar:
qv = 1./(1.-exp(-h*c*100*i/(k*T)))
print 'At %4.0f 1/cm the q = %4.3f'%(i,qv)
Qv = Qv*qv
#Results
print 'Total Vibrational partition function for OClO at %4.1f K is %4.3f'%(T, Qv)
```

In [18]:

```
from math import exp
#Variable Declarations
h = 6.626e-34 #Planks constant, J.s
k = 1.38e-23 #Boltzman constant, J/K
c = 3.0e8 #speed of light, m/s
T = 298 #Temeprature, K
nubar = 917 #Vibrational mode frequencies for F2, 1/cm
#Calculations
ThetaV = h*c*100*nubar/k
Th = 10*ThetaV
qv = 1/(1.-exp(-ThetaV/Th))
#Results
print 'Vibrational partition function for F2 at %4.1f K is %4.3f'%(T, qv)
```

In [20]:

```
from math import exp
#Variable Declarations
h = 6.626e-34 #Planks constant, J.s
k = 1.38e-23 #Boltzman constant, J/K
c = 3.0e8 #speed of light, m/s
T = 1000 #Temeprature, K
nubar = [1388, 667.4,667.4,2349] #Vibrational mode frequencies for CO2, 1/cm
#Calculations
Qv = 1.
for i in nubar:
qv = 1./(1.-exp(-h*c*100*i/(k*T)))
print 'At %4.0f 1/cm the q = %4.3f'%(i,qv)
Qv = Qv*qv
#Results
print 'Total Vibrational partition function for OClO at %4.1f K is %4.3f'%(T, Qv)
```

In [26]:

```
from math import exp
#Variable Declarations
h = 6.626e-34 #Planks constant, J.s
k = 1.38e-23 #Boltzman constant, J/K
c = 3.0e8 #speed of light, m/s
T = 298. #Temeprature, K
n = [0,1,2,3,4,5,6,7,8] #Energy levels
E0 = [0,137.38,323.46,552.96,2112.28,2153.21,2220.11,2311.36,2424.78] #Energies, 1/cm
g0 = [4,6,8,10,2,4,6,8,10]
#Calculations
qE = 0.0
for i in range(9):
a =g0[i]*exp(-h*c*100*E0[i]/(k*T))
qE = qE + a
#Results
print 'Electronic partition function for F2 at %4.1f K is %4.2f'%(T, qE)
```