In [2]:

```
# Input data
T = 300. # The given temperature in K
R = 8.31 # Universal gas constant in J/mole-K
# Calculations
# The total random kinetic energy of one gram mole of oxygen in J
U = (3. / 2) * R * T
# Output
print 'The total random kinetic energy of one gram mole of oxygen is U = %3.0f J ' % (U)
```

In [3]:

```
# Input data
a = 0.245 # Van der Waals constant in atoms-litre**2-mole**-2
b = 2.67 * 10**-2 # Van der Waals constant in litre-mole**-1
R = 8.314 * 10**7 # Universal gas constant in ergs/mole-K
# Calculations
# Van der Waals constant in dynes-cm**4-mole**-2
a1 = a * 76 * 13.6 * 980 * 10**6
b1 = b * 10**3 # Van der Waals constant in cm**3mole**-1
Tc = (8. / 27) * (a1 / b1) * (1 / R) # The critical temperature in K
Tc1 = Tc - 273 # The critical temperature in degree centigrade
# Output
print 'The critical temperature is Tc = %3.2f K (or) %3.2f degree centigrade ' % (Tc, Tc1)
```

In [4]:

```
# Input data
t = 0. # The given temperature in degree centigrade
E = 5.64 * 10**-21 # The mean kinetic energy of molecules of hydrogen in J
R = 8.32 # Universal gas constant in J/mole-K
# Calculations
T = t + 273 # The given temperature in K
N = (3. / 2) * (R / E) * (T) # Avogadros number
# Output
print 'The Avogadro number is N = %3.4g ' % (N)
```

In [5]:

```
# Input data
d = 2. * 10**-8 # The diameter of the molecule of a gas in cm
k = 1.38 * 10**-23 # Boltzmanns constant in J/K
T = 273. # The temperature at NTP in K
pi = 3.14 # The mathematical constant of pi
# Calculations
d1 = d / 100 # The diameter of the molecule of a gas in m
P = 0.76 * 13.6 * 9.8 * 1000 # The pressure at NTP
n = P / (k * T) # The number of molecules per cubic meter
l = 1. / (pi * d1**2 * n) # The mean free path in m
# Output
print 'The mean free path at NTP is %3.4g m ' % (l)
```

In [6]:

```
# Input data
n = 3. * 10**25 # The number of molecules per cubic metre
d = 3.6 * 10**-10 # The diameter of oxygen molecule in m
M = 32. # Molecular weight of oxygen
N = 6.023 * 10**26 # Avogadro number
k = 1.38 * 10**-23 # Boltzmans constant in J/K
T = 273. # The temperature at NTP in K
pi = 3.14 # The mathematical constant of pi
# Calculations
m = M / N # The mass of oxygen atom in kg
# Average speed of oxygen molecule at 273K in m/s
V = ((8 * k * T) / (pi * m))**(1. / 2)
c = pi * d**2 * V * n # The collision frequency of the molecules
l = 1. / (pi * d**2 * n) # The mean free path in m
# Output
print '(a)The collision frequency of the molecules is %3.2g collisions/second \n (b)The mean free path is %3.4g m ' % (c, l)
```

In [7]:

```
# Input data
d = 9000. # The density of copper in kg/m**3
w = 63.5 # The atomic weight of copper in kg
N = 6.023 * 10**26 # Avogadros number
pi = 3.14 # Mathematical constant of pi
h = 6.624 * 10**-34 # Planks constant in Js
# Calculations
V = w / d # The volume of copper in m**3
Ef = ((h**2 / (8. * 9. * 10**-31)) * ((3 / pi) * (N / V)) **
(2. / 3)) / (1.6 * 10**-19) # The fermi energy in eV
# The pressure at absolute zero for copper in N/m**2
P = (2. / 3) * (N / V) * Ef
# Output
print '(a)The Fermi energy is E = %3.3f eV \n (b)The pressure at absolute zero for copper is P = %3.6g N/m^2 ' % (Ef, P)
```

In [8]:

```
import math
# Input data
p1 = 80. # The initial pressure of a gas in cm of Hg
p2 = 60. # The final pressure of a gas in cm of Hg
v2 = 1190. # The final volume occupied by a gas in cc
v1 = 1000. # The initial volume occupied by a gas in cc
# Calculations
g = (math.log10(p1 / p2)) / (math.log10(v2 / v1)) # The adiabatic index
# Output
print 'The adiabatic index is %3.3f ' % (g)
```

In [9]:

```
import math
# Input data
t = 27. # The given temperature in degree centigrade
R = 8.3 # Universal gas constant in J/deg mole
# Calculations
T = t + 273 # The given temperature in K
v1 = 1. # Let the original volume be in cc
v2 = 2. * v1 # The final volume in cc
W = R * T * math.log(v2 / v1) # The work done in J
# Output
print 'The work done is W = %3.1f J ' % (W)
```

In [10]:

```
# Input data
t1 = 27. # The initial temperature of the gas in degree centigrade
T1 = t1 + 273 # The initial temperature of the gas in K
g = 1.5 # The adiabatic index
p = 8. # The ratio of final pressure to the initial pressure
# Calculations
T2 = ((p)**((g - 1) / g)) * T1 # The final temperature of the gas in K
T21 = T2 - 273 # The final temperature of the gas in degree centigrade
# Output
print 'The final temperature of the gas is T2 = %3.0f K (or) %3.0f degree centigrade ' % (T2, T21)
```

