from math import log10
# Variables
T = 25 # C
E = 0.296 # V
Cu = 0.015 # M
# Solution
Eo = E - 0.0296 * log10(Cu)
print "The standard electrode potential is", "{:.3f}".format(Eo), "V"
from math import log10
# Variables
T = 25 # C
Cu = 0.1 # M
Zn = 0.001 # M
Eo = 1.1
# Solution
E = Eo + 0.0296 * log10(Cu / Zn)
print "The emf of Daniell cell is", "{:.4f}".format(E), "V"
from math import log10
# Constant
R = 8.314 # J / K
F = 96500 # C / mol
# Variables
Cu = 0.15 # M
Eo = 0.34 # V
T = 298 # K
n = 2 # moles
# Solution
E = Eo + (2.303 * R * T) / (n * F) * log10(Cu)
print "The single electrode potential for copper metal is", "{:.4f}".format(E),
print "V"
# Variable
Eo_Cu = 0.3370 # Cu+2 -> Cu
Eo_Zn = - 0.7630 # Zn -> Zn +2
# Solution
Eo_cell = Eo_Cu - Eo_Zn
print "Daniel cell is, Zn | Zn +2 || Cu+2 | Cu"
print "Eo (cell) is", Eo_cell, "V"
# Variable
Eo_Cu = 0.3370 # Cu+2 -> Cu
Eo_Cd = - 0.4003 # Cd -> Cd +2
# Solution
Eo_cell = Eo_Cu - Eo_Cd
print "Cell is, Cd | Cd +2 || Cu+2 | Cu"
print "Eo (cell) is", Eo_cell, "V"
# Constant
F = 96500 # C / mol
# Variables
n = 2
T = 25 # C
Eo_Ag = 0.80 # Ag+ / Ag
Eo_Ni = - 0.24 # Ni+2 / Ni
# Solution
Eo_Cell = Eo_Ag - Eo_Ni
print "Standard free energy change,"
delta_Go = - n * F * Eo_Cell
print delta_Go, "J / mol"
# Solution
print "-------------------------"
print "Reduction half reaction:",
print "2Fe+3 + 2e- --> 2Fe+2"
print "Oxidation half reaction:",
print "Fe - 2e- --> Fe+2"
print "Overall cell reaction :",
print "2Fe+3 + Fe --> 3Fe+2"
print "-------------------------"
print "Reduction half reaction:",
print "Hg+2 + 2e- --> Hg"
print "Oxidation half reaction:",
print "Zn - 2e- --> Zn+2"
print "Overall cell reaction :",
print "Hg+2 + Zn --> Hg + Zn+2"
# Constant
F = 96500 # C / mol
# Variables
E1o = - 2.48 # V
E2o = 1.61 # V
# Solution
delta_G1 = - 3 * F * (- 2.48)
delta_G2 = - 1 * F * 1.61
print "delta_G3 = delta_G1 + delta_G2"
print "delta_G3 = - 4 * F * E3o"
E3o = (delta_G1 + delta_G2) / (- 4 * F)
print "The reduction potential for the half-cell Pt/Ce, Ce+4",
print "is", "{:.4f}".format(E3o), "V"
# Solution
print "Anodic half reaction :",
print " Cd --> Cd+2 + 2e-"
print "Cathodic half reaction :",
print "2H+ + 2e- --> H2"
print "-" * 50
print "Overall cell reaction :",
print "Cd + 2H+ <--> Cd+2 + H2"
from math import log10
# Variables
T = 25 # C
Cu = 0.1 # M
Zn = 0.001 # M
Eo = 1.1 # V
# Solution
print "Zn(s) | Zn+2 (0.001M) || Cu+2(0.1M) | Cu(s)"
Ecell = Eo + 0.0592 / 2 * log10(Cu / Zn)
print "The emf of a Daniell cell is", "{:.4f}".format(Ecell), "V"
from math import log10
# Variables
pH = 7 # O2
Eo = 1.229 # V
pO2 = 0.20 # bar
# Solution
print "Nearnst's equation at 25C is,"
print "E = Eo - (0.0592 / 2) * log(1 / ([H+]^2 * [pO2]^ (1/2)))"
E = Eo - (0.0592 / 2) * log10(1.0 / (((10 ** (- 7)) ** 2) * (pO2 ** (1 / 2.0))))
print "The reduction potential for the reduction is",
print "{:.3f}".format(E), "V"
# descrepency due to calculation error in the book
# Variables
E_KCl = 0.2415 # V
E_cell = 0.445 # V
# Solution
print "Emf of the cell is"
print "At 25C,"
print "E = Er - El = Eref - ((RT)/ F) * ln H+"
pH = (E_cell - E_KCl) / 0.059
Eo_cell = - 0.8277 # V
print "Thus, equilibrium constant for the reaction"
print "\t 2H2O --> H3O+ + OH- may be calculated as"
K = 10 ** (Eo_cell / 0.0591)
print "K =", "{:.0e}".format(K)
# Variables
EoSn = 0.15 # V
EoCr = - 0.74 # V
# Solution
print "3Sn+4 + 2Cr --> 3Sn+2 + 2Cr+3"
Eo_cell = EoSn - EoCr
n = 6
K = 10 ** (n * Eo_cell / 0.0591)
print "The equillibrium constant for th reaction is", "{:.2e}".format(K)
# Variables
T = 25 # C
Eo = - 0.8277 # V
# Solution
print "The reversible reaction,"
print "2H2O <--> H3O+ + OH-"
print "May be divided into two parts."
print "2H2O + e- --> 1/2 H2 + OH- (cathode) Eo = -0.8277 V"
print "H2O + 1/2 H2 --> H3O+ + e- (anode) Eo = 0"
# Variables
E = 0.4 # V
# Solution
print "The cell is Pt(H2) | H+, pH2 = 1 atm"
print "The cell reaction is"
print "1/2 H2 --> H+ + e-"
pH = E / 0.0591
print "pH =", "{:.3f}".format(pH)