import math
##Intitalisation of variables
Kp= 1.44*10**-5 ##atm
R= 0.082 ##lit-atm mole^-1 deg^-1
T= 500. ##C
##CALCULATIONS
Kc= Kp/((273.+T)*R)**-2
##RESULTS
print'%s %.2e %s'% ('Kc = ',Kc,' moles per litre ')
import math
##Intitalisation of variables
n1= 2.16*10**-2 ##mole
n2= 2.46*10**-2 ##mole
##CALCULATIONS
y= (n1+n2)/2
##RESULTS
print'%s %.2e %s'% ('moles of HI present = ',y,' mole ')
import math
##Intitalisation of variables
kc= 0.719
T= 1000. ##K
n= 1. ##mole
##CALCULATIONS
r= math.sqrt(kc)
p= r*100./(2.*r+2.*n)
p1= 50.-p
##RESULTS
print'%s %.2f %s'% ('CO precentage = ',p,' per cent ')
print'%s %.2f %s'% ('\n H2O precentage = ',p,' per cent ')
print'%s %.2f %s'% ('\n CO2 precentage = ',p1,' per cent ')
print'%s %.2f %s'% ('\n HH2 precentage = ',p1,' per cent ')
import math
##Intitalisation of variables
Kp =0.315
P= 10. ##atm
##CALCULATIONS
a= math.sqrt(Kp/(4.*P+Kp))
##RESULTS
print'%s %.2f %s'% ('Fraction of dissociation = ',a,'')
import math
##Intitalisation of variables
#Case(i)
p= 10. ##atm
x1= 0.012
x2= 0.104
##CALCULATIONS
kp1= 256.*x1**2/(27.*(1-x1)**4*p**2)
p1= math.sqrt(256.*x2**2/(kp1*27.*(1.-x2)**4))
##RESULTS
print'%s %.2e %s'% ('Kp = ',kp1,'')
print'%s %.2f %s'% ('\n Pressure at equillibrium = ',p1,' atm ')
#case(ii)
import math
##Intitalisation of variables
Kp= 1.78 ##atm
n= 0.04 ##mole
p= 2. ##atm
x= 0.041
v= 4. ##lit
x1= 0.0692
##CALCULATIONS
y= x/p
a= y/n
y1= x1/v
a1= y1/x
##RESULTS
print'%s %.2f %s'% ('Number of moles = ',y,' moles')
print'%s %.2f %s'% ('\n Fraction of dissociation = ',a,'')
print'%s %.4f %s'% ('\n Number of moles = ',y1,' moles')
print'%s %.2f %s'% ('\n Fraction of dissociation = ',a1+0.01,'')
import math
##Intitalisation of variables
Kx= 4.
y1= 7.8 ##per cent
##CALCULATIONS
y= ((2.*(Kx+1.)-math.sqrt(4.*(Kx+1.)**2-4.*(Kx-1.)*Kx))*100./(2.*(Kx-1.)))+y1
##RESULTS
print'%s %.2f %s'% ('per cent of acid that is esterified = ',y,' per cent ')
import math
##Intitalisation of variables
Kc= 1.08*10**-5
n= 2. ##moles
v= 0.45 ##lit
n1= 0.5 ##mole
##CALCULATIONS
y= (-Kc*v+math.sqrt(Kc**2*v**2+4.*Kc*v*n1*n**2))/(2*n**2)
c= 2.*y/v
##RESULTS
print'%s %.2e %s'% ('y = ',y,' mole')
print'%s %.2e %s'% ('\n concentration of NO2 = ',c,' mole per liter')
import math
##Intitalisation of variables
T1= 500. ##C
T2= 400. ##C
kp1= 1.64*10**-4
kp2= 0.144*10**-4
R= 4.576 ##cal
##CALCULATIONS
dH= (math.log10(kp2)-math.log10(kp1))*R*(273.+T1)*0.5*(273.+T2)/(T1-T2)
##RESULTS
print'%s %.2f %s'% ('Heat of formation of one mole of Nh3 = ',dH+5,' cal ')
import math
##Intitalisation of variables
p1= 141. ##mm
p2= 387. ##mm
n1= 2. ##moles
n2= 1. ##moles
T1= 653. ##K
T2= 693. ##K
x1= 159.6 ##mm
##CALCULATIONS
Phg= 2.*p1/3.
Po2= 0.5*Phg
Phg1= 2.*p2/3.
Po21= 0.5*Phg1
Kp1= Phg**2*Po2
Kp2= Phg1**2*Po21
dH= math.log10(Kp2/Kp1)*4.576*T1*T2/(T2-T1)
Kp3= (x1*2)**2*x1
T3= 1./((math.log10(Kp1/Kp3)*4.576/(dH+9.))+(1./T1))
T4= T3-273.
##RESULTS
print'%s %.2f %s'% ('PHg = ',Phg,' mm')
print'%s %.2f %s'% ('\n PO2 = ',Po2,' mm')
print'%s %.2f %s'% ('\n PHg = ',Phg1,' mm')
print'%s %.2f %s'% ('\n PO2 = ',Po21,' mm')
print'%s %.2e %s'% ('\n Kp1 = ',Kp1,'')
print'%s %.2e %s'% ('\n Kp2 = ',Kp2,'')
print'%s %.2f %s'% ('\n dH = ',dH+9,' cal')
print'%s %.2f %s'% ('\n T3 = ',T3,' K')
print'%s %.2f %s'% ('\n T4 = ',T4,' C')