In [72]:

```
from math import log
P1=10.;#initial pressure in atm#
P2=1.;#final pressure in atm#
Wrev=0.0821*273*log(P1/P2);#maximum work required for the expansion of gas in litre-atm#
print'Maximum work required for the expansion of 1mol of ideal gas from 10atm to 1atm=Wrev=litre atm',Wrev
print'\nIf the gas is now compressed back from 1atm to 10atm under isothermal conditions,Wrev=-51.608530litre atm'
```

In [73]:

```
n=5;#no. of moles of Benzene#
R=8.314*10**7;#Universal gas constant#
K=80;#Evaporated temperature of benzene in centigrades#
T=270+K;#evaporated temperature of benzene in kelvins#
Wrev=n*R*T;#Maximum work done in ergs#
print'Maximum work done=Wrev=ergs',Wrev
```

In [74]:

```
w=0.454;#weight of TNT in grams#
T=298;#temperature in kelvin#
R=2*10**-3;
dn=5;
m=w/227;#mol of TNT exploded#
print'mol of TNT exploded=mol',m
H=1.64;#Heat liberated in kcal#
dU=-H/m;
print'\ndU=Kcal per mol',dU
dH=dU+(R*T*dn);
print'\ndH=Kcal per mol',dH
```

In [75]:

```
dH=-817.;
dU=-820.;
P1=1;#initial pressure in atm#
V=1;#volume in litre#
K=(1.99*10**-3)/0.082;#multiplying factor to convert litre atm to calories#
P2=P1+((dH-dU)/(V*K));#final pressure in atm#
print'Final pressure of the system=P2=atm',round(P2)
print'\nIn this problem P1 and P2 are in atm and V being in litres,The VdP term in litre atm.\ndH and dU are in Kcal and so the VdP term is converted into Kcal.\nIt is seen that the pressure developed is enormous.\nThis takes place in a confined space,an explosion occurs.\nThe final pressure P2 can also be calculated from the ideal gas equation PV=nRT which gives the same result.'#in textbook the answer given is bit wrong and it should be one we get through execution#
```

In [76]:

```
dHfFe2O3=-196.5;#dHf value of Fe2O3 in kcal per mol#
dHfCO2=-94.05;#dHf value of CO2 in kcal per mol#
dHfCO=-26.41;#dHf value of CO in kcal per mol#
dH298=(3*dHfCO2-dHfFe2O3-3*dHfCO);#enthalphy change at 298K in Kcal#
print'Enthalpy change for the reduction of Fe2O3 by Co at 298K=Kcal',dH298
```

In [77]:

```
dHfH2O=-68.32;#dHf value of H2O in kcal per mol#
dHfCO2=-94.05;#dHf value of CO2 in kcal per mol#
dH298=-208.34;#enthalphy change at 298K in Kcal#
dHfCH3COOH=(2*dHfH2O+2*dHfCO2-dH298);#dHf value of CH3COOH in Kcal per mol#
print'Standard enthalpy of formation of CH3COOH=Kcal per mol',dHfCH3COOH
```

In [78]:

```
T=298;#temperature in kelvin#
R=1.987*10**-3;
dn=-4;
dU=-1148.93;#Internal energy change of n-Heptane in kcal per mol#
dHf=dU+(R*T*dn);#dHf value of C7H16 in Kcal per mol#
print'dHf value of C7H16=dHf=Kcal per mol',dHf
dHfH2O=-68.32;#dHf value of Fe2O3 in kcal per mol#
dHfCO2=-94.05;#dHf value of CO2 in kcal per mol#
dHfC7H16=(8*dHfH2O+7*dHfCO2-dHf);#dHf value of CH3COOH in Kcal per mol#
print'\nStandard enthalpy of formation of C7H16=Kcal per mol',round(dHfC7H16,2)
```

In [79]:

```
dHf=-67.63;#enthalpy change value in kcal#
dHfCO2=-94.05;#Heat of formation value of CO2 in kcal#
dHfCO=dHfCO2-dHf;#Heat of formation value of CO in Kcal#
print'Heat of formation of CO=Kcal',dHfCO
```

In [80]:

```
dHfDiam=-94.50;#heat of formation value of Diamond in kcal#
dHfGrap=-94.05;#Heat of formation value of Graphite in kcal#
dHf=dHfGrap-dHfDiam;#Enthalpy change when graphite converted to diamond in Kcal#
print'Enthalpy change when graphite converted to diamondfKcal',dHf
```

In [81]:

```
dHfH2O=-68.32;#dHf value of H2O in kcal per mol#
dHfCO2=-94.05;#dHf value of CO2 in kcal per mol#
dH298=-208.34;#enthalphy change at 298K in Kcal#
dHfCH3COOH=(2*dHfH2O+2*dHfCO2-dH298);#dHf value of CH3COOH in Kcal per mol#
print'Standard enthalpy of formation of CH3COOH=Kcal per mol',dHfCH3COOH
```