In [11]:

```
# Input data
n = 0.3 # The efficiency of a carnot engine
t = 27. # The temperature of the sinkk in degree centigrade
n1 = 0.5 # The increased efficiency of a carnot engine
# Calculations
T2 = t + 273 # The temperature of the sinkk in K
T1 = T2 / (1 - n) # The temperature of the source for 0.3 efficiency in K
T11 = T2 / (1 - n1) # The temperature of the source for 0.5 efficiency in K
T = T11 - T1 # The increase in temperature in K
# Output
print 'The increase in temperature is T = %3.2f K ' % (T)
```

In [12]:

```
# Input data
T1 = 2100. # One of the operating temperature in K
T2 = 700. # One of the another operating temperature in K
n1 = 40. # The actual efficiency of the engine in percent
# Calculations
n = (1 - (T2 / T1)) * 100 # The efficiency of the engine in percent
# The percentage of actual efficiency to the maximum possible efficiency
# in percent
n2 = (n1 / n) * 100
# Output
print 'The percentage of actual efficiency to the maximum possible efficiency is %3.0f percent ' % (n2)
```

In [13]:

```
# Input data
T1 = 600. # The working temperature of the engine in K
T2 = 300. # The another working temperature of the engine in K
n = 52. # Efficiency of the engine claimed by the inventor in percent
# Calculations
n1 = (1 - (T2 / T1)) * 100 # The carnot efficiency of the engine in percent
# Output
print 'The efficiency of the engine claimed by inventor is n = %3.0f percent\nThe carnot efficiency of the engine is n = %3.0f percent \n (The efficiency claimed is more than the carnots engine efficiency \n No engine can have efficiency more than carnots efficiency \n Hence the claim is invalid)' % (n, n1)
```

In [14]:

```
# Input data
H1 = 10.**4 # The heat absorbed by a carnots engine in calories
t1 = 627. # The temperature from a reservoir in degree centigrade
t2 = 27. # The temperature of the sinkk in degree centigrade
# Calculations
T1 = t1 + 273 # The temperature of the reservoir in K
T2 = t2 + 273 # The temperature of the sinkk in K
n = (1 - (T2 / T1)) * 100 # The efficiency of the engine in percent
H2 = H1 * (T2 / T1) # The heat rejected to the sinkk in calories
W = (H1 - H2) * 4.2 # The work done by the engine in J
# Output
print 'The efficiency of the engine is n = %3.2f percent The work done by the engine is W = %3.2g J ' % (n, W)
```

In [15]:

```
# Input data
w = 100. # The given power of an engine in kW
t1 = 117. # The operating temperature of an engine in degree centigrade
t2 = 17. # The another operating temperature of an engine in degree centigrade
# Calculations
T1 = t1 + 273 # The operating temperature of an engine in K
T2 = t2 + 273 # The another operating temperature of an engine in K
W = w * 1000 # The given power of an engine in J/s
n = (1 - (T2 / T1)) * 100 # The efficiency of an engine in percent
H = (T1 / T2) # The amount of heat absorbed to the amount of heat rejected
H2 = W / (H - 1) # The amount of heat rejected per second in J/s
H1 = H * H2 # The amount of heat absorbed per second in J/s
# Output
print '(i)The amount of heat absorbed is %3.0g J/s \n (ii)The amount of heat rejected is %3.0g J/s \n (iii)The efficiency of the engine is %3.1f percent ' % (H1, H2, n)
```

In [16]:

```
import math
# Input data
m1 = 10. # The mass of water at 60 degree centigrade in g
m2 = 30. # The mass of water at 20 degree centigrade in g
t1 = 60. # The temperature of 10 g water in degree centigrade
t2 = 20. # The temperature of 30 g water in degree centigrade
# Calculations
T1 = t1 + 273 # The temperature of 10g water in K
T2 = t2 + 273 # The temperature of 30g water in K
T = ((m1 * T1) + (m2 * T2)) / (m1 + m2) # The final temperature of water in K
# The change in entropy of 10g water from 333 to 303 K in cal/K
s1 = m1 * math.log(T / T1)
# The change in entropy of 30g water from 293 to 303 K in cal/K
s2 = m2 * math.log(T / T2)
s = s1 + s2 # The total gain in the entropy of the system in cal/K
# Output
print 'The change in entropy is %3.4f cal/K ' % (s)
```

In [17]:

```
# input data
m = 10. # The given amount of water in kg
t1 = 100. # The temperature of water in degree centigrade
L = 540. # The latent heat of vapourisation of steam in cal
# Calculations
m1 = m * 1000 # The given amount of water in g
T1 = t1 + 273 # The temperature of water in K
S = (m1 * L) / T1 # The increase in entropy in cal/K
# Output
print 'The increase in entropy is %3.0f cal/K ' % (S)
```

In [18]:

```
import math
# Input data
m = 50. # The given amount of water in g
t1 = 10. # The initial temperature of water in degree centigrade
t2 = 90. # The final temperature of water in degree centigrade
# Calculations
T1 = t1 + 273 # The initial temperature of water in K
T2 = t2 + 273 # The final temperature of water in K
S = m * math.log(T2 / T1) # The increase in entropy in cal/K
# Output
print 'The increase in entropy is %3.3f cal/K ' % (S)
```

In [19]:

```
import math
# Input data
m = 10. # The given amount of ice in g
T1 = 273. # The initial temperature of ice in K
T2 = 373. # The final temperature of steam in K
L1 = 80. # The latent heat of ice in cal/g
L2 = 540. # The latent heat of vapourisation of steam in cal
# Calculations
s1 = (m * L1) / T1 # Increase in entropy from ice at 273K to water at 273K in cal/K
# Increase in entropy from water at 273K to water at 373K in cal/K
s2 = (m) * math.log(T2 / T1)
# Increase in entropy from water at 373K to steam at 373K in cal/K
s3 = (m * L2) / T2
s = s1 + s2 + s3 # The total increase in entropy in cal/K
# Output
print 'The total increase in entropy is %3.2f cal/K ' % (s)
```

In [20]:

```
import math
# Input data
m = 1. # The given amount of nitrogen in g
t1 = 50. # The initial temperature of nitrogen in degree centigrade
t2 = 100. # The final temperature of nitrogen in degree centigrade
Cv = 0.18 # Molar specific heat of nitrogen
w = 28. # Molecular weight of nitrogen
# Calculations
T1 = t1 + 273 # The initial temperature of nitrogen in K
T2 = t2 + 273 # The final temperature of nitrogen in K
S = (Cv / w) # The Specific heat of nitrogen
s = m * S * math.log(T2 / T1) # The change in entropy in cal/K
# Output
print 'The change in entropy is %3.4g cal/K ' % (s)
```

In [21]:

```
# Input data
p = 135.2 # The given increase in the pressure in atmospheres
V = -0.091 # The given increase in the specific volume when 1g of water freezes into ice in cm**3
L = 80. # Latent heat of fusion of ice in cal/gram
T = 273. # The temperature of ice in K
# Calculations
L1 = L * 4.18 * 10**7 # The latent heat of fusion of ice in ergs/g
P = p * 1.013 * 10**6 # The given increase in the pressure in dynes/cm**2
# The temperature at which ice will freeze in degree centigrade
t = (P * T * V) / L1
t1 = t + 273 # The temperature at which ice will freeze in K
# Calculations
print 'The temperature at which ice will freeze is %3.0f degree centigrade (or) %3.0f K ' % (t, t1)
```

In [22]:

```
import math
# Input data
m = 1. # The given amount of water in kg
s = 1000. # The specific heat of water in cal/kg-K
T1 = 273. # The initial temperature of water in K
T2 = 373. # The temperature of the heat reservoir in K
# Calculations
S = m * s * math.log(T2 / T1) # The increase in entropy in cal/K
# Output
print 'The increase in the entropy of water is %3.0f cal/K' % (S)
```

In [23]:

```
# input data
m = 0.0273 # The given amount of ice in kg
L = 80. # The latent heat of fusion of ice in cal/gram
T = 273. # The temperature of ice in K
# Calculations
L1 = L * 1000 # The latent heat of fusion of ice in cal/kg
S = (m * L1 * 4.2) / T # The change in entropy in J/K
# Output
print 'The change in entropy is %3.1f J/K' % (S)
```

In [24]:

```
# Input data
t1 = 27. # The given initial temperature in degree centigrade
p = 50. # The reduce in the pressure in atmospheres
a = 13.2 * 10**-2 # Van der Waals constant in Nm**4mole**-2
b = 31.2 * 10**-6 # Van der Waals constant in mole**-1m**3
R = 8.3 # Universal gas constant in JK**-1(mole)**-1
Cp = 3.5 # The specific heat at constant pressure
M = 32. # Molecular weight of oxygen
# Calculations
T = t1 + 273 # The given initial temperature in K
P = p * 0.76 * 13.6 * 1000 * 9.8 # The reduce in the pressure in N/m**2
# The drop in the temperature in K
T1 = ((P) / (4.2 * M * Cp * R)) * (((2 * a) / (R * T)) - b)
# Output
print 'The drop in the temperature is %3.4f K ' % (T1)
```

In [25]:

```
# Input data
T = 300. # The temperature of the metallic copper disc in K
Cp = 24.5 # The specific heat at constant pressure in J/mol K
a = 50.4 * 10**-6 # The coefficient of thermal expansion in K**-1
K = 7.78 * 10**-12 # Isothermal compressibility in N/m**2
V = 7.06 * 10**-6 # The specific volume in m**3/mol
# Calculations
C = (T * V * a**2) / K # The change in specific heats in J/mol K
Cv = Cp - C # The specific heat at constant volume in J/mol K
# Output
print 'The specific heat at constant volume is Cv = %3.4f J/mol-K ' % (Cv)
```

In [26]:

```
# Input data
p = 50. # The reduced pressure in atmospheres
t = 27. # The initial temperature of the gas in degree centigrade
a = 1.32 * 10**12 # Van der Waal constant a in cm**4 dynes/mole**2
b = 31.2 # Van der Waal constant b in cm**3/mole
Cp = 7. # The specific heat at constant pressure in cal/mole-K
# Calculations
P = p * 76 * 13.6 * 980 # The reduced pressure in dynes/cm**2
Cp1 = Cp * 4.2 * 10**7 # The specific heat at constant pressure in ergs/mole-K
T = t + 273 # The initial temperature of the gas in K
R = 8.31 * 10**7 # The real gas constant in ergs/mole-K
# The drop in temperature in K or degree centigrade
dT = (P / Cp1) * (((2 * a) / (R * T)) - b)
# Output
print 'The drop in temperature produced by adiabatic throttling process is %3.3f K (or) %3.3f degree centigrade ' % (dT, dT)
# Error . There is a change in the result compared to the textbook because
# the final calculations did in the textbook went wrong , so the final
# result varied from the textbook
```

