from math import log, sqrt
#Variable Declaration
aH = 0.770 #Activity of
fH2 = 1.13 #Fugacity of Hydrogen gas
E0 = 0.0 #Std. electrode potential, V
n = 1.0 #Number of electrons transfered
#Calculations
E = E0 - (0.05916/n)*log(aH/sqrt(fH2),10)
#Results
print 'The potential of H+/H2 half cell %5.4f V'%E
#Variable Declaration
E0r1 = -0.877 #Std Electrod potential for Rx2 : Al3+ + 3e- ------> Al (s)
E0r2 = -1.660 #Std Electrod potential for Rx2 : Al3+ + 3e- ------> Al (s)
E0r3 = +0.071 #Std Electrod potential for Rx3 : AgBr (s) + e- ------> Ag(s) +Br- (aq.)
#Calculations
#3Fe(OH)2 (s)+ 2Al (s) <---------> 3Fe (s) + 6(OH-) + 2Al3+
E0a = 3*E0r1 + (-2)*E0r2
#Fe (s) + 2OH- + 2AgBr (s) -------> Fe(OH)2 (s) + 2Ag(s) + 2Br- (aq.)
E0b = -E0r1 + (2)*E0r3
#Results
print '%5.3f %5.3f'%(E0a,E0b)
#Variable Declaration
E01 = 0.771 #Rx1 : Fe3+ + e- -----> Fe2+
E02 = -0.447 #Rx2 : Fe2+ + 2e- -----> Fe
F = 96485 #Faraday constant, C/mol
n1,n2,n3 = 1.,2.,3.
#Calculations
dG01 = -n1*F*E01
dG02 = -n2*F*E02
#For overall reaction
dG0 = dG01 + dG02
E0Fe3byFe = -dG0/(n3*F)
#Results
print 'E0 for overall reaction is %5.3f V'%(E0Fe3byFe)
#Variable Declaration
E01 = +1.36 #Std. electrode potential for Cl2/Cl
dE0bydT = -1.20e-3 #V/K
F = 96485 #Faraday constant, C/mol
n = 2.
S0H = 0.0 #Std. entropy J/(K.mol) for H+ ,Cl-,H2, Cl2
S0Cl = 56.5
S0H2 = 130.7
S0Cl2 = 223.1
nH, nCl, nH2, nCl2 = 2, 2, -1,-1
#Calculations
dS01 = n*F*dE0bydT
dS02 =nH*S0H + nCl*S0Cl + nH2*S0H2 + nCl2*S0Cl2
#Results
print 'Std. entropy change of reaction from dE0bydT is %4.2e and\nStd entropy values is %4.2e V'%(dS01,dS02)
from math import exp
#Variable Declaration
E0 = +1.10 #Std. electrode potential for Danniel cell, V
#Zn(s) + Cu++ -----> Zn2+ + Cu
T = 298.15 #V/K
F = 96485 #Faraday constant, C/mol
n = 2.
R = 8.314 #Gas constant, J/(mol.K)
#Calculations
K = exp(n*F*E0/(R*T))
#Results
print 'Equilibrium constant for reaction is %4.2e'%(K)
#Variable Declaration
E = +0.29 #Cell emf, V
n = 2.
#Calculations
Ksp = 10**(-n*E/0.05916)
#Results
print 'Equilibrium constant for reaction is %4.2e'%(Ksp)
#Variable Declaration
E = +1.51 #EMF for reduction of permangnet, V
E01 = -0.7618 #Zn2+ + 2e- --------> Zn (s)
E02 = +0.7996 #Ag+ + e- --------> Ag (s)
E03 = +1.6920 #Au+ + e- --------> Au (s)
#Calculations
EZn = E - E01
EAg = E - E02
EAu = E - E03
animals = {"parrot": 2, "fish": 6}
Er = {"Zn":EZn,"Ag":EAg,"Au":EAu}
#Results
print 'Cell potentials for Zn, Ag, Au are %4.2f V, %4.2f V, and %4.2f V'%(EZn, EAg,EAu)
for i in Er:
if Er[i] >0.0:
print '%s has positive cell potential of %4.3f V and Can be oxidized bypermangnate ion' %(i,Er[i])