In [41]:

```
q=4.0*10**-3;#quantity of electricity in coulombs#
e=1.6*10**-19;#charge of an electron in coulombs#
N=q/e;#no. of electrons per second#
print'No. of electrons per second=N=',N
```

In [42]:

```
i=3;#current passed through the solution in amps#
t=5;#amount of time current passed through in hours#
q=(i*t)/26.8;#quantity of electricity passed in farads#
print'Quantity of electricity passed=q=Farads',q
print'\nIf all the current is used in the deposition of Ni,i.e 100percent efficiency 0.56 equivalents of Ni should be deposited at the cathode.'
N=0.56*0.60;#No. of equivalents of Ni deposited#
print'\nNo. of equivalents of Ni deposited=N=',N
w=58.71;#weight of Ni in grams#
wd=N*w/2;#weight of Ni actually deposited in grams#
print'\nWeight of Ni actually deposited=wd=grams',wd
TA=32;#total area of the cathode in cm^2 for 2faces#
d=8.9;#density of Ni in gram per cm^3#
V=wd/d;#volume of the Ni deposited in cm^3#
print'\nVolume of the Ni deposited=V=cm^3',V
T=V/TA;#thickness of the deposit in cm#
print'\nThickness of the deposit=T=cm',T
print'\nOut of 0.56Farad, 0.336Farad is used for Ni deposition\nhence 0.224Farad is used for liberation of hydrogen.'
print'\n0.224 equivalent of hydrogen is=11.2*0.224=2.51litres.'
```

In [43]:

```
i=5*10**-3;#steady current given by the cell in amps#
w=1.7399;#amount of MnO2 used in grams#
MW=86.95;#molecular weight of MnO2 in grams#
F=96500;#farad value in coulombs#
C=0.02*F;#charge value in coulombs#
print'From the cathode reaction 2mol of MnO2=2Farad.'
print'\n0.02Farad means the charge=C=Coulombs.',C
q=1930.;#charge in coloumbs corresponding to 0.02Farad#
t=q/i;#amount of time cell suplies the current in seconds#
print'\nAmount of time cell supplies the current=t=seconds',t
```

In [44]:

```
C=2.768*10**-3#conductivity of the cell in ohm^-1 cm^-1#
R=82.4;#resistance with KCl solution filled in ohms#
K=C*R;#cell constant in cm^-1#
print'Cell constant=K=cm^-1',K
R1=326.;#resistance with K2SO4 solution filled in ohms#
c=K/R1;#Equivalent conductance of the KCl solution in ohm^-1 cm^-1#
print'\nEquivalent conductance of the KCl solution=c=%=7*10^-4ohm^-1 cm^-1',c
print'\n0.0025M K2SO4 solution=0.005N of K2SO4.'
EC=1000*c/0.005;#equivalent conductance of K2SO4 solution in ohm^-1 cm^2#
print'\nEquivalent conductance of K2SO4 solution=EC=ohm^-1cm^2',round(EC)
```

In [45]:

```
wAg=1.424;#weight of Ag deposited in the coulometer in grams#
MW=108;#molecular weight of AgNO3 in grams#
w1=90.25;#weight of silver nitrate in grams#
w2=5.039;#weight of AgNO3 in grams#
w=w1-w2;
n=wAg/MW;
print'No. of equivalents of Ag deposited in the silver coulometer=n=.',n
print'\nThis amount of Ag+ and NO3- ions would have discharged at the cathode and at the anode respectively.'
print'\n Anolyte solution\nBefore electrolysis 85.21(90.25-5.039)grams of water contained 0.02965 equivalents of AgNO3 or Ag+.'
BEAg=0.007202;#no. of equivalents of Ag+ before electrolysis#
print'\nAfter electrolysis 20.893-0.193 i.e 20.7grams of water contains 0.001136equivalents of AgNO3 or Ag+.'
AEAg=0.01136;#no. of equivalents of Ag+ after electrolysis#
print'\n20.7grams of water,before electrolysis would have contained 0.007202 equivalents of Ag+.'
DC=BEAg-AEAg;#decrease in the conc. of anolyte#
print'\nDecrease in the conc. of anolyte=equivalents.',DC
tAg=n/DC;#transport number#
print'\ntAg=ratio of Decrease in anolyte conc. and No. of gram equivalents deposited at either electrode=',round(tAg,2)
```