In [82]:

```
dHfZnSO4l=-36.43;#Standard heat of formation of ZnSO4 in kcal#
dHfH2SO4l=-193.91;#Standard heat of formation of H2SO4 in kcal#
dHfZnSO4aq=-19.45;#Heats of Dilution of ZnSO4 in kcal#
dHfH2SO4aq=-22.99;#Heats of Dilution of H2SO4 in kcal#
dH=dHfZnSO4l+dHfH2SO4l+dHfH2SO4aq;
dHf298=dH-dHfZnSO4aq;#Standarad enthalphy of formation of ZnSO4 at 298K in Kcal#
print'Standard enthalpy of formation of ZnSO4 at 298K=Kcal',dHf298
```

In [83]:

```
CvH2=6.95*10**-3;#Mean molar capacity of H2 in Kcal per deg#
CvO2=6.97*10**-3;#Mean molar capacity of O2 in Kcal per deg#
CvH2O=8.7*10**-3;#Mean molar capacity of H2O in Kcal per deg#
dCv=CvH2O-CvH2-0.5*CvO2;#Net mean molar capapcity in Kcal per deg#
print'Net mean molar capacity=dCv=Kcal per deg',dCv
dHf=-57.8;#Standard heat of formation of water vapour in Kcal#
dHf373=dHf+(dCv*(373-298));#Heat of formation of water vapour at 373K in Kcal#
print'\nHeat of formation of water vapour at 373K=Kcal',round(dHf373,2)#here the answer is written wrong in textbook the correct answer is given here#
```

In [84]:

```
CvCO2=1.331;#Mean molar capacity of CO2 in Kcal per deg#
CvC=6.714*10**-3;#Mean molar capacity of C in Kcal per deg#
CvO2=-77.09*10**-7;#Mean molar capacity of O2 in Kcal per deg#
T1=300.;#Initial Temperature in kelvin#
T2=400.;#final temperature in Kelvin#
dHf400=-94.06;#Enthalpy change in the formation of CO2 at 400k in Kcal#
dHf300=dHf400-((CvCO2*(T2-T1))-(0.5*CvC*(T2**2-T1**2))-(0.33*CvO2*(37*10**6)))*10**-3;#Enthropy of formation of CO2 at 300K in Kcal#
print'\nEnthropy of formation of CO2 at 300K=Kcal',round(-1*dHf300,1)#in textbook the answer is not having negative answer#
```

In [85]:

```
dHfNH3=-11.04;#Standard heat of formation of NH3 in kcal#
dHfH2O=-57.80;#Standard heat of formation of H2O in kcal#
dHfNO=21.60;#Standard heat of formation of NO in kcal#
dHfO2=0;#Standard heat of formation of O2 in Kcal#
dH=4*dHfNO+6*dHfH2O-4*dHfNH3-5*dHfO2;#Enthalpy change for the oxidation of NH3#
print'Enthalpy change for the oxidation of NH3 at 298K=Kcal',dH
```

In [86]:

```
T=773;#temperature in kelvin#
dH298=-216240;#Enthalpy change for the oxidation of NH3 in cal#
CvO2=6.148+T*3.102*10**-3-(T**2)*9.23*10**-7;#heat capacity of O2 in cal deg**-1 mol**-1#
CvH2O=7.219+T*2.374*10**-3+(T**2)*2.67*10**-7;#Heat capacity of H2O in cal deg**-1 mol**-1#
CvNO=6.50+T*1*10**-3;#Heat capacity of NO in cal per deg per mol#
CvNH3=6.189+T*7.887*10**-3-(T**2)*7.28*10**-7;#Heat capacity of H2O in cal deg**-1 mol**-1#
dCv=4*CvNO+6*CvH2O-4*CvNH3-5*CvO2;#Heat capacity change for oxidation#
da=13.818;
db=-28.814*10**-3;
dc=91.29*10**-7;
T1=298;#temperature in kelvin#
dH773=dH298+(T-T1)*da+(T**2-T1**2)*0.5*db+(T**3-T1**3)*0.33*dc;#Enthalpy change for the oxidation of NH3 at 773k in cal#
print'\nEnthalpy change for the oxidation of NH3 at 773K=cal=-215.69Kcal',round(dH773)#here the answer is slightly different#
```

In [87]:

```
ECH=99;#bond energy of CH bond in Kcal#
EClCl=58;#bond energy of ClCl bond in Kcal#
ECCl=78;#bond energy of CCl bond in Kcal#
EHCl=103;#bond energy of HCl bond in Kcal#
dE=4*ECH+4*EClCl-4*ECCl-4*EHCl;#Net change in bond energy in kcal#
print'Enthalpy change of the reaction=dE=Kcal',dE
```

