In [1]:

```
import math
from scipy.integrate import quad
# Variables
Co = 1.
k = 1.
t = 1. #given
# Calculations and Results
C1 = (-1+math.sqrt(1-4*t*(-Co)))/2*t;
#For the plug flow reactor
#t = 1/k(1/C2-1/C1)
C2 = C1/(1+k*t*C1);
print " Conversion for flow scheme A is %.3f"%(C2)
#For plug flow
C3 = Co/(1+k*t*Co);
#For mixed flow reactor
C4 = (-1+math.sqrt(1-4*t*(-C3)))/2*t;
print " Conversion for flow scheme B is %.3f"%(C4)
#Using exit age distribution fn for 2 equal plug-mixed flow reactor system,umath.sing fig 12.1
t_bar = 2.
in_ = 1000.
def f3(t):
return (2/t_bar)*(math.exp(1-2*t/t_bar))/(1+Co*k*t)
C5 = quad(f3,t_bar/2,in_)[0]
print " Conversion for flow scheme C,D,E is %.3f"%(C5)
```

In [ ]:

```
```