In [46]:

```
wCu=0.0230;#weight of Cu deposited in the coulometer in grams#
MW=63.54;#molecular weight of Cu in grams#
n=wCu*2/MW;#no. of equivalents of Cu deposited#
print'In the coulometer,wt of Cu deposited=0.0230grams'
print'\nNumber of equivalents of Cu deposited=n=equivalents or Farads.',n
print'\nThis would have resulted in deposition of 7.24*10^-4equivalents of Ag+ at the cathode \nand dissolution of the same amount at the anode.'
wAgNO3=7.39;
w1AgNO3=0.2360;#after electrolysis weight of AgNO3#
MWAgNO3=170;#molecular weight of AgNO3#
BEAgNO3=wAgNO3/MWAgNO3;
print'\n Anolyte solution \nBefore electrolysis 1000grams of water contains equivalents of AgNO3',BEAgNO3
AEAgNO3=w1AgNO3/MWAgNO3;
print'\nAfter electrolysis 23.14grams of water contains equivalents of AgNO3.',AEAgNO3
w=23.14;
BE=w*BEAgNO3/1000;
print'\n23.14grams of water before electrolysis would have contained equivalents of AgNO3',BE
IC=AEAgNO3-BE;
print'\nIncrease in the concentration of anolyte=IC=equivalents.',round(IC,3)
print'\n0.000382gram equivalents of NO3- ions must have migrated into the anode compartment.\nAs a result of passin 7.24*10^-4Farads into the solution.\n0.000724equivalents of Ag should have dissolved to give the same amount of Ag+ ion.\nOut of this 0.000382gram equivalents are present in the anolyte.'
ME=n-IC;#no of equivalents of migrated anodes#
print'\n%fgram equivalents of Ag+ ions must have migrated from the anode.',round(ME,3)
tAg=ME/n;#transport number#
print'\nTransport number of Ag=tAg=',round(tAg,3)
tSO3=1-tAg;
print'\nTransport number of SO3=tSO3=',round(tSO3,3)
```

In [47]:

```
EC=426;#equivalent conductance of HCl in ohm^-1cm^2#
tH=0.82;#transport number of H+#
tCl=0.18;#transport number of Cl-#
ICH=EC*tH;#ionic conductance of H+ in ohm^-1cm^2#
print'Ionic conductance of H+=ICH=ohm^-1cm^2',ICH
ICCl=EC*tCl;#ionic conductance of Cl- in ohm^-1cm^2#
print'\nIonic conductance of Cl-=ICCl=ohm^-1cm^2',ICCl
F=96500;
IMH=ICH/F;#ionic mobility of H+ in cm^2v^-1s^-1
print'\nIonic mobility of H+=IMH==cm^2v^-1s^-1',IMH
IMCl=ICCl/F;#ionic mobility of H+ in cm^2v^-1s^-1
print'\nIonic mobility of H+=IMCl==m^2v^-1s^-1',IMCl
```

In [48]:

```
print'A solution of NH3 is alkaline due to the following hydrolysis\nNH3+H2O = NH4+ + OH-'
print'\nKb=(NH4+)*(OH-)/(NH3)=(c*a^2)/(1-a). '
EC=3.7;#equivalent conductance of NH3 in water in ohm^-1cm^2#
EC0NH4Cl=149.9;#equivalent conductance of NH4Cl in ohm^-1cm^2#
EC0BaCl2=139.9;#equivalent conductance of 1/2BaCl2 in ohm^-1cm^2#
EC0BaOH2=262.2;#equivalent conductance of 1/2Ba(OH)2 in ohm^-1cm^2#
EC0=EC0NH4Cl-EC0BaCl2+EC0BaOH2;#effective Equivalent conductance in ohm^-1cm^2#
print'\nEC0=ohm^-1cm^2',EC0
a=EC/EC0;#dissociation constant of the solution#
print'\nDissociation constant of the solution=a=',a
C=0.1;#normality of the solution#
Kb=(C*a**2)/(1-a);
print'\nIonization constant=Kb=',Kb#here the values of a and Kb are slightly different from textbook but that is ok#
```

