#Lets say F(Ri)/F = F_ri
# Variables
F_50 = 0.3
F_100 = 0.4
F_200 = 0.3;
t_50 = 5.
t_100 = 10.
t_200 = 20.
tp = 8.
# Calculations
a = ((1-(tp/t_50))**3)*F_50
b = ((1-(tp/t_100))**3)*F_100
c = ((1-(tp/t_200))**3)*F_200;
g = [a,b,c];
sum1 = 0;
for p in range(3):
if g[p]>0:
sum1 = sum1+g[p];
f_converted = 1-sum1;
# Results
print " The fraction of solid converted equals %.1f %%"%(f_converted*100)
# Variables
t_avg = 60. # min
t = 20. #min
# Calculations
unconverted = ((1./4)*(t/t_avg))-((1./20)*(t/t_avg)**2)+((1./120)*(t/t_avg)**3);
unconverted1 = ((1./5)*(t/t_avg))-((19./420)*(t/t_avg)**2)+((41./4620)*(t/t_avg)**3);
c_avg = (unconverted+unconverted1)/2;
# Results
print "Fraction of original sulfide ore remain unconverted is %.2f"%(c_avg)
# Variables
F = 1000. #gm/min
W = 10000. #gm
# Calculations
t_avg = W/F;
F_50 = 300.
F_100 = 400.
F_200 = 300. #gm/min
t_50 = 5.
t_100 = 10.
t_200 = 20. #min
unconverted = ((((1./4)*(t_50/t_avg))-((1./20)*(t_50/t_avg)**2)+ ((1./120)*(t_50/t_avg)**3))*(F_50/F))+((((1./4)*(t_100/t_avg))-((1./20)*(t_100/t_avg)**2)+((1./120)*(t_50/t_avg)**3))*(F_100/F))+((((1./4)*(t_200/t_avg))-((1./20)*(t_200/t_avg)**2)+((1./120) *(t_50/t_avg)**3))*(F_200/F))
converted = 1-unconverted;
# Results
print "The mean conversion of soild is %f"%(converted)
print " The answer slightly differs from those given in book as we have considered \
only significant terms in infinite series"
# Variables
t1 = 1. #hr
t2 = t1/0.1
a = 0.
r = 1 #ton/hr
# Calculations
while a<=1:
x = (1./4)*(a)-((1./20)*(a)**2)+((1./120)*(a)**3);
if x >0.099 and x<0.1005:
r = a;
a += .0001
FBo = 1. #tons/hr
t_avg = t2/r;
W = t_avg*FBo;
# Results
print " The needed weight of bed is %.f"%(W),
print "tons"