P2.5.2The iterative weak acid approximation
The iterative weak acid approximation determines the hydrogen ion concentration, \([\mathrm{H^+}]\) of an acid solution from the acid dissociation constant, \(K_a\), and the acid concentration, \(c\), by succesive application of the formula
\[[\mathrm{H^+}]_{n+1} = \sqrt{K_a\left( c - [\mathrm{H^+}]_n \right)},\]
starting with \([\mathrm{H^+}]_0 = 0\). The iterations are continued until \([\mathrm{H^+}]\) changes by less than some pre-determined, small tolerance value.
Use this method to determine the hydrogen ion concentration, and hence the pH (\(=-\log_{10}[\mathrm{H^+}]\)) of a \(c=0.01\;\mathrm{M}\) solution of acetic acid (\(K_a = 1.78 \times 10^{-5}\)). Use the tolerance TOL = 1.e-10.
Show solution
Here is one approach.
import math
TOL = 1.e-10
# Acid dissociation constant, acid concentration (M)
Ka, c = 1.78e-5, 0.01
Hp = 0.
while True:
lastHp, Hp = Hp, math.sqrt(Ka * (c - Hp))
if abs(lastHp - Hp) < TOL:
break
pH = -math.log10(Hp)
print('[H+] = {:g} M, pH = {:.2f}'.format(Hp, pH))
For a 0.01 M solution of acetic acid, the output is:
[H+] = 0.000413094 M, pH = 3.38