In [49]:

```
SCsat=4.63*10**-6;#Specific conductance of saturated solution in ohm**-1cm**-1#
SCused=1.12*10**-6;#specific conductance of the water used in the experiment#
SC0Na2SO4=130.1;#specific conductance of Na2SO4 in ohm**-1cm**-1#
SC0BaCl2=139.9;#specific conductance of 1/2BaCl2 in ohm**-1cm**-1#
SC0NaCl=126.5;#specific conductance of NaCl in ohm**-1cm**-1#
SC0=SC0Na2SO4-SC0NaCl+SC0BaCl2;#effective specific conductance in ohm**-1cm**2#
print'SC0=ohm**-1cm**-1',SC0
SC=SCsat-SCused;
print'\nSpecific conductance of the experiment=SC=ohm**-1cm**-1',SC
S=(SC*1000)/SC0;#Solubility of the solution#
print'\nSolubility of the solution=S=gram equivalent per litre',S
print'\n1mol of BaSO4=2equivalents'
SBaSO4=S/2;#Solubility of the BaSO4 solution#
print'\nSolubility of the BaSO4 solution=SBaSO4==mol litre**-1',SBaSO4
```

In [50]:

```
M1=0.1;#Hmolarity of KCl#
IKCl=0.5*(M1*1**2+M1*1**2);#Iconic strength of KCl#
print'Iconic strength of KCl=IKCl=',IKCl
M2=0.2;#molarity of K2SO4#
IK2SO4=0.5*(2*M2*1**2+M2*2**2);#Iconic strength of K2SO4#
print'\nIconic strength of K2SO4=IK2SO4=',IK2SO4
M3=0.2;#molarity of MgCl2#
IMgCl2=0.5*(M3*2**2+2*M3*1**2);#Iconic strength of MgCl2#
print'\nIconic strength of MgCl2=IMgCl2=',IMgCl2
I=IKCl+IK2SO4+IMgCl2;#total iconic strength of the mixture#
print'\nTotal Iconic strength of the mixture=I=',I
```

In [51]:

```
from math import log10
r=0.96;
I=(log10(r)/-0.51)**2;#Iconic strength of the HCl solution#
print'Iconic strength of the HCl solution=I=',I
print'\nHCl being a 1,1 electrolyte I=c'
print'\nSo the maximum concentration of HCl to be used=I=c=1.20*10**-3'
```

In [52]:

```
w=3.55;#weight of the salt in grams#
MW=258.2;#Molecular weight of the salt#
print'KAl(SO4)2 = K+ + Al3+ + 2SO42-'
c=w*4/MW;#Concentration of the salt#
print'\nConcentration of the salt=c=M',c
SO4=2*c;#Concentration of SO42- in the solution#
print'\nconcentration of K+ = Al3+ =M',c
print'\nConcentration of SO42- =M',SO4
```

In [53]:

```
c=0.1;#concentration of the solution#
a=1.332*10**-2;#Ionization constant#
Ka=(c*a**2)/(1-a);
print'CH3COOH = CH3COO- + H+'
print'\nKa value for the reaction=Ka',Ka
```

In [54]:

```
c=0.1;#concentration of the solution#
Kb=1.8*10**-5;
print'The value of a should be calculated first using Kb=(c*a**2)/(1-a)\nThis gives rise to a quadratic equation which can be solved to obtain the value of a.'
print'\nUsually it is permissible to use approximation methods if K<10**-5\nOne can neglect a in comparison to 1 and solve for a.\nA better way is to use the method of succesive approximations.\nThis will be illustrated using the above equation'
print'\nFirst find the approximate value of a by neglecting the value of a in comparison with 1.\nLet the approximate value be a1'
a1=1.342*10**-2;
a2=1.332*10**-2;
print'\nWe repeat this procedure till 2 consecutive values of a do not differ significantly.'
a3=1.332*10**-2;
OH=a3*c;#concentration of OH- in the solution#
print'\nSince the values of a2 and a3 are the same the correct value of a=1.332*10**-2\nThe approximate value is greater than the correct value by about 1percent.'
print'\nThe concentration of OH- ==1.332*10**-3M',OH
```

In [55]:

```
Kw=1.0**10**-14;
KH1=1.0*10**-5;#KH value of H+ ion in RCOOH#
KH2=1.0**10**-10;#KH value of H+ ion in HCN#
Kb1=Kw/KH1;#Kb value for RCOO- ion#
print'Kb value for RCOO- ion=10^-9 ',Kb1
Kb2=Kw/KH2;#Kb value for CN- ion#
print'\nKb value for CN- ion=10^-4',Kb2
print'\nCN- is about 10^5 times stronger than RCOO- as a base.'
```

In [56]:

```
from math import log10
c1=1;#concentration of HCl#
PH1=-log10(c1);
print'PH for the 1M HCl solution=PH1=',PH1
c2=5.2*10**-4;#concentration of H+ in the solution#
PH2=-log10(c2);
print'\nPH for the solution=PH2=',PH2
c3=0.025;#concentration of 0.025M HClO4#
PH3=-log10(c3);
print'\nPH for the 0.025M HClO4 solution=PH3=',PH3
PH4=4.45;
c4=10**(-PH4);#concentration of the solution#
print'\nConcentration of the solution=c4==3.548*10**-5',c4
POH5=1.30;
PH5=14-POH5;
c5=10**(-PH5);#concentration of the solution#
print'\nConcentration of the solution=',c5
```

In [57]:

```
from math import log10
a=1.33*10**-2;#Ionization constant#
c=0.1;#concentration of the solution#
OH=a*c;
print'OH- =a*c=1.33*10**-3'
POH=-log10(OH);#POH of the solution#
print'\nPOH of the solution=POH=',POH
PH=14-POH;#PH of the solution#
print'\nPH of the solution=PH=',PH
```

In [58]:

```
from math import log10,sqrt
c=0.01;#concentration of the solution#
r=10**(-0.51*sqrt(c));
print'r=',r
a=r*c;#ionization constant#
print'\nIonization constant=a=',a
PH=-log10(a);#PH of the solution#
print'\nPH of the solution=PH=',PH
print'\nBy assuming ideal behaviour PH=-log10(10^-2)=2.00'
```

In [59]:

```
from math import log10
CNH3=0.1;#concentration of NH3 solution#
CNH4Cl=0.1;#concentration of NH4Cl solution#
POH=4.74;
PH=14-POH+log10(CNH3/CNH4Cl);
print'PH of the solution=PH=',PH
print'\nOn adding 0.01mol of HCl,assuming that no volume change occurs,0.01mol of NH4Cl is produced.\nTherefore,the concentration of NH3 decreases by 0.01 and that of NH4Cl increases by 0.01 '
C1NH3=0.09;
C1NH4Cl=0.11;
PH1=14-POH+log10(C1NH3/C1NH4Cl);
print'\nPH of the solution=PH1=',PH1
print'\nOn adding 0.01mol of NaOH,assuming that no volume change occurs,0.01mol of NH3 is produced.\nTherefore,the concentration of NH3 increases by 0.01 and that of NH4Cl decreases by 0.01 '
C2NH3=0.11;
C2NH4Cl=0.09;
PH2=14-POH+log10(C2NH3/C2NH4Cl);
print'\nPH of the solution=PH2=',round(PH2,2)
```

In [60]:

```
from math import log10
c=0.1;#concentration of the solution#
Kw=1.0*10**-14;
Ka=7.24*10**-10;#dissociation constant of HCN#
print'For a salt of this type the hydrolysis reaction is\nCN- +H2O = HCN + OH-'
Kh=Kw/Ka;#hydrolysis constant#
print'\nHydrolysis constant of the solution=Kh==1.381*10**-5',Kh
print'\nIonization constant is generally calculated using Kh=(c*a**2)/(1-a)'
print'\nIonization constant=a=0.011680=1.168*10**-2'
print'\nThe degree of hydrolysis is 1.168percent'
PKw=23.14;
PH=0.5*(PKw+log10(c));#PH of the 0.1M NaCN solution#
print'\nPH of the 0.1M NaCN solution=PH=',PH
```

In [61]:

```
from math import sqrt
MW=332;#molecular weight of Ag2CrO4 in grams#
s=2.5*10**-2;#solubility of Ag2CrO4 in g per litre#
S=s/MW;#Solubility of Ag2CrO4 in mol per litre#
print'Solubility of Ag2CrO4=S==7.5*10**-5mol per litre',S
Ag=2*7.5*10**-5;#Solubility of Ag component in mol per litre#
CrO4=7.5*10**-5;#Solubility of CrO4 component in mol per litre#
Ksp=Ag*CrO4;#value of Ksp#
print'\nValue of Ksp for the reaction=Ksp==1.7*10**-12',Ksp
MWAgCl=143.5;#Molecular weight of AgCl#
Ksp1=1.1*10**-10;#Ksp value of AgCl#
S1=sqrt(Ksp1);#Solubility of AgCl in mol per litre#
print'\nSolubility of AgCl=S1==1.05*10**-5mol per litre',S1
s1=S1*MWAgCl;#solubility of AgCl in g per litre#
print'\nSolubility of AgCl=s1==1.50*10**-3gram per litre',round(s1,4)
```

In [62]:

```
MW=372.;#molecular weight of Li3Na3(AlF6)2 in grams#
s=0.74;#solubility of Li3Na3(AlF6)2 in g per litre#
S=s/MW;#Solubility of Li3Na3(AlF6)2 in mol per litre#
print'Solubility of Li3Na3(AlF6)2=S=mol per litre',S
Li=3*S;#Solubility of Li component in mol per litre#
Na=3*S;#Solubility of Na component in mol per litre#
AlF6=2*s;#Solubility of AlF6 component in mol per litre#
Ksp=(Li**3)*(Na**3)*(AlF6**2);#value of Solubility product#
print'\nValue of Ksp for the reaction=',Ksp
```

In [63]:

```
Ksp=2.2*10**-8;#Solubility product of PbSO4#
Pb=0.01;#concentration of Pb in Pb(NO3)2#
SO4=Ksp/Pb;#Concentration of SO4 in PbSO4 solution#
print'Let us first calculate the maximum concentration of SO4 that can remain in equilibrium with PbSO4 if the concentration of Pb is 0.01M'
print'\nConcentration of SO4 in PbSO4 solution=Ksp=2.2*10**-6M\nThe concentration of SO4 should be greater than 2.2*10**-4M in order to precipitate Pb from a 0.01M solution as PbSO4'
Pb2=Ksp/0.001;
print'\nConcentration of Pb in PbSO4 solution=Pb2=2.2*10**-5mol per litre'
print'\nHence out of 0.01moles of Pb in a litre only 2.2*10**-5mol per litre remain in solution.the precipitation is almost 99.78percent complete.'
print'\nTherefore it can be said that Pb is quantitatively precipitated in these conditions.'
```

In [1]:

```
Cu=0.1;#concentration of Cu2+ ions in the solution#
Mn=0.1;#concentration of Mn2+ ions in the solution#
H=0.3;#concentration of H+ ions in the solution#
KspCuS=1.0*10**-44;#Solubility product of CuS#
KspMnS=1.4*10**-15;#Solubility product of MnS#
K1=9.1*10**-8;#K1 value of the H2S solution#
K2=1.2*10**-15;#K2 value of the H2S solution#
K=K1*K2;#K value of H2S#
print'K value of H2S solution=',K
S2=K/H**2;#Concentration of S2- in the solution#
print'Concentration of S2 in the solution=1.22*10**-22\nThe Iconic product of CuS=1.22*10**-22*10**-1 is >> Ksp for CuS and so it precipitates.'
print'\nIf MnS were to precipitate the S2 should be greater than the equilibrium concentration of S2\ni.e Mn*S2 = 1.4*10**-15 so S2eq=1.4*10**-14'
print'\nThe S2 should be greater than 1.4*10**-14 so that MnS will precipitate.\nLet the S2 desired be 1.1*10**-11\nIn order to get this concentration of S2 the required H is 10**-6M'
print'\nThe solution should have a PH of greater than 6 i.e PH >> 6'
```

In [65]:

```
Al=0.01;#concentration of Al3+ ions in the solution#
Mg=0.01;#concentration of Mg2+ ions in the solution#
NH4Cl=2;#concentration of NH4Cl in the solution#
print'NH3 + H2O = NH4+ + OH-'
KspMgOH2=3.4*10**-11;#Solubility product of Mg(OH)2#
KspAlOH3=5.0*10**-33;#Solubility product of Al(OH)3#
Kb=1.8*10**-5;#Kb value of the NH3#
print'\nNH4+ in solution = NH4+ from added NH4Cl that derived from the reaction between NH3 and H2O = NH4+ from NH4Cl(since the other quantity is too small)'
print'\nNH3 = Original concentration since amount dissociated is very low\nwe get OH- = 1.8*10**-5\nThe iconic product for Mg(OH)2 is (Mg2+)(OH-)**2 or (10**-2)(1.8*10**-5)**2 i.e 3.24*10**-12\nIt is less than 3.4*10**-11,Ksp,So it is not precipitated.'
print'\nHowever,in the case of Al(OH)3 the Iconic product=(10**-2)(1.8*10**-5)**3=5.832*10**-17>>The Ksp for Al(OH)3 i.e 5.0*10**-33.'
print'\nso Al(OH)3 gets precipitated.'
```

In [66]:

```
Fe=0.01;#concentration of Fe3+ ions in the solution#
Ksp=3.8*10**-38;#Solubility product of Fe(OH)3#
OH=(Ksp/Fe)**0.333;#Concentration of OH- ions in the solution#
print'Concentration of OH- ions in the solution=OH==1.561*10**-12',OH
print'\nAt this PH,Fe(OH)3 starts precipitating and precipitation is complete (Fe3+)=10**-6M\n(10**-6)(OH-)**3 = 3.8*10**-38 '
print'\nupon solving this we get (OH-)=3.362*10**-11\nPOH=10.48 or PH=3.52'
print'\nAt this PH the precipitation of Fe(OH)3 is almost complete.'
```

In [67]:

```
from math import sqrt
C=0.01;#concentration of Ca(NO3)2 solution#
Ksp=3.2*10**-11;#Solubility product of Fe(OH)3#
print'CaF2 = Ca2+ + 2F-\n(Ca2+)(F-)**2 = 4*S**3 = 3.2*10**-11.'
print'\nLet S1 be the solubility in 0.01M Ca(NO3)2\nCa(NO3)2 can be assumed to dissociate completely so that (Ca2+) from Ca(NO3)2 is 0.01M'
S=(Ksp/4)**0.33;#solubility in mol per litre#
print'\nSolubility of CaF2 solution=S==2.18*10**-4mol per litre',S
print'\nThe solubility product relationship should be true,irrespective of the source Ca2+\nCompared to the concentration of Ca2+ ions obtained from Ca(NO3)2,that of Ca2+ ions from CaF2 is negligible'
S1=sqrt(Ksp/0.04);#solubility in 0.01M ca(NO3)2#
print'\nBut the F- ions are obtained only from CaF2 and so (F-)=2*S1\nKsp = 3.2*10**-11=(S1+0.01)*(2*S1)**2=(0.01)*(2*S1)**2 since S1 is negligible compared to 0.01'
print'\nSolubility in 0.01M Ca(NO3)2 solution=S1=%f=2.83*10**-5',S1
print'\nThus the value of S1 can be seen to be less than that of S'
```

In [68]:

```
T=298;#temperature in kelvin#
E=0.22;#emf of the cell in volts#
dE=-0.00065;#Temperature coefficient of the emf in volt per degree#
c=4.184;#1 cal =4.184 joules#
n=1;
F=96500.;#1Farad value#
print'The positive electrode is the cathode and the negative electrode is the anode in a galvanic cell\nAnode reaction 1/2H2 = H+ + e-\nCathode reaction AgCl + e- = Ag+ + Cl-\nCell reaction 1/2H2 + AgCl = Ag+ + H+ + Cl-'
dG=-n*F*E/c;#free energy change in the cell in cal per mol#
print'\nFree energy change in the cell=dG=cal per mol',dG
dH=dG+(n*F*T*dE/c);#Enthalpy change in the cell#
print'\nEnthalpy change in the cell=dH=cal per mol',round(dH,2)
dS=(dH-dG)/T;#Entropy change in the cell in cal per deg#
print'\nEntropy change in the cell=dS=cal per deg',round(dS,2)
```