In [27]:

```
# Input data
t = 0. # The initial temperature of mercury in degree centigrade
p = 1. # The initial pressure of mercury in atmospheres
Cp = 28. # The specific heat at constant pressure in J/mol K
V = 1.47 * 10**-5 # The given specific volume in m**3/mol
b = 1.81 * 10**-6 # The given volume expansivity in K**-1
k = 3.89 * 10**-11 # The given compressibility in pa**-1
# Calculations
T = t + 273 # The initial temperature of mercury in K
# The specific heat at constant volume in J/mol K
Cv = Cp - ((T * V * b**2) / k)
g = Cp / Cv # The adiabatic index
# Output
print 'The adiabatic index is %3.0f ' % (g)
```

In [28]:

```
# Input data
K = 24. * 10**-3 # The coefficient of thermal conductivity of an oxygen molecule in J/m.s.K
Cv = 20.9 * 10**3 # The specific heat at constant volume in J/kilo.mole.K
k = 1.38 * 10**-23 # The boltzmanns constant in J/K
m = 5.31 * 10**-26 # The mass of an oxygen molecule in kg
T = 273. # The temperature of the molecule in K
pi = 3.142 # Mathematical constant of pi
# Calculations
C = ((3 * k * T) / m)**(1. / 2) # The velocity of the molecule in m
r = (((3 * k * T * m)**(1. / 2) * Cv) / (3. * 2.**(1. / 2) * pi * K)
)**(1. / 2) # The radius of an oxygen molecule in m
# Output
print 'The radius of an oxygen molecule is %3.4g m ' % (r)
# Error . There is a change in the result compared to the textbook because
# the final calculations did in the textbook went wrong , so the final
# result varied from the textbook
```

In [29]:

```
# Input data
b = 0.3 # The given wiens constant in cm-K
l = 5500. # The given wavelength in A units
# Calculations
L = l * 10**-8 # The given wavelength in cm
T = b / L # The temperature of the sun in K
# Output
print 'The temperature of the sun is %3.0f K ' % (T)
```

In [30]:

```
# Input data
R = 1. * 10**4 # The rate at which black body loses thermal energy in watts/m**2
s = 5.672 * 10**-8 # Stefans constant in SI units
# Calculations
T = (R / s)**(1. / 4) # The temperature of the black body in K
# Output
print 'The temperature of the black body is %3.0f K' % (T)
```

In [31]:

```
# Input data
T = 6174. # The temperature of the black body in K
l = 4700. # The wavelength of the black body emitting in amstrong units
l1 = 1.4 * 10**-5 # The wavelength to be emitted by the black body in m
# Calculations
L = l * 10**-10 # The wavelength of the black body emitted at 6174 K in m
L1 = l1 # The wavelength to be emitted by the black body in m
T1 = (L * T) / L1 # The temperature to be maintained by the black body in K
# Output
print 'The temperature to be maintained by the black body is %3.2f K ' % (T1)
```

In [33]:

```
import math
# Input data
T = 5800. # The temperature of the sun in K
# Calculations
r = 7. * 10**8 # The radius of the sun in m
pi = 3.142 # The mathematical constant of pi
A = 4. * pi * r**2 # The surface area of the sun in m**2
s = 5.672 * 10**-8 # Stefans constant in SI units
U = A * s * T**4 # The total energy emitted by sun per second in J
r1 = 1.5 * 10**11 # The distance of the earths atmosphere from the sun in m
# Energy reaching the top of earths atmosphere in kW/m**2
R = (U / (4 * pi * r1**2)) / 1000
# Output
print 'The total radiant energy emitted by sun per second is %3.4g J \
\nThe rate at which energy is reaching earths atmosphere is %3.1f kW/m^2 ' % (U, R)
```

In [34]:

```
# Input data
n = 5. # The molecules of ozone in grams
t = 27. # The temperature of ozone in degree centigrade
R = 8.3 # The universal gas constant in J/g-mol/K
# Calculations
T = t + 273 # The temperature of ozone in K
U = n * ((3. / 2) * R * T) # The energy of ozone in J
# Output
print 'The energy of 5 gms molecules of ozone at 27 degree centigrade is %3.6g J ' % (U)
```

In [35]:

```
# Input data
t = -1 # The pressure required to lower the melting point of ice in K
l = 79.6 # The latent heat of ice in cal/g
V1 = 1. # The specific volumes of water at 0 degree centigrade in cm**2
V2 = 1.091 # The specific volumes of ice at 0 degree centigrade in cm**2
p = 1.013 * 10**6 # One atmospheric pressure in dyne/cm**2
# Calculations
T = 273. # The temperature of water in K
L = l * 4.18 * 10**7 # The latent heat of ice in ergs/g
p1 = (L * t) / (T * (V1 - V2)) # The obtained pressure in dynes/cm**2
P = p1 / p # The obtained pressure in atmospheres
P1 = P + 1 # The required pressure in atmospheres
# Output
print 'The pressure required is %3.2f atmospheres ' % (P1)
```

In [36]:

```
# Input data
t1 = 127. # The temperature of the black body in degree centigrade
t2 = 27. # The temperature of the walls maintained in degree centigrade
s = 5.672 * 10**-8 # Stefans constant in SI units
# Calculations
T1 = t1 + 273 # The temperature of the black body in K
T2 = t2 + 273 # The temperature of the walls maintained in K
R = s * (T1**4 - T2**4) # The net amount of energy lost by body in W/m**2
# Output
print 'The net amount of energy lost by body per sec per unit area is %3.1f watts/m^2' % (R)
```

In [37]:

```
# Input data
t2 = 7. # The low temperature of reservoir in degree centigrade
n1 = 50. # The efficiency of the carnots engine in percentage
n2 = 70. # The increased efficiency of the carnots engine in percentage
# Calculations
T2 = t2 + 273 # The low temperature of the reservoir in K
T1 = T2 / (1 - (n1 / 100)) # The temperature of the source reservoir in K
# The temperature to be maintained by the source reservoir in K
T11 = T2 / (1 - (n2 / 100))
T = T11 - T1 # The increase in temperature of the source in K or degree centigrade
# Output
print 'The increase in temperature of the source is %3.1f K (or) %3.1f degree centigrade ' % (T, T)
```

In [38]:

```
# Input data
T1 = 6174. # The temperature of the black body in K
l1 = 4700. # The wavelength emitted by the black body in amstrong units
l2 = 1400. # The wavelength to be emitted by the black body in amstrong units
# Calculations
T2 = (l1 * T1) / l2 # The temperature to be maintained by the black body in K
# Output
print 'The temperature to be maintained by the black body is %3.0f K ' % (T2)
```

In [39]:

```
# Input data
e = 8.5 * 10**28 # The given energy density of electrons in copper in electrons/m**3
k = 1.38 * 10**-23 # The boltzmann constant in J/K
h = 6.62 * 10**-34 # Planks constant in J.s
m = 9.1 * 10**-31 # The given mass of electrons in kg
pi = 3.14 # The mathematical constant of pi
# Calculations
E = (((3 * e) / pi)**(2. / 3)) * (h**2) * (1. / 8) * \
(1 / m) # The fermi energy for copper in J
EF = E / (1.6 * 10**-19) # The fermi energy for copper in eV
# Output
print 'The fermi energy for copper at absolute zero is %3.3f eV ' % (EF)
```

In [40]:

```
# Input data
t1 = 100. # The temperature of the source in degree centigrade
t2 = 0. # The temperature of the sinkk in degree centigrade
P = 100. # The power of the engine in watts (or) J/s
l = 80. # The latent heat of ice in cal/g
# Calculations
T1 = t1 + 273 # The temperature of the source in K
T2 = t2 + 273 # The temperature of the sinkk in K
L = l * 4.2 * 10**3 # The latent heat of ice in ergs/kg
W = P * 60 # The amount of work done in one minute in J
H2 = (W * T2) / (T1 - T2) # The amount of heat at the sinkk in J
m = (H2 / L) # The amount of ice melts in kg
# Output
print 'The amount of ice that will melt in one minute is %3.5f kg ' % (m)
```

In [41]:

```
# Input data
C1 = 1.84 # The RMS speed of molecules of hydrogen at NTP in km/s
p1 = 2. # The molecular weight of hydrogen
p2 = 32. # The molecular weight of oxygen
# Calculations
C2 = C1 * (p1 / p2)**(1. / 2) # The RMS speed of oxygen at NTP in km/s
C21 = C2 * 1000 # The RMS speed of oxygen at NTP in m/s
# Output
print 'The RMS speed of oxygen at NTP is %3.2f km/s (or) %3.0f m/s ' % (C2, C21)
```

In [42]:

```
# Input data
t = 101. # The temperature at which water boils in degree centigrade
p = 787. # The pressure maintained at water boils in mm of Hg
t1 = 100. # Normal boiling point of water in degree centigrade
T = t1 + 273 # Normal boiling point of water in K
p1 = 760. # The normal maintained pressure in mm of Hg
V2 = 1601. # The specific volume of water evaporation in cm**3
V1 = 1. # The specific volume of water in cm**3
# Calculations
V = V2 - V1 # The change in specific volume in cm**3
dT = t - t1 # The change in temperature in degree centigrade or K
dP = (p - p1) / 10 # The change in pressure in cm of Hg
L = (T * dP * 13.6 * 980 * V) / dT # Latent heat of steam in ergs/g
L1 = L / (4.2 * 10**7) # The latent heat of steam in cal/g
# Output
print 'The latent heat of steam is %3.4g ergs/g (or) %3.2f cal/g ' % (L, L1)
```

In [44]:

```
# Input data
d = 7.7 * 10**3 # The density of aluminium in kg/m**3
w = 27. # The atomic weight of Al in kg/k.mol
N = 6.023 * 10**26 # The number of free electrons in Al
k = 1.38 * 10**-23 # The boltzmann constant in J/K
h = 6.62 * 10**-34 # Planks constant in J.s
m = 9.1 * 10**-31 # The given mass of electrons in kg
pi = 3.14 # The testematical constant of pi
# Calculations
V = w / d # The volume occupied by Al in m**3/k.mol
E = (((3 * (N / V)) / pi)**(2. / 3)) * (h**2) * (1. / 8) * \
(1 / m) # The fermi energy for aluminium in J
EF = E / (1.6 * 10**-19) # The fermi energy for aluminium in eV
# The pressure of electrons in aluminium at absolute zero in N/m**2
p = (2. / 3) * (N / V) * (E)
# Output
print 'The fermi energy for aluminium at absolute zero is %3.3f eV \
\nThe pressure of electrons in aluminium at absolute zero is %3.4g N/m^2' % (EF, p)
```