In [88]:

```
dH=-57800;#Enthalpy change in cal#
R=1.99;#universal gas constant#
T=298;#temperture in kelvin#
dn=-0.5;#change in no. of moles#
dU=dH-(R*T*dn);#heat of combustion in cal#
print'The air used contains 2 mol of N2.\ndU=-57500cal.'
CpN2=8.3;#Cp value of N2#
CpH2O=11.3;#Cp value of H2O#
CvN2=CpN2-R;#Cv value of N2#
CvH2O=CpH2O-R;#Cv value of H2O#
print'\nCv value of N2=CvN2=Kcal deg^-1 mol^-1',CvN2
print'\nCv value of H2O=CvH2O=Kcal deg^-1 mol^-1',CvH2O
print'\nSolving integration we get T2=2940K.The maximum pressure can be calculated from PV=nRT equation.'
P1=1;#initial pressure in atm#
n1=3.5;
n2=3;
T2=2940;#final temperature in Kelvin#
P2=(P1*n2*T2)/(n1*T);#maximum pressure in atm#
print'\nMaximum pressure of the reaction=P2=atm',round(P2,2)
```

In [89]:

```
print'The maximum possible efficiency is obtained only in a reversible carnots cycle according to which ME=dT/T.'
T=300.;#initial temperature of steam engine in kelvin#
T1=373.;#operating temperature in kelvin#
ME1=(T1-T)/T1;#maximum possible efficiency for temperature range of 300k to 373k#
print'\nMaximum possible efficiency for operating temperature between 300K and 373K=ME1=',round(ME1,3)
T2=630.;#operating temperature in kelvin#
ME2=(T2-T)/T2;#maximum possible efficiency for temperature range of 300k to 630k#
print'\nMaximum possible efficiency for operating temperature between 300K and 630K=ME1=',round(ME2,3)
T3=510.;#operating temperature in kelvin#
ME3=(T3-T)/T3;#maximum possible efficiency for temperature range of 300k to 510k#
print'\nMaximum possible efficiency for operating temperature between 300K and 510K=ME3=',round(ME3,3)
```

In [90]:

```
from math import log10
T1=300.;#initial temperature in kelvin#
T2=400.;#final temperature in kelvin#
P1=2.;#initial pressure in atm#
P2=10.;#final pressure in atm#
R=1.99;
n=5.;#no.of moles#
Cv=6.95;
dS=n*Cv*2.303*log10(T2/T1)-n*2.303*R*log10(P2/P1);
print'Change in entropy=dS=eu',round(dS)
```

In [91]:

```
Lv=6896;#Latent heat of vapourization in cal per mol#
Tb=341.7;#Boiling temperature in kelvin#
dS=Lv/Tb;#entropy change accompanying the vapourization in eu#
print'Entropy change accompanying the vapourization=dS=eu or cal per deg',round(dS,2)
```

In [92]:

```
from math import log10
T1=300.;#initial temperature in kelvin#
T2=600.;#final temperature in kelvin#
T3=373.;#initial temperature in kelvin#
T4=746.;#final temperature in kelvin#
Cv=6.09;#molar heat capacity in cal per deg#
dS2=Cv*2.303*log10(T2/T1);#change in entropy for temperature change between 300k to 600k#
print'Change in entropy for temperature change between 300k to 600k=dS2=cal per deg',round(dS2,2)
dS4=Cv*2.303*log10(T4/T3);#change in entropy for temperature change between 373k to 746k#
print'\nChange in entropy for temperature change between 373k to 746k=dS4=cal per deg',round(dS4,2)
```

In [93]:

```
from math import log10
T=300.;#initial temperature in kelvin#
T1=692.;#temperature in kelvin#
T2=1180.;#temperature in kelvin#
T3=1500.;#final temperature in kelvin#
Lf=1800.;#Latent heat of fusion in cal per mol#
Tf=692.;#temperature of fusion in kelvin#
Lv=27700.;#Latent heat of vapourization in cal per mol#
Tv=1180.;#temperature of vapourization in kelvin#
SH=0.092;#specific heat of Zn in cal per deg per gram#
w=65.38;#atomic weight of Zn#
Cv=w*SH;#molar heat capacity in cal per deg#
dS1=Cv*2.303*log10(T1/T);#change in entropy for temperature change between 300k to 692k#
print'Change in entropy for temperature change between 300k to 692k=dS1=eu',round(dS1,2)
dS2=Lf/Tf;#change in entropy in the process of fusion in eu#
print'\nChange in entropy in the process of fusion=dS2=eu',round(dS2,2)
dS3=Cv*2.303*log10(T2/T1);#change in entropy for temperature change between 692k to 1180k#
print'\nChange in entropy for temperature change between 692k to 1180k=dS3=eu',round(dS3,2)
dS4=Lv/Tv;#change in entropy in the process of vapourization in eu#
print'\nChange in entropy in the process of vapourization=dS4=eu',round(dS4,2)
dS5=Cv*2.303*log10(T3/T2);#change in entropy for temperature change between 1180k to 1500k#
print'\nChange in entropy for temperature change between 1180k to 1500k=dS5=eu',dS5
dStotal=dS1+dS2+dS3+dS4+dS5;#total entropy change accompanying the process in eu#
print'\nTotal entropy change accompanying the process=dStotal=eu',round(dStotal,2)
```

