In [1]:

```
import math
from scipy.optimize import fsolve
#Variable declaration
A0=0.25 #[M]
At=0.15 #[M]
k=6.7*10**-4
#Calculation
def f(t):
x=math.log10(A0/At)-(k*t)/2.303
return(x)
t=fsolve(f,1)
#Result
print"Time taken to decrease concentration is%.3e"%t[0],"s (approx)"
print"NOTE: Approximate value taken in book"
```

In [2]:

```
#Variable declaration
#Initially:
A=0.1 #Concentration of A
B=0.1 #Concentration of B
rate=5.5*10**-6 #Rate of reaction initial in M/s
x=2 #exponent
y=1 #exponent
#Calculation
order=x+y #Reaction order
k=rate/((A**x)*(B**y)) #Rate law constant in [M**2/s]
#Result
print"The rate law is k=rate/(A**2)*(B)"
print"\nRate constant is %.2e"%k,"M**2/s"
```

In [1]:

```
#Variable declaration
T=[700.0,730.0,760.0,790.0] #Temperature in [K]
k=[0.011,0.035,0.195,0.343] #rate constants in [L/mol s]
import numpy
onebyT=numpy.reciprocal(T) #Reciprocal of temperature
log_k=numpy.log10(k) #log of k
R=8.30*10**-3 #[kJ/kmol]
#Calculation
%matplotlib inline
import matplotlib.pyplot as plt
plt.plot(onebyT,log_k)
plt.ylabel('$log k$')
plt.xlabel('$1/T$')
plt.title('1/T vs log k\n')
slope,intercept=np.polyfit(onebyT,log_k,1)
print"Slope is",slope
plt.show()
slope=-9.9*10**3 #Slope given in book [K]
E_star=slope*(-2.303*R) #Activation energy in [kJ/mol]
#Result
print"Activation energy of reaction is",round(E_star,1),"kJ/mol"
print"NOTE that in book slope is approximated as 9.9*10**3 K"
```

In [2]:

```
#Variable declaration
T1=10.0 #in min
T2=20.0 #in min
a=25.0 #amount of KMnO4 in ml at t=0min#
a1=20.0 #amount of KMnO4 in ml at t=10min or a-x value at t=10#
a2=15.7 #a-x value at t=20min#
import math
#Calculation
k1=(2.303/T1)*math.log10(a/a1) #formula of rate constant for first order reaction#
print"At t=10min rate constant k=",round(k1,5),"/min"
k2=(2.303/T2)*math.log10(a/a2) #rate constant formula#
#Result
print"\nAt t=20min rate constant k=",round(k2,5),"/min"
print"\nNOTE:Calculation mistake in book"
print"\nIf we calculate the rate constant at other t values we will see that k values are almost constnat"
```

In [3]:

```
#Variable declaration
T=40.5 #in min#
R1=25.0 #percentage of decomposed reactant#
import math
#Calculation
R2=100.0-R1 #percentage of left out reactant which is a-x value#
R3=100.0/R2 #value of a/(a-x)#
K=(2.303/T)*math.log10(R3) #formula of rate constant for first order reaction#
#Result
print"The rate constant of the reaction is %.2e"%K,"/min"
```

In [4]:

```
#Variable declaration
pi=0.0 #pressure of N2 at t=0#
t1=2.0
t2=8.0
t3=16.0
t4=24.0
t5=50.0
pf=34.0 #pressure of N2 at infinity#
p1=1.6 #pressure of N2 at t=2min#
p2=6.2 #pressure of N2 at t=8min#
p3=11.2 #pressure Of N2 at t=16min#
p4=15.5 #pressure of N2 at t=24min#
p5=24.4 #pressure of N2 at t=50min#
import math
#Calculation
a=pf-pi #value of a#
a1=pf-p1 #a-x value at t=2min#
a2=pf-p2 #a-x value at t=8min#
a3=pf-p3 #a-x value at t=16min#
a4=pf-p4 #a-x value at t=24min#
a5=pf-p5 #a-x value at t=50min#
k1=(1/t1)*math.log(a/a1) #rate constant at t=2min#
k2=(1/t2)*math.log(a/a2) #rate constant at t=8min#
k3=(1/t3)*math.log(a/a3) #rate constant at t=16min#
k4=(1/t4)*math.log(a/a4) #rate constant at t=24min#
k5=(1/t5)*math.log(a/a5) #rate constant at t=50min#
k=(k1+k2+k3+k4+k5)/5
#Result
print"Time(min): 2\t\t8\t\t16\t\t24\t\t50"
print"k1 per min %.2e\t"%k1,"%.2e\t"%k2,"%.2e\t"%k3,"%.3e\t"%k4,"%.2e"%k5
print"\nAverage rate constant is %.3e"%k,"min^-1"
```

