In [4]:

```
# Variables
Pvacc = 700.; # mm of hg
Patm = 760.; # mm of hg
# Calculations
Pabs = Patm - Pvacc; # mm of hg
# Results
print "Absolute pressure in in = %.4f kg/cm**2"%(Pabs/760)
print "Absolute pressure in = %.4f bar"%(Pabs*1.01325/760)
print "Absolute pressure in in = %.3f kPa"%(Pabs*1.01325/760*10**2)
```

In [1]:

```
# Variables
Patm = 101; # kpa
Rho = 13.6 * 10**3; # in kg per m**3
h = 250; # in cm
h = h*10**-2; # in m
g = 9.806;
# Calculations
p = Rho * g * h; # in N/m**2
p= p*10**-3; # in kPa
# Total pressure in tank
p = p + Patm; # in kpa
p = p*10**-3; # in Mpa
# Results
print "Total pressure in tank in = %.3f Mpa"%p
```

In [3]:

```
import math
# Variables
m = 1.5; # in kg
pi = 0.1; # in MPa
pi= pi*10**6; # in Pa
pf = 0.7; # in MPa
pf= pf*10**6; # in Pa
rho_i = 1.16; # kg per m**3
# Calculations and Results
vi = m/rho_i # in m**3
WorkDone= pi*vi*math.log(pi/pf); # in J
print "Work done in kJ is : %.2f"%(WorkDone*10**-3)
if WorkDone<0:
print ("The -ve sign indicates work is done on the system, hence");
print "The work done by the piston in kJ is : %.2f"%abs(WorkDone*10**-3)
```

In [4]:

```
# Variables
p = 1.0; # in Mpa
p = p*10**6; # in N per m**2
del_v = 1.5; #m**3 per min
# Calculations
del_v = del_v*60; # m**3 per h
W = p * del_v; # W standard for work done in J
W = W*10**-6; # in MJ
# Results
print "Work done by the pump upon the water in an hour in MJ is : ",W
```

In [8]:

```
# Variables
g = 9.81;
J = 4.1868*10**3;
# Calculations
# W = 2*g*h
# due to stirring of water
m = (0.2+10*10**-3)*10**3; # in gm
s= 1; # in cal per gm°C
del_T = 2; # in ° C
H = m * s * del_T # in cal
H = H*10**-3; # in kcal
# W = JH and W= 2*g*h
h = J*H/(2 * g); # in m
# Results
print "The height from the mass should be fall in meter is : %.2f"%h
```

In [10]:

```
# Variables
# mass of 1 litr of water is 1 kg. so
m = 5000; # in kg
h = 10-1; # in m
g= 9.81; #
# Calculations
PE = m * g * h; # in N m
PE = PE*10**-3; # in kj
Eta = 0.85;
# Eta = energy output/energy input
E_input = PE/Eta; # in Kj
E_input = E_input*10**3; # in J
t = 45; # time in min
t = t*60; # in sec
P = E_input/t; # in J/s
P = P*10**-3; # in kW
# Results
print "Power required for the feed pump in kW is : %.3f"%P
```

In [7]:

```
# Variables
V = 50.; # km per hr
V = V * (1000./3600); # in m per sec
F = 900.; # in N
# Calculations and Results
P = F * V # in watt
P = P *10**-3; # in kW
print "Power of the engine of a car in kW is : ",P
H = P * 60 # in kJ
print "Heat equivalent of work per minute in kJ is",H
```

In [8]:

```
# Variables
E_air = 200-100; # in kJ/kg
E_lost = 40; # in kJ/kg
# Calculations
E_total = E_air + E_lost; # in kJ per kg
M = 0.5; # mass flow rate in kg per s
P = M * E_total; # in kJ/s
# Results
print "Power required for an air mass flowin kJ/s is :",P
```

In [9]:

```
# Variables
m_b = 1.; # in kg
t_ib = 80; #in degree c
m_w = 10.; # in kg
t_iw = 25; # in degree c
del_t = 5.; # in degree c
S_w = 4.18; # in kJ/kg
# Calculations
t_equ = (t_iw + del_t); # in degree c
# Heat loss by metal = Heat gained by water
S_b = m_w * S_w * (t_equ - t_iw)/(m_b * (t_ib - t_equ)); # in kJ/kg-K
# Results
print "Specific heat of metal block in kJ/kg-K is",S_b
```

In [2]:

```
# Variables
P_gauge = 90; # in cm of hg
P_atm = 760; # in mm of hg
P_atm = 76; # in cm of hg
# Calculations and Results
P_abs = P_gauge + P_atm; # in cm of hg
P_abs = P_abs * (101.32/76); # in kPa
print "Reading of pressure in kPa is %.3f"%P_abs
# Part (b)
P_vacuum = 40; # in cm of hg
P_abs = P_atm - P_vacuum; # in cm of hg
P_abs = P_abs * (101.32/76); # in kpa
print "Reading of pressure in Kpa %.2f "%P_abs
# Part (c)
Rho = 1000; # in kg per m**3
g = 9.81; #
h = 1.2; # in m
P_gauge = Rho * g * h; # in N m**2
P_gauge= P_gauge*10**-3; # in kPa
P_atm = 101.32; # in kPa
P_abs = P_gauge + P_atm; # in kpa
print "Reading of pressure in kPa",P_abs
```

In [13]:

```
import math
from scipy.integrate import quad
g=9.81; # in m/s**2
P=1.0332*10**5; # in kN/m**2
def f4(p):
return (1./p)**(1/1.4)
H= 1/g*(2.3*10**4)**(1/1.4)* quad(f4,0,P)[0]
print "The value of H in km is : %.2f"%(H*10**-3)
# Note: There is calculation error in the book, so the answer differs.
```