In [94]:

```
from math import log10
print'This is a spontaneous process.Since dS is independent of the manner in which the processes are conducted,\nthe above irreversible process can be considered to take place reversibly.'
T1=300.;#initial temperature in kelvin#
T2=370.;#final temperature in kelvin#
Cv=18.;#molar heat capacity in cal per deg#
dSH2O=-Cv*2.303*log10(T2/T1);#change in entropy of H2O for temperature change between 300k to 370k#
print'\nChange in entropy of H2O for temperature change between 300k to 370k=dSH2O=eu',dSH2O
dT=T2-T1;#change in temperature in kelvin#
dSthermostat=Cv*dT/T1;#change in entropy of thermostat in eu#
print'\nChange in entropy of thermostat=dSthermostat=eu',dSthermostat
dS=dSH2O+dSthermostat;#net entropy chane in eu#
print'\nNet entropy change=dS=eu',round(dS,2)
```

In [95]:

```
dGC2H6O=-41.77;#Standard free energy change of C2H6O in Kcal per mol#
dGCO2=-94.26;#Standard free energy change of CO2 in Kcal per mol#
dGH2O=-56.69;#Standard free energy change of C2H6O in Kcal per mol#
dGO2=0;#Standard free energy change of O2 in Kcal per mol#
dG=2*dGCO2+3*dGH2O-dGC2H6O-3*dGO2;#Standard free energy change in Kcal#
print'Standard free energy change accompanying the combustion of ethanol at 298K=Kcal',dG
```

In [96]:

```
dGCH3COOH=-93.8;#Standard free energy change of CH3COOH in Kcal per mol#
dGCH3CH2OH=-41.77;#Standard free energy change of CH3CH2OH in Kcal per mol#
dGH2O=-56.69;#Standard free energy change of C2H6O in Kcal per mol#
dGO2=0;#Standard free energy change of O2 in Kcal per mol#
dG=dGCH3COOH+dGH2O-dGCH3CH2OH-dGO2;#Standard free energy change in Kcal#
print'Standard free energy change accompanying the Oxidation of ethanol to acetic acid=Kcal',dG
print'\nSince dG is negative the reaction is feasible under these conditions.'
```

In [97]:

```
dGAgCl=-26.22;#Standard free energy change of AgCl in Kcal per mol#
dGAgI=-15.85;#Standard free energy change of AgI in Kcal per mol#
dGKCl=-97.59;#Standard free energy change of KCl in Kcal per mol#
dGKI=-77.03;#Standard free energy change of KI in Kcal per mol#
dG=dGAgCl+dGKI-dGAgI-dGKCl;#Standard free energy change in Kcal#
print'Standard free energy change accompanying the given reaction=Kcal',dG
print'\nSince dG is positive the reaction is not feasible under these conditions but the reverse reation is possible.'
```

In [98]:

```
SFe2O3=21.5;#Standard Entropy of Fe2O3 in cal per deg per mol#
SCO=47.3;#Standard Entropy of CO in cal per deg per mol#
SFe=6.5;#Standard Entropy of Fe in cal per deg per mol#
SCO2=51.1;#Standard Entropy of CO2 in cal per deg per mol#
dS=2*SFe+3*SCO2-SFe2O3-3*SCO;#Standard entropy change in cal per deg per mol#
print'Standard entropy change accompanying the reduction of Fe2O3 by CO=cal per deg per mol',dS
print'\nHere it will be noticed that dS is very small but definitely positive.'
print'\nThe small value due to the fact that there is no change in number of moles of gases\nwhich are major contributors to the entropy change.'
```

In [99]:

```
SCaCO3=22.2;#Standard Entropy of CaCO3 in cal per deg per mol#
SCaO=9.5;#Standard Entropy of CaO in cal per deg per mol#
SCO2=51.1;#Standard Entropy of CO2 in cal per deg per mol#
dS=SCaO+SCO2-SCaCO3;#Standard entropy change in cal per deg per mol#
print'Standard entropy change in the given reaction=cal per deg per mol',dS
```