In [5]:

```
#Variable declaration
t1=0
t2=4.89
t3=10.07
t4=23.66
v1=47.65 #ml of alkali used at t=0min or a value#
v2=38.92 #ml of alkali used or a-x value at t=4.89min#
v3=32.62 #ml of alkali used or a-x value at t=10.07min#
v4=22.58 #ml of alkali used or a-x value at t=23.66min#
#Calculation
x2=v1-v2 #x value at t=4.89min#
x3=v1-v3 #x value at t=10.07min#
x4=v1-v4 #x value at t=23.66min#
k22=(1/t2)*(x2/(v1*v2)) #rate constant for second order equation#
#Result
print"Rate constant k2 value at t=",t2,"min is ",round(k22,6),"/min"
k23=(1/t3)*(x3/(v1*v3)) #rate constant for second order equation#
print"\nRate constant k2 value at t=",t3,"min is ",round(k23,6),"/min"
k24=(1/t4)*(x4/(v1*v4)) #rate constant for second order equation#
print"\nRate constant k2 value at t=",t4,"min is",round(k24,5),"/min"
print"\nAlmost constant values of k2 indicate that reaction is second order"
```

In [6]:

```
#Variable declaration
t=1590 #half life of given radio active element in years#
#Calculation
k=0.693/t #formula of decay constant for first order reactions#
#Result
print"the value of decay constant is ",round(k,6),"/year"
```

In [7]:

```
#Variable declaration
t1=5.0
t2=15.0
t3=25.0
t4=45.0
a=37.0 #volume of KMnO4 in cm**3 at t=0 or value of a#
a1=29.8 #volume of KMnO4 in cm**3 or a-x value at t=5min#
a2=19.6 #volume of KMnO4 in cm**3 or a-x value at t=15min#
a3=12.3 #volume of KMnO4 in cm**3 or a-x value at t=25min#
a4=5.0 #volume of KMnO4 in cm**3 or a-x value at t=45min#
import math
#Calculation
k1=(2.303/t1)*math.log10(a/a1)
print"\nRate constant value at t=5min is %.3e"%k1,"min**-1"
k2=(2.303/t2)*math.log10(a/a2)
print"\nRate constant value at t=15min is %.3e"%k2,"min**-1"
k3=(2.303/t3)*math.log10(a/a3)
print"\nRate constant value at t=25min is %.3e"%k3,"min**-1"
k4=(2.303/t4)*math.log10(a/a4)
print"\nRate constant value at t=45min is %.3e"%k4,"min**-1"
print"\nAs the different values of k are nearly same,the reaction is of first oredr."
k=(k1+k2+k3+k4)/4.0
#Result
print"\nThe average value of k is %.3e"%k,"min**-1"
```

In [8]:

```
#Variable declaration
k=6.0*10**-4 #rate constant of first order decomposition of N2O5 in CCl4 in /min#
#Calculation
#Part-a#
k1=k/60.0
#Part-b#
t=0.693/k
#Result
print"(a) Rate constant in terms of seconds is ",k1,"/s"
print"\n(b) Half life of the reaction is %.2e"%t,"min"
print"NOTE:Slight rounding off in book in final answer"
```

In [9]:

```
#Variable declaration
t1=40.0
t2=80.0
t3=120.0
t4=160.0
t5=240.0
vi=0.0 #volume of oxygen collected at constant pressure in ml at t=0#
v1=15.6 #volume of oxygen collected at constant pressure in ml at t=40#
v2=27.6 #volume of oxygen collected at constant pressure in ml at t=80#
v3=37.7 #volume of oxygen collected at constant pressure in ml at t=120#
v4=45.8 #volume of oxygen collected at constant pressure in ml at t=160#
v5=58.3 #volume of oxygen collected at constant pressure in ml at t=200#
vf=84.6 #volume of oxygen collected at constant pressure in ml at t=infinity#
import math
#Calculation
a=vf-vi #the initial concentration of N2O5 in solution i.e a#
a1=vf-v1 #a-x value at t=40min#
a2=vf-v2 #a-x value at t=80min#
a3=vf-v3 #a-x value at t=120min#
a4=vf-v4 #a-x value at t=160min#
a5=vf-v5 #a-x value at t=200min#
k1=(1.0/t1)*math.log(a/a1)
k2=(1.0/t2)*math.log(a/a2)
k3=(1.0/t3)*math.log(a/a3)
k4=(1.0/t4)*math.log(a/a4)
k5=(1.0/t5)*math.log(a/a5)
#Result
print"Time(min): 40\t\t80\t\t120\t\t160\t\t240"
print"k1 per min %.2e\t"%k1,"%.2e\t"%k2,"%.2e\t"%k3,"%.3e\t"%k4,"%.2e"%k5
print"\nNOTE:Calculation mistake in book in calculating a4,it should be 38.8"
print"\nAs k value is fairly constant the reaction is first order"
```