In [45]:

```
# Input data
t2 = 20. # The temperature of room in degree centigrade
t1 = 37. # The skin temperature of the boy in degree centigrade
t = 10. # The given time in min
A = 3. # The surface area of the student in m**2
e = 0.9 # The emissivity of the student
# Calculations
T2 = t2 + 273 # The temperature of the room in K
T1 = t1 + 273 # The skin temperature of the boy in K
t1 = t * 60 # The given time in sec
s = 5.67 * 10**-8 # Stefans constant in W/m**2-K**4
R = e * A * s * (T1**4 - T2**4) # Heat loss by the skin in one second in J/s
Q = R * t1 # Total heat loss by the skin in 10 minutes in J
# Output
print 'The total heat loss by the skin in 10 minutes is %3.4g J ' % (Q)
```

In [46]:

```
# Input data
t1 = 20. # The temperature of the air in the cylinder of a combustion engine in degree centigrade
p1 = 1. # The initial pressure of the air in atmospheres
V1 = 8. * 10**-4 # The initial volume of the air in m**3
V2 = 6. * 10**-5 # The final volume of the air in m**3
g = 1.4 # The adiabatic index
# Calculations
T1 = t1 + 273 # The temperature of the air in K
p2 = p1 * (V1 / V2)**(g) # The final pressure of the gas in atmospheres
T2 = (p2 / p1) * (V2 / V1) * T1 # The final temperature of the gas in K
T21 = T2 - 273 # The final temperature of the gas in degree centigrade
# Output
print 'The final pressure of the gas is %3.1f atmospheres \
\nThe final temperature of the gas is %3.1f K (or) %3.1f degree centigrade ' % (p2, T2, T21)
```

In [47]:

```
# Input data
d = 2. * 10**-10 # The molecular diameter of an ideal gas in m
t = 20. # The temperature of the gas in degree centigrade
p = 1. # The pressure of the gas in atmosphere
pi = 3.142 # The mathematical constant of pi
# Calculations
T = t + 273 # The temperature of the gas in K
P = 1.01 * 10**5 # The pressure of the gas in N/m**2
v = 511. # The velocity of the molecules at 20 degree centigrade in m/s
k = 1.38 * 10**-23 # Boltzman constant in J/K
n = P / (k * T) # The number of molecules per m**3
l = 1. / (1.414 * pi * d**2 * n) # The mean free path in m
f = v / l # The collision frequency in per second
# Output
print '(a)The mean free path is %3.4g m \n (b)The collision frequency is %3.4g per second ' % (l, f)
```

In [48]:

```
# Input data
l = 1.876 * 10**-7 # The mean free path of the gas in m
v = 511. # The average speed of the molecule in m/s
# Calculations
f = v / l # The collision frequency in per second
# Output
print 'The collision frequency is %3.4g per second ' % (f)
```

In [49]:

```
import math
# Input data
s = 1. # The specific heat of water in k cal kg C
m = 1. # The mass of ice in kg
H = 80. # The latent heat of ice in kcal/kg
H1 = 540. # The latent heat of steam in kcal/kg
T = 273. # The temperature of the ice in K
T1 = 373. # The temperature of water at 100 degree centigrade in K
# Calculations
S1 = H / T # The increase in entropy when 1 kg of ice at 273 K is converted into water at 273 K in kcal/K
# The increase in entropy when 1 kg of water at 273 K is converted into
# water at 373 K in kcal/K
S2 = m * s * math.log(T1 / T)
S3 = H1 / T1 # The increase in entropy when 1 kg of water at 373 K is converted into steam at 373 K in kcal/K
S = S1 + S2 + S3 # The total increase in entropy in kcal/K
# Output
print 'The total increase in entropy is %3.3f kcal/K ' % (S)
```

In [50]:

```
# Input data
t1 = 27. # The initial temperature of the gas in degree centigrade
g = 1.4 # The adiabatic index
p1 = 1. # Let the initial pressure in atmospheres
p2 = 2. * p1 # The final pressure in atmospheres
# Calculations
T1 = t1 + 273 # The initial temperature of the gas in K
# The final temperature of the gas in K
T2 = (((p2 / p1)**(g - 1)) * (T1)**g)**(1 / g)
T = T2 - T1 # The rise in temperature of a gas in K or degree centigrade
# Output
print 'The rise in temperature is %3.1f degree centigrade ' % (T)
```

In [51]:

```
# Input data
V1 = 10.**-3 # One litre of monoatomic perfect gas at NTP in m**3
V2 = (V1 / 2) # The final volume in m**3
g = 1.67 # The adiabatic index
# Calculations
# The work done on the gas in J
W = (1 / (g - 1)) * ((1 / (V2)**(g - 1)) - (1 / (V1)**(g - 1)))
# Output
print 'The work done on the gas is %3.1f J ' % (W)
```

In [57]:

```
# Input data
T1 = 1200. # The temperature at which first engine receives heat in K
T2 = 300. # The temperature at which second engine rejects to heat reservoir in K
# Calculations
# The temperature when the work outputs of two engines are equal in K
Tw = (T1 + T2) / 2
# The temperature when the efficiency of two engines are equal in K
Te = (T1 * T2)**(1. / 2)
# Output
print '(a)The temperature when the work outputs of two engines are equal is %3.0f K \n (b)The temperature when the efficiency of two engines are equal is %3.0f K ' % (Tw, Te)
```

In [56]:

```
# Input data
t1 = 27. # The temperature of the source in degree centigrade
t2 = -73 # The temperature of the sinkk in degree centigrade
H2 = 300. # The amount of heat released by the sinkk in cal
# Calculations
T1 = t1 + 273 # The temperature of the source in K
T2 = t2 + 273 # The temperature of the sinkk in K
H1 = H2 * (T1 / T2) # The amount of heat released by the source in cal
W = H1 - H2 # The work performed per cycle in cal
W1 = W * 4.2 # The work performed per cycle in J
# Output
print 'The work performed by the engine per cycle is %3.0f J ' % (W1)
```

In [55]:

```
# Input data
m = 3. # The rate at which ice melts in kg/hour
t = 28. # The external temperature in degree centigrade
Li = 3.3 * 10**5 # Specific latent heat of ice fusion in Jkg**-1
s = 4.2 * 10**3 # The specific heat in Jkg**-1.C
# Calculations
Q = (m * Li) + (m * s * t) # The heat taken by the ice to melt into water in J
P = Q / 3600 # To prevent melting of ice ,the refrigerator should have the power out in J/s
# Output
print 'The minimum power output of the motor is %3.0f watts ' % (P)
```

In [58]:

```
# Input data
Li = 3.3 * 10**5 # Specific latent heat of ice fusion in Jkg**-1
V1 = 1.090 * 10**-3 # The specific volume of one kg of ice in m**3
V2 = 10.**-3 # The specific volume of one kg of water in m**3
T = 273. # The temperature maintained in K
dP = 1.01 * 10**5 # The increase in pressure in N/m**2
# Calculations
# The depression in the melting point of ice in K (or) degree centigrade
dT = -(dP * T * (V2 - V1)) / Li
# Output
print 'The depression of melting point of ice is %3.2g K (or) %3.2g degree centigrade ' % (dT, dT)
```

In [59]:

```
# Input data
dp = 100. # The change in mercury pressure in cm of Hg
v2 = 1601. # Specific volume of steam in cm**3/gram
v1 = 1. # Specific volume of water in cm**3/gram
l = 536. # Latent heat in cal/gram
t = 100. # The temperature of the steam in degree centigrade
# calculations
dP = 1. * 13.6 * 10**3 * 9.8 # The change in mercury pressure in N/m**2
V2 = v2 * 10**-3 # Specific volume of steam in m**3/kg
V1 = v1 * 10**-3 # Specific volume of water in m**3/kg
L = l * 4.2 * 10**3 # Latent heat in J/kg
T = t + 273 # The temperature of the steam in K
# The increase in boiling point of water in K or degree centigrade
dT = (dP * T * (V2 - V1)) / L
# Output
print 'The increase in boiling point of water is %3.2f K (or) %3.2f degree centigrade ' % (dT, dT)
```

In [60]:

```
# Input data
L = 80. # The latent heat of fusion of ice in cal/gm
Li = 3.3 * 10**5 # Specific latent heat of ice fusion in Jkg**-1
dp = 1. # The increase in pressure in atmospheres
t = 0. # The given temperature in degree centigrade
v = -0.1 # The change in specific volume in cm**3/gm
# Calculations
dP = 0.76 * 13.6 * 10**3 * 9.8 # The increase in pressure in N/m**2
V = v * 10**-3 # The change in specific volume in m**3/kg
T = t + 273 # The given temperature in K
# The decrease in the melting point of ice with increase in the pressure
# of one atmosphere in K
dT = -(dP * T * (V)) / Li
# Output
print 'The decrease in melting point of ice is %3.4f K (or) %3.4f degree centigrade ' % (dT, dT)
```

In [61]:

```
import math
# Input data
R = 8.4 # The universal gas constant in J.mol**-1.K**-1
Cv = 21. # The spacific heat at constant volume in J.mol**-1.K**-1
P1 = 2. * 10**5 # The initial pressure of gas in N/m**2
V1 = 20. # The initial volume of the gas occupied in litres
P2 = 5. * 10**5 # The final pressure of the gas in N/m**2
V2 = 50. # The final volume of the gas occupied in litres
# Calculations
# The ratio of final temperature to the initial temperature for perfect gas
T = (P2 * V2) / (P1 * V1)
V = V2 / V1 # The ratio of final volume to the initial volume for perfect gas
S = (Cv * math.log(T)) + (R * math.log(V)) # The change of entropy in J/K
# Output
print 'The increase in entropy is %3.2f J/K ' % (S)
```

In [62]:

```
import math
# Input data
s = 4.2 * 10**3 # The specific heat of water is J/kg.C
m1 = 0.1 # The mass of water at 15 degree centigrade in kg
m2 = 0.16 # The mass of water at 40 degree centigrade in kg
t1 = 15. # The temperature of the first water in degree centigrade
t2 = 40. # The temperature of the second water in degree centigrade
# Calculations
T1 = t1 + 273 # The temperature of the first water in K
T2 = t2 + 273 # The temperature of the second water in K
T = ((m1 * T1) + (m2 * T2)) / (m1 + m2) # The final mixed temperature in K
# The change in entropy for 0.1 kg of water in J/K
s1 = m1 * s * 2.3026 * math.log10(T / T1)
# The change in entropy for 0.16 kg of water in J/K
s2 = m2 * s * 2.3026 * math.log10(T / T2)
S = s1 + s2 # The net change in the entropy of the system in J/K
# Output
print 'The net increase in entropy is %3.2f J/K ' % (S)
```

In [63]:

```
import math
# Input data
m = 12.5 * 10**-3 # The amount of ice in kg
li = 80. # Latent heat of ice in cal/gram
l = 536. # Latent heat of steam in cal/gram
si = 0.5 # Specific heat of ice in cal/gram-K
sw = 1. # Specific heat of water in cal/gram-K
T1 = -24 + 273 # The initial temperature of ice in K
T2 = 0. + 273 # The final temperature of ice in K
T3 = 100. + 273 # The final temperature of water in K
# Calculations
Li = li * 10**3 * 4.2 # The latent heat of ice in J/kg
Ls = l * 10**3 * 4.2 # The latent heat of water in J/kg
Si = si * 10**3 * 4.2 # The specific heat of ice in J/kg-K
Sw = sw * 10**3 * 4.2 # The specific heat of water in J/kg-K
# The increase in entropy of ice from 249 K to 273 K in J/K
s1 = m * Si * math.log(T2 / T1)
s2 = (m * Li) / T2 # The increase in entropy from 273 K ice to 273 K water in J/K
# The increase in entropy of water from 273 K to 373 K in J/K
s3 = m * Sw * math.log(T3 / T2)
# The increase in entropy from water at 373 K to steam at 373 K in J/K
s4 = (m * Ls) / T3
S = s1 + s2 + s3 + s4 # The total increase in entropy in J/K
# Output
print 'The total increase in entropy is %3.2f J/K ' % (S)
```

In [64]:

```
# Input data
x1 = 20. # The initial thickness of the layer in cm
x2 = 30. # The final thickness of the layer in cm
t1 = -15 # The temperature of the surroundings in degree centigrade
L = 80. # The latent heat of ice in cal/gram
d = 0.9 # The given density of ice in g/cm**3
K = 0.005 # The coefficient of thermal conductivity in C.G.S units
# Calculations
t = ((d * L) / (2 * K * t1)) * (x1**2 - x2**2) # The time taken in sec
# Output
print 'The time taken for a layer of ice to increase the thickness is %3.2g sec ' % (t)
```

In [65]:

```
# Input data
t1 = 121. # The temperature of solid copper sphere in degree centigrade
dt1 = 2.6 # The rate of cooling of copper sphere in degree centigrade per minute
t2 = 195. # The temperature of another solid sphere in degree centigrade
t = 30. # The surrounding temperature in degree centigrade
# Calculations
T1 = t1 + 273 # The temperature of solid copper sphere in K
T2 = t2 + 273 # The temperature of another solid copper sphere in K
T0 = t + 273 # The surrounding temperature in K
R1 = 1. # Let the radius of the first sphere in m
R2 = 2. * R1 # The radius of the second sphere in m
# The rate at which solid copper sphere cools in degree centigrade per minute
dt2 = (dt1) * (R1 / R2) * ((T2**4 - T0**4) / (T1**4 - T0**4))
# Output
print 'The rate at which solid copper sphere cools is %3.3f degree centigrade per minute ' % (dt2)
```

In [66]:

```
# Input data
dt = 250. # The temperature gradient of an insulated copper rod in degree centigrade per metre
x = 0.05 # The distance between the two points in m
K = 384. # The thermal conductivity of copper in W.m**-1.K**-1
A = 1. # The surface area of the copper rod in m**2
t = 1. # The given time in seconds
# Calculations
T = dt * x # The temperature difference in degree centigrade
# The amount of heat crossed per unit area per sec in J/s
Q = K * A * (dt) * t
# Output
print '(1)The difference in temperature between two points seperated by 0.05m is %3.1f degree centigrade \n (2)The amount of heat crossing per second per unit area normal to the rod is %3.2g J/s ' % (T, Q)
```

In [67]:

```
import math
# Input data
T1 = 200. # The first temperature of the black body in K
T2 = 2000. # The second temperature of the black body in K
s = 5.672 * 10**-8 # Stefans constant in M.K.S units
# Calculations
# The comparision of radiant emittance of a black body for given
# temperatures
R = (s * T1**4) / (s * T2**4)
# Output
print 'The comparision of radiant emittance of a black body at 200 K and 2000 K is %3.0g ' % (R)
```

In [68]:

```
import math
# Input data
d = 0.08 # The diameter of the black sphere in m
T = 500. # The temperature of the black sphere in K
T0 = 300. # The temperature of the surroundings in K
s = 6. * 10**-8 # The stefans constant in W m**-2 K**-4
pi = 3.14 # The mathematical constant of pi
# Calculations
A = pi * d**2 # The area of the black sphere in m**2
e = 1. # The emittance of the black body
# The rate at which energy is radiated in J/s or watts
R = s * A * e * (T**4 - T0**4)
# Output
print 'The rate at which energy is radiated R = %3.2f J/s (or) %3.2f watts' % (R, R)
```