import math
# Variables
CAo = 185.
CA = 100.
t = 30.
# Calculations
K123 = math.log(CAo/CA)/t;
m1 = 2.;
k2 = m1/CAo;
##From the initial rate of formation of R
m2 = 1.3;
k1 = m2/CAo;
k3 = K123-k1-k2;
k4 = 0.0001
while k4 <= 0.1:
Csmax = CAo*(k1/K123)*((K123/k4)**(k4/(k4-K123)));
if Csmax>31.8 and Csmax<32.2:
break
k4 += 0.0001
k5 = 0.001
#similarly for T
while k5 <= 0.2:
Ctmax = CAo*(k3/K123)*((K123/k5)**(k5/(k5-K123)));
if Ctmax>9.95 and Ctmax<10.08:
break
k5 += .0001
# Results
print " The rate constants are"
print " k1 = %.4f min**-1"%(k1)
print " k2 = %.4f min**-1"%(k2)
print " k3 = %.4f min**-1"%(k3)
print " k4 = %.4f min**-1"%(k4)
print " k5 = %.4f min**-1"%(k5)