In [10]:

```
#Variable declaration
t1=120.0 #time in sec#
t2=240.0
t3=530.0
t4=600.0
a=0.05 #initial concentration#
x1=32.95 #extent of reaction or x value at t=120sce#
x2=48.8 #extent of reaction or x value at t=240sce#
x3=69.0 #extent of reaction or x value at t=530sce#
x4=70.35 #extent of reaction or x value at t=600sce#
a1=100.0-x1 #extent of left out or a-x value at t=120sec#
a2=100.0-x2 #extent of left out or a-x value at t=240sec#
a3=100.0-x3 #extent of left out or a-x value at t=530sec#
a4=100.0-x4 #extent of left out or a-x value at t=600sec#
#Calculation
k1=(1.0/(a*t1))*(x1/a1)
print"Rate constant value at t=120sec is %.2e"%k1,"dm**3 mol**-1.s**-1"
k2=(1.0/(a*t2))*(x2/a2)
print"\nRate constant value at t=240sec is %.2e"%k2,"dm**3 mol**-1.s**-1"
k3=(1.0/(a*t3))*(x3/a3)
print"\nRate constant value at t=530sec is %.2e"%k3,"dm**3 mol**-1.s**-1"
k4=(1.0/(a*t4))*(x4/a4)
print"\nRate constant value at t=600sec is %.2e"%k4,"dm**3 mol**-1.s**-1"
k=(k1+k2+k3+k4)/4.0
#Result
print"\n\nAverage value of rate constant is %.1e"%k,"dm**3 mol**-1.s**-1"
```

In [11]:

```
#Variable declaration
t1=75.0 #time in min#
t2=119.0
t3=183.0
vi=9.62 #volume of alkali used in ml at t=0min#
v1=12.10 #volume of alkali used in ml at t=75min#
v2=13.10 #volume of alkali used in ml at t=119min#
v3=14.75 #volume of alkali used in ml at t=183min#
vf=21.05 #volume of alkali used in ml at t=infinity#
import math
#Calculation
k1=(1.0/t1)*math.log((vf-vi)/(vf-v1)) #formula of rate constant for first order reactions#
k2=(1.0/t2)*math.log((vf-vi)/(vf-v2))
k3=(1.0/t3)*math.log((vf-vi)/(vf-v3))
#Result
print"\nRate constant value at t=75min is ",round(k1,6),"min**-1"
print"\nRate constant value at t=119min is ",round(k2,6),"min**-1"
print"\nRate constant value at t=183min is ",round(k3,6),"min**-1"
print"\nNOTE:Slight Calculation mistake in book in k calculation above"
print"\nAn almost constant value of k shows that the hydrolysis of ethyl acetateis a first order reaction"
```

In [12]:

```
#Variable declaration
t=15 #the half time of given first order reaction in min#
k=0.693/t #formula of rate constant#
print"The rate constant value of the given first order reaction is is",k,"min**-1"
a=100 #percentage of initial concentration#
x=80 #percentage of completed reaction#
import math
#Calculation
a1=a-x #percentage of left out concentration#
t1=(2.303/k)*(math.log10(a/a1)) #formula to find time taken#
t2=t1*60
#Result
print"\nThe time taken to complete 80 percentage of the reaction is ",round(t1,2),"min or",round(t2),"sec"
```

In [13]:

```
#Variable declaration
t1=6.18 #time in min#
t2=18.0
t3=27.05
ri=24.09 #rotation in degrees when t=0min#
r1=21.4 #rotation in degrees when t=6.18min#
r2=17.7 #rotation in degrees when t=18min#
r3=15.0 #rotation in degrees when t=27.05min#
rf=-10.74 #rotation in degrees when t=infinity#
import math
#Calculation
a=ri-rf #a value#
a1=r1-rf #a-x value at t=6.18min#
a2=r2-rf #a-x value at t=18min#
a3=r3-rf #a-x value at t=27.05min#
k1=(2.303/t1)*math.log10(a/a1)
k2=(2.303/t2)*math.log10(a/a2)
k3=(2.303/t3)*math.log10(a/a3)
#Result
print"Rate constant value at t=",t1,"min %.3e"%k1,"min**-1"
print"\nRate constant value at t=",t2,"min %.3e"%k2,"min**-1"
print"\nRate constant value at t=",t3,"min %.3e"%k3,"min**-1"
print"\nNOTE:Again,Calculation mistake in book"
print"\nSince rate constant values are nearly same,hence reaction is of first order"
```

