In [1]:

```
from __future__ import division
from math import factorial
print "Example 29.2 page no 455\n\n"
#the probability distribution of the number of defectives in a sample of five pump drawn with replacement from lot of 1000 pump
#the probability distribution of x, thenumber of sucess in n performances of th erandom experiment is the probability distribution function
#P(x) = (factorial(n)/factorial(x)*(factorial n -factorial x))*(p**x*q**n-x)
n=5#no. of performances
x=3#no. of successes
p=0.05#probability of sucesses when the sample of pump is drawn with replacement
q=1-p#probability of faliure
P=factorial(n)*((p**x)*(q**(n-x)))/(factorial(x)*(factorial(n)-factorial(x)))#probability when x=3#probability when x=3/factorial(x)*(factorial(n)-factorial(x))*(p**x*q**(n-x))#probability when x=3
print "\n probability P=%.2e "%(P)# #calculation error in book
```

In [2]:

```
from __future__ import division
from math import sqrt,pi
print "Example 29.3 page no 455"
#an iron foundry has four work stations that are connected to single duct
v_air=4000#the minimum air velocity required for general foundry dust,ft/min
v_air_s=v_air/60#velocity of air in ft/s
n=4#no. of duct
q_e=3000#each duct transport air,acfm
q=n*q_e#total transport,acfm
A=q/v_air#cross sectional area required ,ft**2
D=sqrt(4*A/pi)#duct diameter,ft
rho=0.075#density of air
meu=1.21e-5#viscosity of air
R_e=D*rho*v_air_s/meu#reynolds no
print "\n reynolds no. R_e=%.2f "%(R_e)#
f=0.003#/fanning friction factor,since R_e >20000
L=400#duct length
g_c=32.2#grav. acc.
P_drop_d=(4*f*L*v_air_s**2*rho)/(2*g_c*D)#pressure drop in the duct
print "\n pressure drop in duct P_drop_d=%.2f lbf/ft**2"%(P_drop_d)#
P_drop_h=0.5*5.2#pressure drop in hood
P_drop_cyc=3.5*5.2#pressure drop in cyclone cleaner
P_drop_t=P_drop_d + P_drop_h + P_drop_cyc#total prssure drop
print "\n total pressure drop P_drop_t=%.2f lbf/ft**2"%(P_drop_t)#
neta=0.4#pump efficiency
hp=(P_drop_t*q/neta)*3.03e-5#power required in hp
print "\n power required hp=%.2f hp "%(hp)#
```

In [3]:

```
from __future__ import division
print "Example 29.6 page no 458\n\n"
#a baghouse has been used to clean a particulate gas steam
l_i=5#inlet loading,grains/ft**3
l_o=0.03#outlet loading,grains/ft**3
l_o_max=0.4#maximum outlet loading,grains/ft**3
E_b=(l_i-l_o)/l_i#efficiency before bag failure
P_t=1-E_b#penetration before bag failure
E=(l_i-l_o_max)/l_i#efficiency on regulatory conditions
P_t_r=1-E#penetration regulatory conditons
P_tc=P_t_r-P_t#penetration associated with failed bags
print "\n penetration associated with failed bags P_tc=%.2f "%(P_tc)#
P_drop=6#pressure drop,in of H2O
T=250#temperature,deg F
q=50000#volumetric flow rate,acfm
D=8#diamter of bags,in
L= q*P_tc/(0.582*P_drop**0.5*D**2*(T+460)**0.5)#number of bag failure that the system can tolerate and still remain in compliance
print "\n no. of bags L=%.2f "%(L)#
#thus if two bags fail,baghouse is out of complance
```

In [4]:

```
from __future__ import division
print "Example 29.7 page no 461\n\n"
#a reactor is located in a relatively large laboratory,the reactor can emit as much as of hydrocarbon into the room if a safety valves ruptures
v=1100#volume of reactor,m**3
T=295#temperature of reactor,K
v_s=0.0224#volume of gas at STP,m**3
T_s=273#standard temperature,K
n_air=(v/v_s)*(T_s/T)#total gmoles of air in the room
print "\n n_air=%.2f gmol"%(n_air)#
v_r=0.75#Hydrocarbon emit by reactor,gmol
x_hc= (v_r/(n_air + v_r))*10**9#mole fraction of hydrocarbon in the room,parts per billion
print "\n mole fraction of HC x_hc=%.2f ppb "%(x_hc)#
```