#Original and new length(m)
import math
# Variables
L1 = 32. # diameter pipe
L2 = 50. # pipeline length
sigma1 = 8. # bottles
# Calculations
# For small deviaqtion from plug flow,sigma_sqr is directly proportional to L
sigma2 = sigma1*math.sqrt(L2/L1);
# Results
print " No of bottles of rose expected is %.f"%(sigma2)
# Variables
sigma1 = 14. # hours
sigma2 = 10.5; # hours
L1 = 119. # ohio miles apart
# Calculations
#spread of curve is directly proportional to sqrt of distance from origin
L = sigma1**2*L1/(sigma1**2-sigma2**2);
# Results
print " The dumping of toxic phenol must have occured within %.f miles upstream of cincinnati"%(L)
# Variables
# from figure
vo = 1.;
t1 = 1./6;
t2 = 1.;
t3 = 11./6;
w = 1./10;
# Calculations
A2_by_A1 = 0.5;
R = A2_by_A1/(1-A2_by_A1);
#From the location of 1st peak
V1 = (R+1)*vo*t1;
#From the time between peaks
V2 = (R*vo)*((t2-t1)-(t1));
#From fig 14.3
N = 1+(2*(t1/w))**2;
# Results
print " The reflux ratio is %.f"%(R)
print " The volume of 1st tank is %.3f"%( V1)
print " The volume of 2nd tank is %.3f"%(V2)
print " The number of tanks are %.f "%(N)
%matplotlib inline
from matplotlib.pyplot import *
import math
from numpy import *
# Variables
# from figure E14.4a
t2 = 280.
t1 = 220.
sigma1_sqr = 100.
sigma2_sqr = 1000.
# Calculations
dt = t2-t1;
dsigma_sqr = sigma2_sqr-sigma1_sqr;
N = dt**2/dsigma_sqr;
E = zeros(200)
for t in range(200):
E[t] = ((t**(N-1))*(N**N)*math.exp(-t*N/dt))/((math.factorial(N-1))*(dt**N));
t = zeros(200)
for i in range(200):
t[i] = i;
# Results
plot(t,E)
xlabel("t, s")
ylabel("E, s**-1")
show()