In [14]:

```
#Variable declaration
t1=10.0#time in min#
t2=20.0
t3=30.0
t4=40.0
ri=32.4 #rotation in degrees when t=0min#
r1=28.8 #rotation in degrees when t=10min#
r2=25.5 #rotation in degrees when t=20min#
r3=22.4 #rotation in degrees when t=30min#
r4=19.6 #rotation in degrees when t=40min#
rf=-11.1 #rotation in degrees when t=0min#
import math
#Calculation
a=ri-rf #a value#
a1=r1-rf #a-x value at t=10min#
a2=r2-rf #a-x value at t=20min#
a3=r3-rf #a-x value at t=30min#
a4=r4-rf #a-x value at t=40min#
k1=(1.0/t1)*math.log(a/a1)
k2=(1.0/t2)*math.log(a/a2)
k3=(1.0/t3)*math.log(a/a3)
k4=(1.0/t4)*math.log(a/a4)
#Result
print"Rate constant value at t=10min ",round(k1,6),"min**-1"
print"\nRate constant value at t=20min ",round(k2,6),"min**-1"
print"\nRate constant value at t=30min ",round(k3,6),"min**-1"
print"\nRate constant value at t=40min ",round(k4,6),"min**-1"
print"\nSince rate constant values are nearly same,hence inversion of sucrose is of first order"
```

In [15]:

```
#Variable declaration
T1=27.0 #initial temparature in C#
T1=T1+273 #in kelvin#
Tr=10.0 #rise in temparature#
T2=T1+Tr #final temparature in kelvin#
r=2.0 #ratio of final to initial rates of chemical reactions(k1/k2)#
R=8.314 #value of constant R in J/K.mol#
import math
#Calculation
E=math.log(r)*R*305*295/Tr #from equation k=A*e**(-E/R*T)#
#Result
print"Activation energy of the reaction is ",round(E/1000,2),"kJ/mol"
```

In [16]:

```
#Variable declaration
k=4.5*10**3 #value of k in /sec of a first order reaction at 1C#
E=58*10**3 #activation energy in J/mol#
T=1 #temperature in C#
T1=T+273 #in kelvin#
R=8.314 #value of constant R in J/K.mol#
import math
#Calculation
lA=math.log10(k)+(E/(2.303*R*T1))
k1=10**4 #value of k in /sec at some temperature#
a=math.log10(k1)
b=lA-a
T2=E/(2.303*R*b)
#Result
print"The temperature at which k=1*10**4/sec is",round(T2),"K"
```

In [17]:

```
#Variable declaration
T1=300.0 #temperature in kelvin#
t1=20.0 #half time of chemical reaction in min at T=300K#
T2=350.0 #temperature in kelvin#
t2=5.0 #half time of chemical reaction in min at T=350K#
import math
#Calculation
k1=0.6932/t1
k2=0.6932/t2
l=math.log10(k2/k1)
R=8.314 #value of constant R in J/K.mol#
E=l*2.303*R*T1*T2/(T2-T1)
#Result
print"Rate constant of the reaction at T=300k is ",k1,"/min"
print"\nRate constant of the reaction at T=350k is ",k2,"/min"
print"\nActivation energy of the reaction is",E,"J/mol OR",round(E/1000,1),"kJ/mol"
```

In [18]:

```
#Variable declaration
R=8.314 #value of constant R in J/K.mol#
H=1.25*10**4 #value of E/(2.303*R).It is given in the question#
#Calculation
#Part-i#
E=H*2.303*R
la=14.34 #value of math.log(a)#
T=670 #temperature in kelvin#
#Part-ii#
lk=la-(H/T)
k=10**lk
#Result
print"(i) Activation energy is %.2e"%E,"J mol**-1 or",round(E/1000),"kJ mol**-1"
print"\n(ii) Rate constant at 670K is %.1e"%k,"s**-1"
```

In [19]:

```
#Variable declaration
Ti=27.0 #given temperature in C#
T1=Ti+273.0 #in kelvin#
t1=T1-5
Tr=10.0 #rise in temperature#
import math
#Calculation
T2=T1+Tr
t2=T2-5
k=3.0 #value of k1/k2#
R=8.314 #value of constant R in J/K.mol#
E=math.log(k)*R*t1*t2/(T2-T1)
#Result
print"Activation energy of the reaction is",round(E),"J mol**-1 or",round(E/1000,2),"kJ mol**-1"
```