In [100]:

```
SFe2O3=21.5;#Standard Entropy of Fe2O3 in cal per deg per mol#
SH2=31.21;#Standard Entropy of H2 in cal per deg per mol#
SFe=6.5;#Standard Entropy of Fe in cal per deg per mol#
SH2O=16.75;#Standard Entropy of H2O in cal per deg per mol#
dS=2*SFe+3*SH2O-SFe2O3-3*SH2;#Standard entropy change in cal per deg per mol#
print'Standard entropy change in the given reaction=cal per deg per mol',dS
```

In [101]:

```
T=273.;#temperature in kelvin#
P1=1.;#pressure in atm#
M=28.;#molecular weight of N2 in grams#
print'For an ideal gas density=M*P/R*T.\nWhere M is molecular weight=28.\nTemperature being constant,if p1 and p2 are the densities at 1atm and 50atm respectively'
P2=1.25;#pressure in atm#
p1=50;#density at 1atm pressure#
p2=p1*P2;
print'\nIf N2 gas behaved ideally at 273k,the ideal pressure Pideal is given by p2*R*T/M'
Pideal=p2*0.0821*T/M;
print'\nIdeal pressure=Pideal=atm',Pideal
f=p1**2/Pideal;
print'\nFugacity of the N2gas=f=atm',round(f,2)
```

In [102]:

```
M=18;#molecular weight of water in grams#
Dl=0.958;#density of water in liquid form in gram per cm^3#
Dv=5.98*10**-4;#density of water in vapour form in gram per cm^3#
MVl=M/Dl;#molar volume of water in liquid form in cm^3#
MVv=M/Dv;#molar volume of water in vapour form in cm^3#
L=540;#Latent heat of vapourization in cal per gram#
T=373;#temperature in kelvin#
dV=30.11;
dP=(L*M)/(T*dV);
print'dP/dT=0.357atm per deg=28.55mm of Hg per deg'
dS=dP*dV;#change in entropy in cal per deg per mol#
print'\nChange in entropy=dS=cal per deg per mol',round(dS,1)
```

In [103]:

```
dS=21.0;#standard entropy change of benzene in cal per deg per mol#
Tb=353;#boiling point of benzene in kelvin#
Lv=dS*Tb;#latent heat of vapourization of benzene in cal per mol#
print'Latent heat of vapourization of benzene=Lv=cal per mol',Lv
T=300.;#temperature in kelvin#
R=1.99;#universal gas constant#
P=10**(Lv*((1/Tb)-(1/T))/(2.303*R));#vapour pressure of benzene in atm#
PHg=P*760;#vapour pressure in mm of Hg#
print'\nvapour pressure of benzene=P=atm',P
print'\nVapour pressure of benzene in mm of Hg=PHg=mm of Hg',round(PHg,5)
```

In [104]:

```
from math import log10
T2=373.;#final temperature in kelvin#
Lv=540*18;#latent heat of vapourization of water in cal per mol#
P1=1./20.;#initial pressure in atm#
P2=1;#final pressure in atm#
R=1.99;#universal gas constant#
T1=1/((1/T2)+(2.303*R*log10(P2/P1)/Lv));
print'\noperating temperature of the reactor=T1=K',T1
print'\nHence the plant can be operated at a temperature of 303.500Kelvin or 30.500degrees \nsince at a temperature higher than this the liquid phase no longer exists.'
```

In [105]:

```
T1=373.;#initial temperature in kelvin#
Lv=540*18;#latent heat of vapourization of water in cal per mol#
T2=423.;#final temperature in kelvin#
R=1.99;#universal gas constant#
P=10**(-Lv*((1/T2)-(1/T1))/(2.303*R));#vapour pressure of water in atm#
print'\npressure of water at which we can produce superheated steam=P=atm',round(P,2)
```

In [106]:

```
from math import log10
PPSO3=1;#partial pressure of SO3 in atm#
PPSO2=0.2;#partial pressure of SO2 in atm#
PPO2=0.05;#partial pressure of O2 in atm#
Kp=3.5;
R=0.0821;#universal gas constant#
T=1000.;#temperture in kelvin#
n1=3.;
n2=2.;
dn=n2-n1;#change in no. of moles#
Kc=Kp/((R*T)**dn);
print'Kc for the reaction=Kc=litre per mol',Kc
P=2;#pressure in atm#
Kinfinite=Kp/(P**dn);
print'\nKinfinite of the reaction=Kinfinite=per atm',Kinfinite
Qp=(PPSO3**2)/(PPSO2**2*PPO2);#reation quotient involving pressures#
print'\nReaction quotient invloving pressures=Qp=',Qp
dGO=-2.303*1.99*10**-3*T*log10(Kp);
print'\ndGO=',dGO
dG=dGO+(2.303*1.99*10**-3*T*log10(Qp));
print'\nstandard free energy change in the reaction at 1000k=dG=Kcal',dG
print'\nIt must be noted that under these conditions dG is positive.\nso it is the dissociation of SO3 that is spontaneous.'#here the answer given in the textbook is wrong the right one is that we got here through execution#
```

