#calculate the moles of Iodine present
#Initialization of variables
x1=0.0200
Kx=812.
#calculations
print "Neglecting 2x in comparision with x1,"
x=x1/Kx
#results
print '%s %.2e %s' %("Moles of Iodine present =",x," mole")
#calculate the Concentration of H+ ions
#Initialization of variables
Kc=1.749*10**-5 #M
n1=0.1 #mole
n2=0.01 #mole
#calculations
c=n1/n2 *Kc
#results
print '%s %.1e %s' %("Concentration of Hplus ions =",c," M")
#calculate the Concentraton of Hplus ions
#Initialization of variables
import math
c=0.01 #M
kc=1.749*10**-5 #M
#calculations
x2=c*kc
x=math.sqrt(x2)
#results
print '%s %.1e %s' %("Concentration of Hplus ions =",x,"M")
#calculate the Concentration of OH- ions
#Initialization of variables
import math
K2=1.0008*10**-14 #m^2
K1=1.754*10**-5 #m
c=0.1
#calculations
print "Neglecting x w.r.t c,"
x2=c*K2/K1
x=math.sqrt(x2)
#results
print '%s %.1e %s' %("Concentration of OH minus ions =",x," m")
#calculate the Concentration of H plus ions
#Initialization of variables
import math
print "from table 14.1,"
r1=7.47*10**-5 #m
r2=4.57*10**-3 #m
mp=1.008*10**-14 #m**2
#calculations
r3=r2/r1
mH2=r3*mp
mH=math.sqrt(mH2)
#results
print '%s %.2e %s' %("Concentration of Hplus ions = ",mH," M")
#calculate the Concentraton of H+ ions
#Initialization of variables
print "from table 14.1,"
import math
r1=1.75*10**-5 #m
r2=1.772*10**-4 #m
mp=1.008*10**-14 #m**2
#calculations
r3=r2/r1
mH2=r3*mp
mH=math.sqrt(mH2)
#results
print '%s %.1e %s' %("Concentration of Hplus ions =",mH," M")
#calculate the Concentration of H+ ions
#Initialization of variables
import math
c=1*10**-6 #m
K=1.754*10**-5 #m
Kp=1.008*10**-14 #m**2
#calculations
mH=c
#Iteration 1
mOH=Kp/mH
mA=mH-mOH
mHA=mH*mA/K
mH2=mH-mHA+mOH
#Iteration 2
mOH2=Kp/mH2
mA2=mH2-mOH2
mHA2=mH2*mA2/K
mH3=mH2-mHA2+mOH2
#From x2
x2=math.sqrt(Kp)
x1=c
mOH3=Kp/x2
y2=x1
#From x1
mOH4=Kp/c
mA4=mH-mOH4
mHA4=mH*mA4/K
y1=c-mHA4-mA4
#upon further iterations, we get
mHplus=mH3
#results
print '%s %.2e %s' %("Concentration of H plus ions =",mHplus,"m")
print 'The answer is a bit different due to rounding off error.'
#calculate the values of dS0, dH0, Krm
#Initialization of variableH
print "From table 14-3,"
HH=0
HHcoo=-98.
HHcooh=-98.
SH=0
SHcoo=21.9
SHcooh=39.1
KH=0
KHcoo=58.64
KHcooh=62.38
#calculationH
dH=HH+HHcoo-HHcooh
dS=SH+SHcoo-SHcooh
dK=KH+KHcoo-KHcooh
K=10**dK
#results
print '%s %.1f %s' %(" dS0 =",dS,"eu")
print '%s %.1f %s' %("\n dH0 =",dH,"kcal")
print '%s %.2f' %("\n log Krm =",dK)
print '%s %.1e %s' %("\n Krm =",K,"m")
#calculate the Activity of cl and ca
#Initialization of variables
mca=0.01 #m
mcl=0.02 #m
#calculations
Mu=0.5*(mca*4 + mcl*1)
print "From table 14-5,"
aca=6 #A
acl=3 #A
print "From table 14-6,"
gaca=0.555
gacl=0.843
Aca=gaca*mca
Acl=gacl*mcl
#results
print '%s %.4f' %("Activity of cl = ",Acl)
print '%s %.4f' %("\n Activity of ca = ",Aca)
#calculate the Concentration of H+ ions
#Initialization of variables
import math
m1=0.1 #m
m2=0.1 #m
K=1.754*10**-5 #m
#calculations
mu=0.5*(m1*1**2 + m2*1**2)
print("From table 14.5,")
aH=9 #A
aA=4.5 #A
print("From table 14.6")
gH=0.825
gA=0.775
gHA=1
x1=gHA*K/(gH*gA)
print("Assuming x to be small w.r.t m1,")
x=math.sqrt(x1*m1)
#results
print '%s %.2e %s' %("Concentration of H plus ions =",x," m")
#calculate the concentration of H+ ions
#Initialization of variables
import math
import numpy
K=1.754*10**-5 #m
c=0.1
#calculations
print("Neglecting x w.r.t c,")
x2=K
x=math.sqrt(K)
mu=x
print("From tables 14-5 and 14-6,")
gH=0.963
gA=0.960
x22=K/(gH*gA)
p=([1,x22, -c*x22])
z=numpy.roots(p)
alpha=z[1]
#results
print '%s %.2e %s' %("concentration of H plus ions =",alpha," m")
#calculate the Solubility of Agcl
#Initialization of variables
print("From table 14.3")
import math
K1=-13.5089
K2=-22.9792
K3=19.2218
c=0.1 #m
#calculations
logK=K1-K2-K3
K=10**logK
mu=0.5*(c*1**2 + c*1**2)
print("From tables 14-5 and 14-6,")
gAg=0.745
gCl=0.755
x2=K/(gAg*gCl)
x=math.sqrt(x2)
#results
print '%s %.2e %s' %("Solubility of Agcl =",x,"m")
#calculate the Concentration of Na and Cl in both cases
#Initialization of variables
import numpy
Cna=0.11
Ccl=0.1
#calculations
p=([99, - 2.1, Cna*Ccl])
z=numpy.roots(p)
alpha=z[1]
Na1=Cna-10*alpha
Cl1=Ccl-10*alpha
#results
print '%s %.4f %s' %(" Concentration of Na in 1 =",Na1,"M")
print '%s %.4f %s' %("\n Concentration of Cl in 1 =",Cl1," M")
print '%s %.4f %s' %("\n Concentration of Na in 2 =",alpha,"M")
print '%s %.4f %s' %("\n Concentration of Cl in 2 =",alpha,"M")