In [107]:

```
Kp=1.60;#Kp for water at equilibrium#
Kc=1.60;#at equilibrium Kp=Kc#
x=0.56;
print'Kp=Kc=x**2/(1-x)**2=1.60\nUpon solving above equation we get x=0.56\nTotal no. of moles=1-x+1-x+x+x=2\nmole percent of CO=mole percent of H2O=0.56*50=28'
print'\nmole percent of CO2=mole percent of H2=0.44*50=22\nSo 100 volumes of the mixture will contain 28volumes of CO,28volumes of H2O\n22volumes of CO2 and 22volumes of H2.'
```

In [108]:

```
from math import log10
T1=1000.;#initial temperature in kelvin#
Kp1=0.72;#Kp value at T1 temperature#
T2=1260.;#final temperature in kelvin#
Kp2=1.60;#Kp value at T2 temperature#
R=1.99;#universal gas constant#
print'Since Kp2>Kp1 one would expect dH to be positive i.e Endothermic reaction.'
dH=(2.303*R*T1*T2*log10(Kp2/Kp1))/(T2-T1);
print'\ndH for the reaction=dH=cal=7.702Kcal',round(dH)
```

In [109]:

```
P=10.;#pressure in atm#
print'The total pressure P=PH2+PN2+PNH3.At all times PH2=3PN2\nSo PNH3=P-4*PN2 or PN2=0.25*(P-PNH3).'
print'\nLet x represent the mole fraction of NH3 at equilibrium.\nThen 1-x represents the sum of the mole fraction of N2 and H2.'
x=0.0122;#yield of NH3 in moles#
PNH3=x*P;#pressure of NH3 in atm#
xNH3=x;
PN2=0.25*(1-x)*P;#pressure of N2 in atm#
PH2=0.75*(1-x)*P;#pressure of H2 in atm#
Kp=(PNH3**2)/(PN2*PH2**3);
print'\nKp value for the reaction=Kp==1.5*10**-5atm**-2',Kp
```

In [110]:

```
print'If the yield of NH3 is 12.2mol percent,x=0.122'
x=0.122;#yield of NH3 in moles#
Kp=1.48*10**-5;#Kp value of the equation in atm**-2#
P=((256*x**2)/(27*Kp*(1-x)**4))**0.5;#pressure of the system in atm#
print'\nPressure of the system=P=atm',round(P,1)
```

In [111]:

```
print'PCl5=PCl3+Cl2'
M0=208.5;
P=1;#pressure in atm#
w=4.59;#weight of PCl5 in grams#
V=1.7;#volume of PCl5 in gm**3#
T=523;#temperature in kelvin#
R=0.0821;#universal gas constant#
M=(w*R*T)/(P*V);
print'\nMolecular weight of PCl5=M=',M
a=(M0-M)/(M*(2-1));
print'\na=',a
Kp=(a**2*P)/(1-a**2);
print'\nKp for the reaction=Kp=',Kp
print'\nIf total pressure is increased at the same temperature,Kp being constant,a should decrease.\nLet the degree of dissociation when P=2atm be a1 at the same temperature.'
P1=2;
a1=(Kp/(P1+Kp))**0.5;
print'\na1=',round(a1,4)#the answers in textbook are slightly different from what we got here but it's nothing wrong#
```

In [112]:

```
a=0.5;#dissociation constant#
P=1;
Kp=(a**2*P)/(1-a**2);
print'Total pressure required to bring 50percent dissociation=P=3*Kp'
```

In [113]:

```
a=0.21;#dissociation constant#
P=1;#pressure in atm#
Kp=(a**2*P)/(1-a**2);
print'\nKp for the reaction=Kp=',Kp
print'\nP=1atm=0.4+PCOCl2+PCO+PCl2\nsum of pressure reactants=0.6atm\nCOCl2=CO+Cl2\nHere P is the total pressure due to all the participants of the reaction and is equal to 0.6atm.'
P1=0.6;
a1=(Kp/(P1+Kp))**0.5;
print'\na1=',round(a1,5)
print'\nfor Pressure of 0.6atm a has increased,thereby indicating that the forward reaction is favoured.'#here the value of a1 is slightly different from textbook#
```

In [9]:

```
import sympy
acid=1./3.;
ester=2./3.;
alcohol=1./3.;
water=2./3.;
K=(ester*water)/(acid*alcohol);
print'K value of the reaction=K=',K
print'\nIn finding no. of moles we end up with quadratic equation 3*x**2-24*x+20=0.\nupon solving the equation we get x=7.05 and 0.945.'
print'\nThe first solution is not admissible since the maximum yield of the ester cannot exceed one mol of acetic acid.\nHence x=0.945 i.e yield of the ester is 94.5percent.'
print'\nThis problem illustrates the influence of an increased concentration of the reactant\nSince using one mole of each reactant the yield of ester is only 66.66percent'
x=symbols('x')
acid=1-x;
ester=x;
alcohol=1-x;
water=1+x;
print'\nIn finding no. of moles we end up with quadratic equation 3*x**2-9*x+4=0.\nupon solving the equation we get x=2.457 and 0.5425.'
print'\nThe first solution is not admissible,x=0.5425.\nyield of the ester in the presence of the product water has decreased from 66.67percent to 54.25percent.'
print'\nother homogeneous equilibria in the liquid phase such as ionization of weak acids\nionization of weak bases,hydrolysis of salts,etc.,can be treated likewise.'
```

In [115]:

```
Kp=29.64;#dissociation pressure of CaCO3 in mm of Hg#
print'CaCO3+C=CaO+2CO for the dissociation of CaCO3=CaO+CO2'
print'\nKp1=PCO2=29.64/760=0.039atm\nFor the reduction of CO2 by C,CO2+C=2CO.Kp2=PCO^2/PCO2\nVolume percent=mol percent=mole fraction*100\nPCO=xCO*total pressure=xCO since total pressure=1atm\nxCO=PCO=0.724atm and xCO2=PCO2=0.276atm'
print'\nKp2=PCO^2/PCO2=(0.724)^2/0.276=1.9atm'
Kp1=0.039;#dissociation pressure of CaCO3 in atm#
Kp2=1.9;
Kp3=Kp1*Kp2;#equilibrium constant for overall reaction in atm^2#
print'\nEquilibrium constant for overall reaction=Kp3==7.41*10^-2atm^2',Kp3
```

In [116]:

```
MH2O=18.;#Molecular weight of H2O in grams#
WH2O=100.;#weight of H2O in grams#
W=3.6;#weight of oraganic substance in grams#
dP=0.0855;#Lowering in vapour pressure in mm of Hg#
P=23.76;#Vapour pressure of Organic substance in mm of Hg#
M=(W*MH2O*P)/(WH2O*dP);#Molecular weight of Organic substance in grams#
print'Molecular weight of Organic substance=M=grams',round(M)
```

In [117]:

```
T0=373;#temperature in kelvin#
R=1.99;#value of R in cal per deg per mol#
lv=540;#Latent heat of vaporization in cal per grams#
Kb=(R*T0**2)/(1000*lv);#value of Kb in deg per mol#
print'Value of Kb=Kbdeg per mol',Kb
T1=373.57;#temperature in kelvin#
W2=5;#weight of urea in grams#
W1=75;#weight of water boils in grams#
dT=T1-T0;#change in temperature#
M2=(Kb*1000*W2)/(dT*W1);#Molecular weight of urea in grams#
print'\nMolecular weight of urea=M2=grams',round(M2)
```

In [118]:

```
lf=80.;#Latent heat of fusion of Ice in cal per gram#
lv=540.;#Latent heat of evaporation of water in cal per gram#
Tf=273.;#fusion temperature in kelvin#
Tb=373.;#Boiling temperature in kelvin#
dTb=Tb-Tf;#change in temperature#
dTf=(dTb*Tf**2*lv)/(Tb**2*lf*1000);
FP=0-dTf;#Freezing point of the solution#
print'The Freezing point of the solution=FP=',round(FP,3)
```

In [119]:

```
Kf=1.86;#Kf for water#
M2=32;#Molecular weight of Methanol in grams#
W1=10000.;#weight of H2O in grams#
dTf=10.;#lowering freezing point of water#
W2=(dTf*W1*M2)/(1000*Kf);#weight of methanol in grams#
print'weight of Methanol=W2Kg',W2
M3=62.;#Molecular weight of Ethylene in grams#
W3=(dTf*W1*M3)/(1000*Kf);#weight of methanol in grams#
print'\nweight of Ethylene=W3=grams',round(W3,3)
```

In [120]:

```
Kf=1.86;#Kf for water#
print'At -18.6degrees temperature only Ice seperates from the Aqueous solution\nThe weight of Glycol remains constant through its concentration Actually increases since ice seperates out on cooling.'
print'\nInitial Concentration=3334grams per 10Kg of Water.'
dT=18.6;
m=dT/Kf;
w=10;#initial content of water in litres#
w1=5.376;
W=w-w1;#weight of ice seperating in kilograms
print'\nIf dT=18.6 then m=10'
print'\nAt -18.6Degrees 10 mol of glycol are present in 1000grams of water,i.e 620grams in 1000grams of water,or 6200grams in 10Kg of water.'
print'\n3334grams of glycol would be present in 10*3334/6200,i.e 5.376Kg of Water.'
print'\nWt. of Ice seperating=W=Kg',W
```

In [121]:

```
T=300;#temperature in kelvin#
R=0.0821;#universal gas constant#
Ws=0.171;#Weight of Sucrose in the solution in grams#
Ms=342;#Molecular weight of Sucrose in grams#
l=0.05;#volume of solution in litres#
ns=(Ws)/(Ms*l);#no. of moles of sucrose in the solution#
print'Osmatic pressure being a colligative property depends only on the no. of mol of solute present and not on their nature.'
print'\nNo. of moles of Sucrose in a litre solution=ns=mol per litre',ns
Wg=0.18;#Weight of glucose in the solution in grams#
Mg=180;#Molecular weight of glucose in grams#
ng=(Wg)/(Mg*l);#no. of moles of glucose in the solution#
print'\nNo. of moles of Glucose in a litre solution=ns=mol per litre',ng
Wu=0.06;#Weight of Urea in the solution in grams#
Mu=60;#Molecular weight of Urea in grams#
nu=(Wu)/(Mu*l);#no. of moles of Urea in the solution#
print'\nNo. of moles of Urea in a litre solution=ns=mol per litre',nu
c=ns+ng+nu;#total no of moles in a litre solution#
print'\nTotal no. of moles in a litre solution=c=mol per litre',c
OP=c*R*T;#Osmatic pressure in atms#
print'\nOsmatic pressure of the solution at atm',round(OP,2)
```

In [122]:

```
Hb=2.4;#rise of the benzene solution in mm#
Db=0.88;#Density of Benzene solution in g per cm^3#
Dm=13.6;#Density of mercury solution in g per cm^3#
Hm=(Hb*Db)/Dm;#Rise of mercury solution in mm#
print'The Osmatic pressure given in terms of the height of a liquid column must be converted into an equivalent height of a mercury column.'
print'\nEquivalent Height of the mercury column=Hm=mm',Hm
print'\nThe density of solution is equal to density of solvent since the solution is dilute.\nLet M2 be the molecular weight of polymer.'
R=0.0821;#Universal gas constant#
T=310;#temperature in kelvin#
M2=(2.5*R*T*760)/Hm;#Molecular weight of polymer in grams#
print'\nMolecular weight of polymer=M2==3.11*10^5grams',round(M2)
```

In [123]:

```
T=310;#temperature in kelvin#
R=0.0821;#universal gas constant#
OP=7.65;#Osmatic pressure in atm#
c=OP/(R*T);
print'Concentration of glucose=c=M',c
W=c*180;#weight in one litre in grams#
print'\nWeight in one litre=W=grams',round(W,2)
```

In [124]:

```
T0=373;#temperature in kelvin#
Kb=0.52;#value of Kb in deg per mol#
T1=373.208;#temperature in kelvin#
W2=3.40;#weight of BaCl2 in grams#
W1=100;#weight of water boils in grams#
dTb=T1-T0;#change in temperature#
Mobs=(Kb*1000*W2)/(dTb*W1);#Molecular weight of BaCl2 observed in grams#
print'Molecular weight of BaCl2 observed=Mobs=grams',Mobs
Mthr=208.4;#Theoritical Molecular weight of BaCl2 in grams#
i=Mthr/Mobs;
a=0.5*(i-1);#apparent degree of dissociation of BaCl2#
print'\nApparent degree of dissociation of BaCl2=a=',round(a,3)
```

In [125]:

```
Kf=1.86;#Kf for water#
m=0.1;#no. of moles of organic mono carboxilic acid#
dTf=Kf*m;#Theoritical change in temperature#
print'Theoritical change in temperature=dTf=',dTf
dTobs=0.220;#Observed change in temperature#
i=dTobs/dTf;
print'\nSince dTobs is greater than dTf ionization must have occurred in aqueous solution.\nAn organic monobasic acid RCOOH ionizes as RCOOH = RCOO- + H+.'
a=i-1;#degree of ionization#
print'\nDegree of ionization=a=',a
print'\nIf the acid dissolved as such in its molecular form as species dTthr=5.12*0.1=0.512,dTobs=0.265.'
print'\nThis value is nearly half the expected value,suggesting that the molecule exists as associated molecules in solution.'
i1=0.265/0.512;
a1=2*(1-i1);
print'\nThe acid is demerized to the extent of a1=percent.',a1*100
```