============================================================================== TITRATION APPROXIMATIONS: WHERE THE TEXTBOOK SHORTCUTS FAIL ============================================================================== Science Journaling Club, Volume 1 Issue 3, Spring 2025 python : 3.12.3 numpy : 2.4.2 master seed : 20250411 (numpy default_rng, PCG64) Kw : 1.000000e-14 (25 C, ideal solution) solver : bisection on charge balance, 90 halvings, pH in [-3,17] final bracket: 20 / 2**90 = 1.616e-26 pH units titrant : same concentration as analyte unless stated; dilution carried The computation is the experiment. No solution was mixed and no electrode was read. All activity coefficients are 1. ============================================================================== PART 1. VALIDATION ============================================================================== -- V1. Mass balance on the acid: do the speciation fractions sum to 1? monoprotic pKa 4.76 max |sum(alpha) - 1| = 2.220e-16 over 4001 pH values diprotic 1.25 / 4.27 max |sum(alpha) - 1| = 2.220e-16 over 4001 pH values triprotic 2.15/7.20/12.38 max |sum(alpha) - 1| = 3.331e-16 over 4001 pH values double-precision epsilon = 2.220e-16 worst residual is 1.5 eps. -- V2. Charge balance residual across full titration curves 16842 solved points over 42 (pKa, C) combinations, phi 0 to 2 worst |charge residual| / largest term = 4.352e-15 that is 19.6 eps. Charge balance holds to machine precision. -- V3. Strong acid with strong base: closed form, exact arithmetic For a fully dissociated acid nbar = 1 and (*) collapses to h - Kw/h = C_A - C_B, whose positive root is h = (D + sqrt(D^2 + 4Kw))/2 with D = C_A - C_B. The club solver runs its ordinary bisection driver on the same case. Past equivalence D is negative and that expression subtracts two nearly equal numbers, so we also evaluate the algebraically identical h = 2Kw / (sqrt(D^2 + 4Kw) - D), which does not. Both are printed. The disagreement between them is the closed form's. C (M) phi club solver pH closed form pH naive-form difference 1e-01 0.000 0.9999999999996 0.9999999999996 0.000e+00 +0.000e+00 1e-01 0.500 1.4771212547158 1.4771212547158 0.000e+00 +0.000e+00 1e-01 0.900 2.2787536007960 2.2787536007960 -4.441e-16 -4.441e-16 1e-01 0.999 4.3008110586873 4.3008110586874 -3.197e-14 -3.197e-14 1e-01 1.000 6.9999999999974 7.0000000000000 -2.579e-12 -2.579e-12 1e-01 1.001 9.6987546502688 9.6987546502689 -4.476e-12 -8.882e-15 1e-01 1.500 12.3010299956748 12.3010299956748 9.400e-07 +0.000e+00 1e-02 0.000 1.9999999999566 1.9999999999566 -2.220e-16 -2.220e-16 1e-02 0.500 2.4771212543288 2.4771212543288 0.000e+00 +0.000e+00 1e-02 0.900 3.2787535852748 3.2787535852748 -8.882e-16 -8.882e-16 1e-02 0.999 5.3006393539298 5.3006393539299 -6.661e-14 -6.661e-14 1e-02 1.000 6.9999999999993 7.0000000000000 -6.963e-13 -6.963e-13 1e-02 1.001 8.6989266985712 8.6989266985713 -2.309e-14 -6.040e-14 1e-02 1.500 11.3010299967497 11.3010299967497 -6.496e-10 +1.776e-15 1e-03 0.000 2.9999999956571 2.9999999956571 0.000e+00 +0.000e+00 1e-03 0.500 3.4771212156332 3.4771212156332 0.000e+00 +0.000e+00 1e-03 0.900 4.2787520331582 4.2787520331582 0.000e+00 +0.000e+00 1e-03 0.999 6.2844149291854 6.2844149291855 -8.527e-14 -8.527e-14 1e-03 1.000 7.0000000000000 7.0000000000000 -1.066e-14 -1.066e-14 1e-03 1.001 7.7151818384742 7.7151818384743 -5.418e-14 -5.418e-14 1e-03 1.500 10.3010301042376 10.3010301042376 -4.769e-11 +0.000e+00 1e-05 0.000 4.9999565770648 4.9999565770648 0.000e+00 +0.000e+00 1e-05 0.500 5.4767309163009 5.4767309163009 0.000e+00 +0.000e+00 1e-05 0.900 6.2638622789293 6.2638622789293 0.000e+00 +0.000e+00 1e-05 0.999 6.9891383389103 6.9891383389103 -8.882e-16 -8.882e-16 1e-05 1.000 7.0000000000000 7.0000000000000 -1.776e-15 -1.776e-15 1e-05 1.001 7.0108508071163 7.0108508071163 0.000e+00 +0.000e+00 1e-05 1.500 8.3021116828301 8.3021116828301 3.553e-15 -1.776e-15 worst absolute difference over 28 points: 2.579e-12 pH units worst against the cancelling form instead : 9.400e-07 pH units The residual left over is at phi exactly 1, where C_B = C_A and the sum C_B + h - Kw/h - C_A cancels two numbers of order 0.05 to reach one of order 1e-7. The float residual is identically zero over a window about 1e-11 pH wide, so nothing finer can be resolved there by any method that evaluates this expression in doubles. That is a real limit of the exact solver and it is eleven orders of magnitude below anything a chemist measures. The bisection agrees with the stable algebra to the last bit and beats the textbook quadratic by seven orders of magnitude past equivalence. We found this the wrong way round and had to go looking for a bug in the solver that was not there. -- V4. Pure water, no acid at all: pH must be exactly 7.000000 club solver : 7.000000000000000 analytic -log10(sqrt(Kw)) : 7.000000000000000 difference : +0.000e+00 pH units -- V5. Bisection against an eigenvalue polynomial root, same equation acid C phi bisection pH numpy.roots pH difference monoprotic pKa 4.76 1e-01 0.30 4.393110086768 4.393110086768 +0.000e+00 monoprotic pKa 4.76 1e-02 0.85 5.515252535157 5.515252535157 +0.000e+00 monoprotic pKa 4.76 1e-03 0.50 4.801212712609 4.801212712609 +0.000e+00 monoprotic pKa 1.00 1e-01 0.30 1.465593140094 1.465593140094 -4.441e-16 monoprotic pKa 1.00 1e-02 0.85 3.113773234394 3.113773234394 +0.000e+00 monoprotic pKa 1.00 1e-03 0.50 3.479997411146 3.479997411146 +4.441e-16 monoprotic pKa 11.0 1e-01 0.30 10.620737693834 10.620737693834 -3.553e-15 monoprotic pKa 11.0 1e-02 0.85 11.152737987733 11.152737987733 +6.395e-14 monoprotic pKa 11.0 1e-03 0.50 10.332944106453 10.332944106453 +1.776e-15 oxalic 1.25 / 4.27 1e-01 0.30 1.548941925285 1.548941925285 +0.000e+00 oxalic 1.25 / 4.27 1e-02 0.85 3.002562941583 3.002562941583 -8.882e-16 oxalic 1.25 / 4.27 1e-03 0.50 3.391024195631 3.391024195631 -4.441e-16 carbonic 6.35 / 10.33 1e-01 0.30 5.982003650565 5.982003650565 -8.882e-16 carbonic 6.35 / 10.33 1e-02 0.85 7.101335882219 7.101335882219 +1.776e-15 carbonic 6.35 / 10.33 1e-03 0.50 6.350966075041 6.350966075041 +8.882e-16 phosphoric 2.15/7.2/12.4 1e-01 0.30 2.016821585160 2.016821585160 +4.441e-16 phosphoric 2.15/7.2/12.4 1e-02 0.85 3.324338005984 3.324338005984 +0.000e+00 phosphoric 2.15/7.2/12.4 1e-03 0.50 3.514316415684 3.514316415684 +0.000e+00 worst absolute difference over 18 points: 6.395e-14 pH units The companion-matrix root is the limiting factor here, not the bisection: the polynomial's coefficients span Kw. -- V6. Bisection against 60-digit decimal arithmetic, same equation acid C phi 60-digit pH float - decimal monoprotic pKa 4.76 1e-01 0.30 4.393110086767503475 +0.000e+00 monoprotic pKa 4.76 1e-04 0.50 5.017530712932184223 +8.882e-16 monoprotic pKa 1.00 1e-01 0.30 1.465593140094403113 -2.220e-16 monoprotic pKa 1.00 1e-04 0.50 4.477406680354713231 +0.000e+00 monoprotic pKa 11.0 1e-01 0.30 10.620737693833529391 +0.000e+00 monoprotic pKa 11.0 1e-04 0.50 9.495679017006839473 +0.000e+00 oxalic 1.25 / 4.27 1e-01 0.30 1.548941925285232335 -2.220e-16 oxalic 1.25 / 4.27 1e-04 0.50 4.195488549218477026 -8.882e-16 carbonic 6.35 / 10.33 1e-01 0.30 5.982003650565128616 -8.882e-16 carbonic 6.35 / 10.33 1e-04 0.50 6.360620152808435179 +0.000e+00 phosphoric 2.15/7.2/12.4 1e-01 0.30 2.016821585160080588 +0.000e+00 phosphoric 2.15/7.2/12.4 1e-04 0.50 4.479496162073444587 -8.882e-16 worst absolute difference over 12 points: 8.882e-16 pH units -- V7. Half equivalence of a weak acid: the textbook says pH = pKa This is the check that does NOT come out exact, and that is not a bug in the solver. Charge balance at phi = 0.5 gives [A-] = C_B + [H+] - [OH-], so [A-]/[HA] equals 1 only when [H+] - [OH-] is negligible beside C_B. To first order, pH - pKa = 4([H+] - [OH-]) / (C_A ln10). pKa C (M) exact pH pKa difference 1st-order est 4.76 1e+00 4.7600452768 4.76 +0.000045 +0.000045 4.76 1e-01 4.7604523440 4.76 +0.000452 +0.000452 4.76 1e-03 4.8012127126 4.76 +0.041213 +0.041182 4.76 1e-05 5.6022095007 4.76 +0.842210 +0.650175 2.00 1e-01 2.1760912590 2.00 +0.176091 +0.173718 1.00 1e-01 1.6670559581 1.00 +0.667056 +0.560892 0.50 1e-01 1.5540211576 0.50 +1.054021 +0.727636 10.00 1e-01 9.9974097235 10.00 -0.002590 -0.002590 11.00 1e-03 10.3329441065 11.00 -0.667056 -0.560892 12.00 1e-04 9.5200064842 12.00 -2.479994 -0.862856 13.00 1e-03 10.5200025889 13.00 -2.479997 -0.862856 The exact pH sits ABOVE pKa for strong acids, because the acid has already given up protons on its own, and BELOW pKa for very weak ones, because the conjugate base is pulling protons off water. The first-order estimate tracks the measured offset, which is the point: the deviation belongs to the approximation, not the solver. -- V8. The first-order half-equivalence rule against the solver, 675 cases C = 1e+00 rule vs exact: max error where |offset| < 0.05 = 4.50e-05 ; overall max = 0.043 C = 1e-01 rule vs exact: max error where |offset| < 0.05 = 4.50e-05 ; overall max = 0.457 C = 1e-02 rule vs exact: max error where |offset| < 0.05 = 4.50e-05 ; overall max = 1.326 C = 1e-03 rule vs exact: max error where |offset| < 0.05 = 4.50e-05 ; overall max = 2.310 C = 1e-04 rule vs exact: max error where |offset| < 0.05 = 4.47e-05 ; overall max = 3.309 A linearisation is excellent where the offset is small and only indicative where it is large. That is exactly what it does here, which confirms the algebra behind the whole error analysis. ============================================================================== PART 2. HENDERSON-HASSELBALCH ACROSS THE PARAMETER SPACE ============================================================================== grid: 57 pKa values (0 to 14 by 0.25) x 41 concentrations (1e-5 to 1 M, 8 per decade) x 81 titrated fractions (0.10 to 0.90) exact solutions in this map: 189297 fraction of the 2337 (pKa, C) cells whose worst buffer-window HH error exceeds: 0.01 pH units : 85.54 % (1999 cells) 0.02 pH units : 82.03 % (1917 cells) 0.05 pH units : 78.09 % (1825 cells) 0.10 pH units : 73.81 % (1725 cells) 0.20 pH units : 67.48 % (1577 cells) 0.50 pH units : 57.04 % (1333 cells) 1.00 pH units : 43.00 % (1005 cells) worst cell on the grid: pKa = 14.00, C = 1.000e-05 M, worst error = 6.279 pH and the worst point inside that cell is at phi = 0.900 -- Where in the buffer window the worst error lands cells whose worst point is at low phi (acid end) : 1148 cells whose worst point is at phi = 0.5 exactly : 0 cells whose worst point is at high phi (base end) : 1189 HH is worst at the EDGES of the buffer window, never in the middle. -- HH error at C = 0.1 M, the concentration of a teaching titration pKa err phi=0.1 err phi=0.5 err phi=0.9 worst |err| 0.00 -2.0766 -1.5043 -1.3467 2.0766 1.00 -1.2460 -0.6671 -0.5031 1.2460 2.00 -0.6402 -0.1761 -0.0900 0.6402 3.00 -0.2290 -0.0246 -0.0100 0.2290 3.75 -0.0682 -0.0046 -0.0018 0.0682 4.00 -0.0418 -0.0026 -0.0010 0.0418 4.75 -0.0083 -0.0005 -0.0002 0.0083 6.00 -0.0005 -0.0000 -0.0000 0.0005 8.00 +0.0000 +0.0000 +0.0008 0.0008 9.75 +0.0003 +0.0015 +0.0407 0.0407 10.00 +0.0006 +0.0026 +0.0666 0.0666 11.00 +0.0059 +0.0246 +0.3079 0.3079 12.00 +0.0547 +0.1761 +0.7658 0.7658 13.00 +0.3583 +0.6671 +1.4226 1.4226 14.00 +1.1246 +1.5043 +2.3001 2.3001 -- The same sweep at C = 1e-4 M, a thousandfold more dilute pKa err phi=0.1 err phi=0.5 err phi=0.9 worst |err| 0.00 -5.0414 -4.4771 -4.3244 5.0414 2.00 -3.0453 -2.4800 -2.3266 3.0453 4.00 -1.2460 -0.6670 -0.5028 1.2460 5.00 -0.6402 -0.1761 -0.0890 0.6402 6.00 -0.2289 -0.0244 -0.0019 0.2289 6.75 -0.0679 -0.0031 +0.0390 0.0679 7.00 -0.0412 +0.0000 +0.0657 0.0657 8.00 +0.0011 +0.0244 +0.3078 0.3078 9.00 +0.0542 +0.1761 +0.7658 0.7658 10.00 +0.3582 +0.6670 +1.4226 1.4226 12.00 +2.0910 +2.4800 +3.2810 3.2810 14.00 +4.0871 +4.4771 +5.2788 5.2788 ============================================================================== PART 3. THE BOUNDARY: WHERE HH CROSSES 0.05 AND 0.10 pH UNITS ============================================================================== For each concentration, HH's worst buffer-window error is large at low pKa (the acid is too strong and dissociates on its own), small in the middle, and large again at high pKa (the conjugate base deprotonates water). The usable band lies between the two. C (M) pKa lo .05 pKa hi .05 pKa lo .10 pKa hi .10 width .05 width .10 1.000e-05 nan nan nan nan nan nan 3.162e-05 nan nan nan nan nan nan 1.000e-04 nan nan 6.544 7.223 nan 0.678 3.162e-04 6.422 7.341 6.045 7.719 0.920 1.674 1.000e-03 5.922 7.840 5.545 8.219 1.918 2.674 3.162e-03 5.422 8.340 5.045 8.719 2.918 3.674 1.000e-02 4.922 8.840 4.545 9.219 3.918 4.674 3.162e-02 4.422 9.340 4.045 9.719 4.918 5.674 1.000e-01 3.922 9.840 3.545 10.219 5.918 6.674 3.162e-01 3.422 10.340 3.045 10.719 6.918 7.674 1.000e+00 2.922 10.840 2.545 11.219 7.918 8.674 -- A closed-form prediction of the same two boundaries Expanding both logarithms to first order gives HH error = -([H+] - [OH-]) / (C_A ln10 phi (1-phi)) and at the acid end [H+] = Ka (1-phi)/phi to zeroth order, so the error there is Ka / (C_A ln10 phi^2). Setting that to a threshold T at phi = 0.1 gives pKa_lo = -log10(T C_A ln10 phi^2). At the base end [OH-] = Kw phi / (Ka (1-phi)) and the same step gives pKa_hi = 14 + log10(T C_A ln10 (1-phi)^2) at phi = 0.9. C (M) T solver lo closed form diff solver hi closed form diff 1e+00 0.05 2.922 2.980 -0.058 10.840 10.782 +0.057 1e-01 0.05 3.922 3.980 -0.058 9.840 9.782 +0.057 1e-02 0.05 4.922 4.980 -0.058 8.840 8.782 +0.057 1e-03 0.05 5.922 5.980 -0.058 7.840 7.782 +0.058 1e-04 0.05 nan 6.980 +nan nan 6.782 +nan 1e-05 0.05 nan 7.980 +nan nan 5.782 +nan 1e+00 0.10 2.545 2.679 -0.134 11.219 11.083 +0.136 1e-01 0.10 3.545 3.679 -0.134 10.219 10.083 +0.136 1e-02 0.10 4.545 4.679 -0.134 9.219 9.083 +0.136 1e-03 0.10 5.545 5.679 -0.134 8.219 8.083 +0.136 1e-04 0.10 6.544 6.679 -0.135 7.223 7.083 +0.139 1e-05 0.10 nan 7.679 +nan nan 6.083 +nan The two agree to a few hundredths of a pKa unit across five decades of concentration, which is as much as a first-order expansion is entitled to. The boundary is not empirical; it is algebra. -- Where the band closes entirely Both edges move one pKa unit per decade of concentration, in opposite directions, so the band has to shut at some dilution. T = 0.05 pH: lo edge = -0.9998 log10C +2.9199, hi edge = +0.9995 log10C +10.8431 they meet at log10 C = -3.963, C = 1.089e-04 M, pKa = 6.882 below that concentration NO pKa keeps HH inside 0.05 pH T = 0.10 pH: lo edge = -0.9999 log10C +2.5468, hi edge = +0.9996 log10C +11.2160 they meet at log10 C = -4.336, C = 4.617e-05 M, pKa = 6.882 below that concentration NO pKa keeps HH inside 0.10 pH The fitted slopes are -0.9999 and +0.9996 against an exact prediction of -1 and +1 from the closed form above. -- The band at other tolerances The tolerance enters inside a logarithm, so changing it slides both edges by the same amount and moves the closing point. All five tolerances, located on the same grid: T (pH) lo at 0.1 M hi at 0.1 M width at 0.1M closes at C closing pKa 0.01 4.680 9.082 4.402 6.235e-04 6.882 0.02 4.366 9.398 5.032 3.007e-04 6.881 0.05 3.922 9.840 5.918 1.089e-04 6.882 0.10 3.545 10.219 6.674 4.617e-05 6.882 0.20 3.106 10.657 7.552 1.661e-05 6.882 -- Real acids at 0.1 M, worst HH error over the buffer window acid pKa worst |err| at phi err phi=0.5 inside 0.05? trichloroacetic 0.660 1.5033 0.10 -0.92165 NO dichloroacetic 1.350 1.0101 0.10 -0.44962 NO chloroacetic 2.865 0.2723 0.10 -0.03297 NO citric (pKa1) 3.130 0.1914 0.10 -0.01851 NO hydrofluoric 3.170 0.1807 0.10 -0.01695 NO formic 3.750 0.0682 0.10 -0.00459 NO benzoic 4.200 0.0276 0.10 -0.00164 yes acetic 4.756 0.0082 0.10 -0.00046 yes propanoic 4.874 0.0063 0.10 -0.00035 yes carbonic (pKa1) 6.350 0.0002 0.10 -0.00001 yes dihydrogenphosphate 7.198 0.0001 0.90 +0.00000 yes hypochlorous 7.530 0.0003 0.90 +0.00001 yes hydrocyanic 9.210 0.0128 0.90 +0.00042 yes ammonium 9.250 0.0140 0.90 +0.00046 yes phenol 9.990 0.0653 0.90 +0.00253 NO bicarbonate 10.330 0.1199 0.90 +0.00550 NO methylammonium 10.660 0.1990 0.90 +0.01160 NO hydrogenphosphate 12.375 0.9863 0.90 +0.31328 NO 8 of the 18 land inside 0.05 pH at this concentration. -- The narrow reading: HH restricted to phi between 0.2 and 0.8 C (M) lo .05 wide lo .05 narrow hi .05 wide hi .05 narrow 1e+00 2.922 2.365 10.840 11.467 1e-01 3.922 3.365 9.840 10.467 1e-02 4.922 4.365 8.840 9.467 1e-03 5.922 5.365 7.840 8.467 1e-04 nan 6.363 nan 7.472 1e-05 nan nan nan nan Mean gain on the strong-acid side: 0.560 pKa units. Predicted gain, 2 log10(0.2/0.1) = 0.602. Real, and modest. ============================================================================== PART 4. THE INITIAL-pH FORMULAS ============================================================================== At phi = 0 the taught answer is [H+] = sqrt(Ka C). Two things get dropped: the loss of HA to its own dissociation, and the protons water supplies. QUAD keeps the first and drops the second, which separates the two sources. pKa C (M) exact pH sqrt pH sqrt err quad pH quad err 4.75 1e+00 2.375916 2.375000 -0.0009 2.375916 +0.0000 4.75 1e-01 2.877896 2.875000 -0.0029 2.877896 +0.0000 4.75 1e-03 3.903935 3.875000 -0.0289 3.903936 +0.0000 4.75 1e-05 5.146465 4.875000 -0.2715 5.146531 +0.0001 2.00 1e-01 1.568385 1.500000 -0.0684 1.568385 +0.0000 1.00 1e-01 1.208988 1.000000 -0.2090 1.208988 +0.0000 0.00 1e-01 1.038067 0.500000 -0.5381 1.038067 +0.0000 0.00 1e-03 3.000434 1.500000 -1.5004 3.000434 +0.0000 7.00 1e-04 5.506639 5.500000 -0.0066 5.506867 +0.0002 9.00 1e-04 6.479899 6.500000 +0.0201 6.500687 +0.0208 10.00 1e-04 6.849562 7.000000 +0.1504 7.000217 +0.1507 12.00 1e-03 6.979304 7.500000 +0.5207 7.500007 +0.5207 13.00 1e-02 6.979304 7.500000 +0.5207 7.500001 +0.5207 -- Fraction of the (pKa, C) grid where each initial-pH formula fails sqrt(Ka C) >0.05 pH : 50.02 % >0.10 pH : 42.96 % worst : 2.500 pH quadratic >0.05 pH : 22.38 % >0.10 pH : 19.73 % worst : 2.500 pH -- The five percent rule, tested Textbooks say sqrt(Ka C) is safe when the dissociated fraction is under 5 percent, that is sqrt(Ka/C) < 0.05, that is Ka/C < 2.5e-3. cells satisfying the rule : 1486 of 2337 of those, |sqrt error| > 0.05 pH : 523 (35.20 % of the obedient cells) worst sqrt error inside the rule : 2.5000 pH worst quad error inside the rule : 2.5000 pH worst offender obeying the rule : pKa 14.00, C 1.0e-05 M, error +2.500 pH The rule controls the dissociation error it was written for and says nothing at all about the water error, which is what actually bites. -- At the equivalence point: pOH = (pKb - log10 C')/2 C' is the conjugate-base concentration after dilution, C/2 here. pKa C (M) exact pH formula pH difference 2.00 1e-01 7.389075 7.349485 -0.0396 2.00 1e-03 7.010595 6.349485 -0.6611 3.00 1e-01 7.853782 7.849485 -0.0043 3.00 1e-03 7.088040 6.849485 -0.2386 4.00 1e-01 8.349909 8.349485 -0.0004 4.00 1e-03 7.389002 7.349485 -0.0395 4.75 1e-01 8.724539 8.724485 -0.0001 4.75 1e-03 7.731855 7.724485 -0.0074 6.00 1e-01 9.349392 9.349485 +0.0001 6.00 1e-03 8.348951 8.349485 +0.0005 8.00 1e-01 10.348514 10.349485 +0.0010 8.00 1e-03 9.339779 9.349485 +0.0097 10.00 1e-01 11.339775 11.349485 +0.0097 10.00 1e-03 10.253165 10.349485 +0.0963 12.00 1e-01 12.253165 12.349485 +0.0963 12.00 1e-03 10.678724 11.349485 +0.6708 The formula treats A- as a weak base in pure water and ignores both the leftover HA and the water contribution. It fails from below for strong acids and from above for very weak ones. ============================================================================== PART 5. DROPPING WATER AUTOIONISATION ============================================================================== Kw set to zero, everything else exact. Evaluated over phi 0.10 to 0.90, because with no water term the equation has no solution at all at phi = 1: there is nothing left to balance the charge. fraction of 2337 cells where dropping water costs more than: 0.01 pH : 47.11 % 0.05 pH : 40.82 % 0.10 pH : 38.17 % 0.50 pH : 29.40 % 1.00 pH : 22.38 % C (M) pKa 2 pKa 5 pKa 8 pKa 10 pKa 12 1e+00 0.00000 0.00000 0.00008 0.00804 0.30785 1e-01 0.00000 0.00000 0.00082 0.06658 0.76582 1e-02 0.00000 0.00001 0.00804 0.30785 1.42262 1e-03 0.00000 0.00008 0.06659 0.76582 2.30009 1e-04 0.00016 0.00098 0.30788 1.42262 3.28102 1e-05 0.01490 0.02217 0.76584 2.29990 4.27879 -- The worst cells for dropping water pKa 14.00 C 1.00e-05 cost of dropping water = 6.279 pH pKa 14.00 C 1.33e-05 cost of dropping water = 6.154 pH pKa 14.00 C 1.78e-05 cost of dropping water = 6.029 pH pKa 13.75 C 1.00e-05 cost of dropping water = 6.029 pH pKa 14.00 C 2.37e-05 cost of dropping water = 5.904 pH pKa 13.75 C 1.33e-05 cost of dropping water = 5.904 pH Water is irrelevant for an ordinary carboxylic acid at 0.1 M and decisive for a phenol at 1e-5 M. Same equation, same solvent. ============================================================================== PART 6. POLYPROTIC ACIDS AND THE OVERLAP PROBLEM ============================================================================== HH applied to the FIRST buffer region of a polyprotic acid at C = 0.1 M, phi counted against the first proton only, window 0.1 to 0.9. dpK is the gap to the next pKa: the smaller it is, the worse HH does, because the second equilibrium is already running underneath the first. acid pKa1 formula dpK worst |err| at phi err phi=0.5 oxalic 1.250 H2C2O4 3.02 1.0740 0.100 -0.5040 maleic 1.920 C4H4O4 4.35 0.6814 0.100 -0.2007 malonic 2.830 C3H4O4 2.86 0.2840 0.100 -0.0337 phthalic 2.950 C8H6O4 2.46 0.2441 0.100 -0.0229 succinic 4.210 C4H6O4 1.43 0.3943 0.900 +0.0403 carbonic 6.350 H2CO3 3.98 0.0044 0.900 +0.0001 citric 3.130 C6H8O7 1.63 0.3177 0.900 +0.0096 phosphoric 2.148 H3PO4 5.05 0.5671 0.100 -0.1365 -- Monoprotic control at the same pKa1, for comparison acid pKa1 poly worst mono worst extra cost of proton 2 oxalic 1.250 1.0740 1.0746 -0.0006 maleic 1.920 0.6814 0.6814 -0.0000 malonic 2.830 0.2840 0.2842 -0.0002 phthalic 2.950 0.2441 0.2445 -0.0004 succinic 4.210 0.3943 0.0270 +0.3673 carbonic 6.350 0.0044 0.0002 +0.0042 citric 3.130 0.3177 0.1914 +0.1263 phosphoric 2.148 0.5671 0.5671 -0.0000 -- The amphiprotic shortcut pH = (pK1 + pK2)/2 for the salt NaHA A solution of the intermediate salt prepared directly at concentration C, so C_A = C_B = C, no dilution involved. salt of C (M) exact pH (pK1+pK2)/2 difference refined err oxalic 1e-01 2.861796 2.7600 -0.1018 -0.0049 oxalic 1e-03 3.689285 2.7600 -0.9293 -0.0505 maleic 1e-01 4.119965 4.0950 -0.0250 -0.0003 maleic 1e-03 4.657543 4.0950 -0.5625 -0.0052 malonic 1e-01 4.263423 4.2600 -0.0034 -0.0002 malonic 1e-03 4.467637 4.2600 -0.2076 -0.0105 phthalic 1e-01 4.182706 4.1800 -0.0027 -0.0003 phthalic 1e-03 4.357568 4.1800 -0.1776 -0.0142 succinic 1e-01 4.925185 4.9250 -0.0002 -0.0001 succinic 1e-03 4.942804 4.9250 -0.0178 -0.0048 carbonic 1e-01 8.339528 8.3400 +0.0005 +0.0000 carbonic 1e-03 8.297241 8.3400 +0.0428 +0.0008 citric 1e-01 3.945573 3.9450 -0.0006 +0.0010 citric 1e-03 4.091441 3.9450 -0.1464 -0.0260 phosphoric 1e-01 4.688005 4.6730 -0.0150 -0.0001 phosphoric 1e-03 5.129350 4.6730 -0.4563 -0.0018 The last column is the standard refinement h = sqrt((K1 K2 C + K1 Kw)/(K1 + C)), printed as its own error. It is much better and it is not error free either. ============================================================================== PART 7. MONTE CARLO OVER THE PARAMETER SPACE ============================================================================== Two regions, 200000 draws each, from the single seeded stream. A draw is a (pKa, C, phi) triple drawn uniformly in pKa, in log10 C and in phi; the statistic is whether HH's error at that point exceeds a threshold. Standard errors are binomial, taken from the runs themselves. -- region classroom: pKa (3.0, 10.0), log10 C (-2.0, 0.0), phi (0.2, 0.8) P(|HH error| > 0.02 pH) = 0.05543 +/- 0.00051 (5.543 % +/- 0.051 %) P(|HH error| > 0.05 pH) = 0.02210 +/- 0.00033 (2.210 % +/- 0.033 %) P(|HH error| > 0.10 pH) = 0.00771 +/- 0.00020 (0.771 % +/- 0.020 %) P(|HH error| > 0.20 pH) = 0.00119 +/- 0.00008 (0.119 % +/- 0.008 %) mean |HH error| = 0.00457 +/- 0.00004 pH median |HH error| = 0.00017 pH 90th percentile = 0.00882 pH 99th percentile = 0.08686 pH largest drawn = 0.35857 pH -- region wide: pKa (0.0, 14.0), log10 C (-5.0, 0.0), phi (0.05, 0.95) P(|HH error| > 0.02 pH) = 0.67439 +/- 0.00105 (67.439 % +/- 0.105 %) P(|HH error| > 0.05 pH) = 0.61766 +/- 0.00109 (61.766 % +/- 0.109 %) P(|HH error| > 0.10 pH) = 0.56833 +/- 0.00111 (56.833 % +/- 0.111 %) P(|HH error| > 0.20 pH) = 0.51187 +/- 0.00112 (51.187 % +/- 0.112 %) mean |HH error| = 0.89831 +/- 0.00279 pH median |HH error| = 0.22680 pH 90th percentile = 2.92221 pH 99th percentile = 4.76932 pH largest drawn = 6.46248 pH -- Convergence of the classroom-region estimate of P(error > 0.05) k trials running p SE p +/- 2 SE 100 0.00000 0.00000 -0.00000 to 0.00000 126 0.00794 0.00790 -0.00787 to 0.02375 159 0.01258 0.00884 -0.00510 to 0.03026 200 0.01500 0.00860 -0.00219 to 0.03219 251 0.01992 0.00882 0.00228 to 0.03756 316 0.02532 0.00884 0.00764 to 0.04299 398 0.02513 0.00784 0.00944 to 0.04082 501 0.02595 0.00710 0.01174 to 0.04015 631 0.02377 0.00606 0.01164 to 0.03590 795 0.02516 0.00555 0.01405 to 0.03627 1001 0.02398 0.00484 0.01431 to 0.03365 1260 0.02698 0.00456 0.01785 to 0.03611 1586 0.02585 0.00398 0.01788 to 0.03382 1997 0.02404 0.00343 0.01718 to 0.03089 2514 0.02506 0.00312 0.01882 to 0.03129 3166 0.02527 0.00279 0.01969 to 0.03085 3986 0.02459 0.00245 0.01968 to 0.02949 5018 0.02451 0.00218 0.02015 to 0.02888 6318 0.02453 0.00195 0.02064 to 0.02843 7954 0.02426 0.00173 0.02081 to 0.02772 10014 0.02427 0.00154 0.02119 to 0.02734 12608 0.02379 0.00136 0.02108 to 0.02651 15874 0.02268 0.00118 0.02032 to 0.02504 19986 0.02262 0.00105 0.02051 to 0.02472 25162 0.02202 0.00093 0.02017 to 0.02387 31680 0.02172 0.00082 0.02008 to 0.02336 39885 0.02174 0.00073 0.02028 to 0.02320 50216 0.02171 0.00065 0.02041 to 0.02301 63223 0.02170 0.00058 0.02054 to 0.02286 79599 0.02180 0.00052 0.02076 to 0.02283 100216 0.02214 0.00046 0.02121 to 0.02307 126173 0.02201 0.00041 0.02118 to 0.02284 158854 0.02224 0.00037 0.02150 to 0.02298 200000 0.02210 0.00033 0.02144 to 0.02276 of the 24 checkpoints at k >= 1000, 24 sit within 3 of their own SE of the final estimate 0.02210. -- The same statistic on a deterministic grid, as a cross-check The Monte Carlo draws uniformly in pKa, log10 C and phi, so the statistic is a volume fraction and a deterministic quadrature of the same box has to reproduce it. Two quadratures, printed because the first one is wrong and the reason is worth having in print. (a) reuse the Part 2 lattice, every node weighted equally. estimate 0.03102 over 30073 nodes, +0.00892 from the Monte Carlo, which is 27.1 Monte Carlo standard errors out. That is a real disagreement and it is the lattice's fault, not the sampler's. The set where HH fails inside this box hugs the pKa = 3 and pKa = 10 faces and the phi = 0.2 and phi = 0.8 faces, and a closed lattice puts full-weight nodes on all six of them. It is the trapezoid end-point error, and it inflates the answer. (b) the same box on a midpoint rule, 70 x 60 x 64 cell centres, no node on any face. estimate 0.02199 over 268800 nodes Monte Carlo 0.02210 +/- 0.00033 difference -0.00011 = -0.32 Monte Carlo standard errors The midpoint quadrature and the sampler agree. The two methods share no code beyond the solver, so this is the check that the Monte Carlo is measuring what we think it measures. ============================================================================== PART 8. SENSITIVITY TO THE DILUTION CHOICE ============================================================================== Everything above titrates with base at the same concentration as the analyte, so the solution is diluted by 1 + phi. A more concentrated titrant dilutes less and flatters HH. The whole map rerun at titrant/analyte ratios of 1, 10 and 100: ratio median max err cells >0.05 (%) pKa lo at 0.1 M pKa hi at 0.1 M 1 0.76482 78.09 3.922 9.840 10 0.63817 75.99 3.886 10.082 100 0.62128 75.27 3.883 10.114 Dilution is a second-order effect on the boundary, worth log10(1+phi) in pKa and no more. The boundary is set by the ratio of [H+] to the acid concentration, and diluting moves both of them together. ============================================================================== PART 8b. TWO MODEL INPUTS THAT WOULD MOVE EVERYTHING ============================================================================== -- Kw is an input, not a result Every number above uses Kw = 1.000e-14 exactly. Kw is measured, it depends on temperature, and the base-side boundary is set by it. The whole boundary recomputed at three values of pKw: pKw pKa lo at 0.1 M pKa hi at 0.1 M band width 13.90 3.922 9.752 5.830 14.00 3.922 9.840 5.918 14.10 3.922 9.944 6.022 The acid-side edge does not move at all and the base-side edge moves one for one with pKw, which is what the closed form says it should do. A titration at body temperature has a different Kw and therefore a different band. -- Activity coefficients, the assumption that costs the most Everything above is an ideal solution. A real titration has an ionic strength that climbs as base goes in, and a glass electrode reads activity, not concentration. Redone with the Davies equation on a monoprotic acid: conditional constants Ka/gamma^2 and Kw/gamma^2, ionic strength I = C_B + [H+] closed self-consistently, pH reported as -log10(gamma [H+]). pKa C (M) I at 0.5 gamma ideal pH Davies pH shift 4.756 1e+00 0.33337 0.73205 4.75605 4.62062 -0.13542 4.756 1e-01 0.03336 0.84422 4.75646 4.68310 -0.07336 4.756 1e-02 0.00335 0.93895 4.76052 4.73376 -0.02676 4.756 1e-03 0.00035 0.97882 4.79756 4.78992 -0.00764 2.865 1e-01 0.03507 0.84147 2.89797 2.83533 -0.06265 7.198 1e-01 0.03333 0.84426 7.19800 7.12448 -0.07352 9.990 1e-01 0.03333 0.84426 9.98747 9.91395 -0.07352 9.250 1e-01 0.03333 0.84426 9.24954 9.17602 -0.07352 at C = 0.1 M the 0.05 pH band, ideal : pKa 3.937 to 9.805 at C = 0.1 M the 0.05 pH band, Davies : pKa empty to empty cells where HH beats 0.05 pH, ideal : 22.33 % cells where HH beats 0.05 pH, Davies : 6.57 % largest ideal-to-Davies gap anywhere : 0.1362 pH median ideal-to-Davies gap : 0.0187 pH Switching the solvent model on is worth more than every approximation error we have measured, at every concentration a student actually uses. The band we drew is the band for an ideal solution, and that is the honest name for it. ============================================================================== PART 9. FIGURE DATA ============================================================================== -- FIG1: exact titration curves, C = 0.1 M, titrant 0.1 M phi: 0.0020 0.0060 0.0100 0.0140 0.0180 0.0220 0.0260 0.0300 0.0340 0.0380 0.0420 0.0460 0.0500 0.0600 0.0700 0.0800 0.0900 0.1000 0.1100 0.1200 0.1300 0.1400 0.1500 0.1600 0.1700 0.1800 0.1900 0.2000 0.2100 0.2200 0.2300 0.2400 0.2500 0.2600 0.2700 0.2800 0.2900 0.3000 0.3100 0.3200 0.3300 0.3400 0.3500 0.3600 0.3700 0.3800 0.3900 0.4000 0.4100 0.4200 0.4300 0.4400 0.4500 0.4600 0.4700 0.4800 0.4900 0.5000 0.5100 0.5200 0.5300 0.5400 0.5500 0.5600 0.5700 0.5800 0.5900 0.6000 0.6100 0.6200 0.6300 0.6400 0.6500 0.6600 0.6700 0.6800 0.6900 0.7000 0.7100 0.7200 0.7300 0.7400 0.7500 0.7600 0.7700 0.7800 0.7900 0.8000 0.8100 0.8200 0.8300 0.8400 0.8500 0.8600 0.8700 0.8800 0.8900 0.9000 0.9100 0.9200 0.9300 0.9400 0.9500 0.9600 0.9700 0.9800 0.9900 0.9950 0.9990 1.0000 1.0010 1.0050 1.0100 1.0200 1.0300 1.0400 1.0500 1.0600 1.0700 1.0800 1.0900 1.1000 1.1100 1.1200 1.1300 1.1400 1.1500 1.1600 1.1700 1.1800 1.1900 1.2000 1.2100 1.2200 1.2300 1.2400 1.2500 1.2600 1.2700 1.2800 1.2900 1.3000 pKa=2.00 exact: 1.5707 1.5755 1.5802 1.5849 1.5896 1.5943 1.5990 1.6037 1.6084 1.6132 1.6179 1.6226 1.6273 1.6390 1.6507 1.6625 1.6742 1.6859 1.6977 1.7094 1.7211 1.7329 1.7446 1.7563 1.7681 1.7798 1.7916 1.8034 1.8152 1.8270 1.8388 1.8507 1.8626 1.8745 1.8864 1.8984 1.9104 1.9224 1.9345 1.9466 1.9587 1.9709 1.9832 1.9955 2.0079 2.0203 2.0328 2.0454 2.0580 2.0708 2.0836 2.0965 2.1095 2.1226 2.1358 2.1491 2.1625 2.1761 2.1898 2.2036 2.2176 2.2317 2.2460 2.2605 2.2752 2.2900 2.3051 2.3204 2.3359 2.3517 2.3678 2.3841 2.4007 2.4176 2.4349 2.4526 2.4706 2.4891 2.5080 2.5274 2.5473 2.5678 2.5889 2.6106 2.6331 2.6564 2.6805 2.7056 2.7318 2.7591 2.7878 2.8179 2.8497 2.8834 2.9193 2.9577 2.9992 3.0442 3.0936 3.1483 3.2099 3.2803 3.3630 3.4634 3.5918 3.7713 4.0758 4.3785 5.0788 7.3891 9.6988 10.3969 10.6968 10.9957 11.1696 11.2924 11.3872 11.4643 11.5291 11.5850 11.6341 11.6778 11.7171 11.7528 11.7856 11.8157 11.8437 11.8697 11.8940 11.9168 11.9383 11.9586 11.9778 11.9961 12.0134 12.0300 12.0458 12.0609 12.0753 12.0892 12.1026 12.1154 pKa=4.75 exact: 2.9113 2.9773 3.0413 3.1023 3.1598 3.2135 3.2635 3.3101 3.3535 3.3939 3.4318 3.4673 3.5006 3.5762 3.6426 3.7018 3.7553 3.8040 3.8489 3.8906 3.9295 3.9661 4.0006 4.0333 4.0645 4.0942 4.1228 4.1502 4.1767 4.2023 4.2270 4.2511 4.2744 4.2972 4.3194 4.3411 4.3623 4.3831 4.4036 4.4236 4.4434 4.4628 4.4820 4.5009 4.5196 4.5381 4.5564 4.5746 4.5926 4.6104 4.6282 4.6458 4.6634 4.6809 4.6983 4.7157 4.7331 4.7505 4.7678 4.7852 4.8026 4.8200 4.8375 4.8551 4.8728 4.8905 4.9084 4.9264 4.9446 4.9629 4.9815 5.0002 5.0191 5.0384 5.0578 5.0776 5.0978 5.1182 5.1391 5.1604 5.1822 5.2045 5.2274 5.2508 5.2750 5.2999 5.3256 5.3523 5.3799 5.4088 5.4388 5.4704 5.5035 5.5386 5.5758 5.6155 5.6582 5.7044 5.7550 5.8109 5.8736 5.9451 6.0289 6.1304 6.2598 6.4403 6.7457 7.0488 7.7449 8.7245 9.7036 10.3971 10.6969 10.9957 11.1696 11.2924 11.3872 11.4643 11.5291 11.5850 11.6341 11.6778 11.7171 11.7528 11.7856 11.8157 11.8437 11.8697 11.8940 11.9168 11.9383 11.9586 11.9778 11.9961 12.0134 12.0300 12.0458 12.0609 12.0753 12.0892 12.1026 12.1154 pKa=10.00 exact: 7.3016 7.7803 8.0039 8.1518 8.2627 8.3516 8.4259 8.4899 8.5460 8.5961 8.6414 8.6827 8.7207 8.8045 8.8761 8.9387 8.9946 9.0452 9.0914 9.1341 9.1738 9.2110 9.2460 9.2791 9.3106 9.3407 9.3695 9.3971 9.4238 9.4495 9.4743 9.4985 9.5219 9.5447 9.5670 9.5888 9.6100 9.6309 9.6513 9.6714 9.6912 9.7106 9.7298 9.7487 9.7674 9.7858 9.8041 9.8222 9.8402 9.8580 9.8757 9.8933 9.9108 9.9282 9.9456 9.9629 9.9802 9.9974 10.0147 10.0319 10.0492 10.0665 10.0839 10.1013 10.1188 10.1363 10.1540 10.1718 10.1897 10.2078 10.2260 10.2445 10.2631 10.2819 10.3010 10.3204 10.3400 10.3600 10.3802 10.4009 10.4219 10.4434 10.4654 10.4878 10.5108 10.5344 10.5586 10.5836 10.6093 10.6358 10.6632 10.6916 10.7210 10.7516 10.7835 10.8167 10.8514 10.8877 10.9256 10.9653 11.0069 11.0503 11.0955 11.1424 11.1907 11.2400 11.2899 11.3149 11.3348 11.3398 11.3447 11.3645 11.3890 11.4371 11.4835 11.5279 11.5702 11.6102 11.6478 11.6833 11.7166 11.7480 11.7775 11.8053 11.8316 11.8563 11.8798 11.9020 11.9231 11.9432 11.9623 11.9805 11.9979 12.0146 12.0305 12.0458 12.0605 12.0746 12.0882 12.1012 12.1138 12.1260 -- FIG2: HH error against phi at C = 0.1 M phi: 0.050 0.070 0.090 0.110 0.130 0.150 0.170 0.190 0.210 0.230 0.250 0.270 0.290 0.310 0.330 0.350 0.370 0.390 0.410 0.430 0.450 0.470 0.490 0.510 0.530 0.550 0.570 0.590 0.610 0.630 0.650 0.670 0.690 0.710 0.730 0.750 0.770 0.790 0.810 0.830 0.850 0.870 0.890 0.910 0.930 0.950 pKa=1.00 : -1.5290 -1.3902 -1.2882 -1.2081 -1.1425 -1.0871 -1.0394 -0.9977 -0.9607 -0.9275 -0.8976 -0.8703 -0.8453 -0.8223 -0.8010 -0.7812 -0.7628 -0.7455 -0.7293 -0.7141 -0.6997 -0.6861 -0.6732 -0.6610 -0.6494 -0.6383 -0.6278 -0.6177 -0.6080 -0.5988 -0.5899 -0.5814 -0.5732 -0.5654 -0.5578 -0.5505 -0.5435 -0.5367 -0.5301 -0.5237 -0.5176 -0.5117 -0.5059 -0.5003 -0.4949 -0.4896 pKa=2.00 : -0.9060 -0.7741 -0.6790 -0.6057 -0.5467 -0.4979 -0.4567 -0.4213 -0.3906 -0.3636 -0.3397 -0.3184 -0.2992 -0.2819 -0.2663 -0.2520 -0.2390 -0.2271 -0.2161 -0.2060 -0.1966 -0.1880 -0.1799 -0.1724 -0.1654 -0.1589 -0.1528 -0.1470 -0.1417 -0.1366 -0.1319 -0.1274 -0.1231 -0.1191 -0.1153 -0.1118 -0.1084 -0.1051 -0.1021 -0.0991 -0.0964 -0.0937 -0.0912 -0.0888 -0.0865 -0.0843 pKa=3.00 : -0.4301 -0.3250 -0.2555 -0.2064 -0.1703 -0.1428 -0.1215 -0.1046 -0.0911 -0.0800 -0.0709 -0.0633 -0.0569 -0.0515 -0.0468 -0.0428 -0.0393 -0.0362 -0.0335 -0.0311 -0.0290 -0.0271 -0.0254 -0.0239 -0.0225 -0.0212 -0.0201 -0.0191 -0.0181 -0.0172 -0.0164 -0.0157 -0.0150 -0.0144 -0.0138 -0.0132 -0.0127 -0.0122 -0.0118 -0.0113 -0.0109 -0.0106 -0.0102 -0.0099 -0.0096 -0.0093 pKa=4.75 : -0.0294 -0.0160 -0.0101 -0.0069 -0.0051 -0.0039 -0.0031 -0.0025 -0.0021 -0.0018 -0.0015 -0.0013 -0.0012 -0.0010 -0.0009 -0.0008 -0.0008 -0.0007 -0.0006 -0.0006 -0.0006 -0.0005 -0.0005 -0.0004 -0.0004 -0.0004 -0.0004 -0.0004 -0.0003 -0.0003 -0.0003 -0.0003 -0.0003 -0.0003 -0.0003 -0.0002 -0.0002 -0.0002 -0.0002 -0.0002 -0.0002 -0.0002 -0.0002 -0.0002 -0.0002 -0.0002 pKa=10.00 : +0.0005 +0.0005 +0.0006 +0.0006 +0.0006 +0.0007 +0.0007 +0.0008 +0.0008 +0.0009 +0.0010 +0.0010 +0.0011 +0.0012 +0.0013 +0.0014 +0.0015 +0.0016 +0.0018 +0.0019 +0.0021 +0.0023 +0.0025 +0.0027 +0.0030 +0.0033 +0.0037 +0.0041 +0.0045 +0.0051 +0.0058 +0.0065 +0.0075 +0.0086 +0.0100 +0.0118 +0.0140 +0.0168 +0.0205 +0.0254 +0.0323 +0.0421 +0.0566 +0.0792 +0.1165 +0.1832 pKa=11.00 : +0.0050 +0.0053 +0.0057 +0.0060 +0.0064 +0.0068 +0.0073 +0.0078 +0.0083 +0.0089 +0.0095 +0.0102 +0.0109 +0.0117 +0.0126 +0.0135 +0.0146 +0.0157 +0.0170 +0.0184 +0.0199 +0.0217 +0.0236 +0.0257 +0.0281 +0.0309 +0.0339 +0.0374 +0.0414 +0.0459 +0.0511 +0.0572 +0.0642 +0.0723 +0.0819 +0.0932 +0.1067 +0.1228 +0.1424 +0.1662 +0.1956 +0.2324 +0.2793 +0.3407 +0.4241 +0.5446 pKa=12.00 : +0.0476 +0.0503 +0.0532 +0.0562 +0.0595 +0.0629 +0.0666 +0.0705 +0.0746 +0.0790 +0.0837 +0.0886 +0.0939 +0.0996 +0.1056 +0.1120 +0.1188 +0.1261 +0.1339 +0.1422 +0.1511 +0.1606 +0.1707 +0.1816 +0.1933 +0.2059 +0.2194 +0.2339 +0.2495 +0.2664 +0.2847 +0.3044 +0.3259 +0.3494 +0.3750 +0.4031 +0.4342 +0.4687 +0.5073 +0.5508 +0.6006 +0.6583 +0.7265 +0.8095 +0.9146 +1.0569 -- FIG3: boundary curves in (log10 C, pKa) log10C lo05 hi05 lo10 hi10 -5.000 nan nan nan nan -4.875 nan nan nan nan -4.750 nan nan nan nan -4.625 nan nan nan nan -4.500 nan nan nan nan -4.375 nan nan nan nan -4.250 nan nan nan nan -4.125 nan nan 6.6714 7.0942 -4.000 nan nan 6.5441 7.2225 -3.875 nan nan 6.4226 7.3405 -3.750 6.6707 7.0941 6.2949 7.4701 -3.625 6.5413 7.2255 6.1730 7.5893 -3.500 6.4216 7.3412 6.0451 7.7194 -3.375 6.2919 7.4735 5.9232 7.8389 -3.250 6.1719 7.5903 5.7952 7.9691 -3.125 6.0421 7.7229 5.6732 8.0888 -3.000 5.9220 7.8400 5.5452 8.2190 -2.875 5.7922 7.9727 5.4232 8.3388 -2.750 5.6720 8.0899 5.2953 8.4690 -2.625 5.5422 8.2226 5.1732 8.5888 -2.500 5.4221 8.3398 5.0453 8.7190 -2.375 5.2922 8.4726 4.9232 8.8388 -2.250 5.1721 8.5898 4.7953 8.9690 -2.125 5.0422 8.7226 4.6732 9.0888 -2.000 4.9221 8.8398 4.5453 9.2190 -1.875 4.7922 8.9726 4.4232 9.3388 -1.750 4.6721 9.0898 4.2953 9.4690 -1.625 4.5422 9.2226 4.1732 9.5888 -1.500 4.4221 9.3398 4.0453 9.7190 -1.375 4.2922 9.4726 3.9232 9.8388 -1.250 4.1721 9.5898 3.7953 9.9690 -1.125 4.0422 9.7226 3.6732 10.0888 -1.000 3.9221 9.8398 3.5453 10.2190 -0.875 3.7922 9.9726 3.4232 10.3388 -0.750 3.6721 10.0898 3.2953 10.4690 -0.625 3.5422 10.2226 3.1732 10.5888 -0.500 3.4221 10.3398 3.0453 10.7190 -0.375 3.2922 10.4726 2.9232 10.8388 -0.250 3.1721 10.5898 2.7953 10.9690 -0.125 3.0422 10.7226 2.6732 11.0888 0.000 2.9221 10.8398 2.5453 11.2190 -- FIG4: initial-pH error surface, signed sqrt-formula error in pH rows pKa 0 to 14 step 0.5, columns log10 C -5 to 0 step 0.5 pKa 0.00 -2.5000 -2.2500 -2.0000 -1.7501 -1.5004 -1.2514 -1.0043 -0.7631 -0.5381 -0.3478 -0.2090 pKa 0.50 -2.2500 -2.0000 -1.7501 -1.5004 -1.2514 -1.0043 -0.7631 -0.5381 -0.3478 -0.2090 -0.1206 pKa 1.00 -2.0000 -1.7501 -1.5004 -1.2514 -1.0043 -0.7631 -0.5381 -0.3478 -0.2090 -0.1206 -0.0684 pKa 1.50 -1.7501 -1.5004 -1.2514 -1.0043 -0.7631 -0.5381 -0.3478 -0.2090 -0.1206 -0.0684 -0.0386 pKa 2.00 -1.5004 -1.2514 -1.0043 -0.7631 -0.5381 -0.3478 -0.2090 -0.1206 -0.0684 -0.0386 -0.0217 pKa 2.50 -1.2513 -1.0043 -0.7631 -0.5381 -0.3478 -0.2090 -0.1206 -0.0684 -0.0386 -0.0217 -0.0122 pKa 3.00 -1.0042 -0.7631 -0.5381 -0.3478 -0.2090 -0.1206 -0.0684 -0.0386 -0.0217 -0.0122 -0.0069 pKa 3.50 -0.7631 -0.5381 -0.3478 -0.2090 -0.1206 -0.0684 -0.0386 -0.0217 -0.0122 -0.0069 -0.0039 pKa 4.00 -0.5380 -0.3478 -0.2090 -0.1206 -0.0684 -0.0386 -0.0217 -0.0122 -0.0069 -0.0039 -0.0022 pKa 4.50 -0.3477 -0.2090 -0.1206 -0.0684 -0.0386 -0.0217 -0.0122 -0.0069 -0.0039 -0.0022 -0.0012 pKa 5.00 -0.2089 -0.1205 -0.0684 -0.0386 -0.0217 -0.0122 -0.0069 -0.0039 -0.0022 -0.0012 -0.0007 pKa 5.50 -0.1204 -0.0684 -0.0386 -0.0217 -0.0122 -0.0069 -0.0039 -0.0022 -0.0012 -0.0007 -0.0004 pKa 6.00 -0.0680 -0.0385 -0.0217 -0.0122 -0.0069 -0.0039 -0.0022 -0.0012 -0.0007 -0.0004 -0.0002 pKa 6.50 -0.0377 -0.0215 -0.0121 -0.0068 -0.0039 -0.0022 -0.0012 -0.0007 -0.0004 -0.0002 -0.0001 pKa 7.00 -0.0192 -0.0115 -0.0066 -0.0038 -0.0021 -0.0012 -0.0007 -0.0004 -0.0002 -0.0001 -0.0001 pKa 7.50 -0.0049 -0.0046 -0.0032 -0.0020 -0.0012 -0.0007 -0.0004 -0.0002 -0.0001 -0.0001 -0.0000 pKa 8.00 +0.0148 +0.0031 +0.0000 -0.0005 -0.0005 -0.0003 -0.0002 -0.0001 -0.0001 -0.0000 -0.0000 pKa 8.50 +0.0571 +0.0188 +0.0056 +0.0015 +0.0003 +0.0000 -0.0001 -0.0000 -0.0000 -0.0000 -0.0000 pKa 9.00 +0.1497 +0.0589 +0.0201 +0.0064 +0.0019 +0.0006 +0.0001 +0.0000 +0.0000 -0.0000 -0.0000 pKa 9.50 +0.3095 +0.1503 +0.0594 +0.0205 +0.0066 +0.0021 +0.0006 +0.0002 +0.0001 +0.0000 +0.0000 pKa 10.00 +0.5207 +0.3096 +0.1504 +0.0596 +0.0206 +0.0067 +0.0021 +0.0007 +0.0002 +0.0001 +0.0000 pKa 10.50 +0.7568 +0.5207 +0.3097 +0.1505 +0.0596 +0.0207 +0.0067 +0.0022 +0.0007 +0.0002 +0.0001 pKa 11.00 +1.0022 +0.7568 +0.5207 +0.3097 +0.1505 +0.0597 +0.0207 +0.0068 +0.0022 +0.0007 +0.0002 pKa 11.50 +1.2507 +1.0022 +0.7568 +0.5207 +0.3097 +0.1505 +0.0597 +0.0207 +0.0068 +0.0022 +0.0007 pKa 12.00 +1.5002 +1.2507 +1.0022 +0.7568 +0.5207 +0.3097 +0.1505 +0.0597 +0.0207 +0.0068 +0.0022 pKa 12.50 +1.7501 +1.5002 +1.2507 +1.0022 +0.7568 +0.5207 +0.3097 +0.1505 +0.0597 +0.0207 +0.0068 pKa 13.00 +2.0000 +1.7501 +1.5002 +1.2507 +1.0022 +0.7568 +0.5207 +0.3097 +0.1505 +0.0597 +0.0207 pKa 13.50 +2.2500 +2.0000 +1.7501 +1.5002 +1.2507 +1.0022 +0.7568 +0.5207 +0.3097 +0.1505 +0.0597 pKa 14.00 +2.5000 +2.2500 +2.0000 +1.7501 +1.5002 +1.2507 +1.0022 +0.7568 +0.5207 +0.3097 +0.1505 -- FIG5: Monte Carlo convergence trace, classroom region k p se 100 0.000000 0.000000 126 0.007937 0.007905 159 0.012579 0.008838 200 0.015000 0.008595 251 0.019920 0.008819 316 0.025316 0.008837 398 0.025126 0.007845 501 0.025948 0.007103 631 0.023772 0.006064 795 0.025157 0.005554 1001 0.023976 0.004835 1260 0.026984 0.004565 1586 0.025851 0.003985 1997 0.024036 0.003427 2514 0.025060 0.003117 3166 0.025268 0.002789 3986 0.024586 0.002453 5018 0.024512 0.002183 6318 0.024533 0.001946 7954 0.024265 0.001725 10014 0.024266 0.001538 12608 0.023794 0.001357 15874 0.022679 0.001182 19986 0.022616 0.001052 25162 0.022017 0.000925 31680 0.021717 0.000819 39885 0.021737 0.000730 50216 0.021706 0.000650 63223 0.021701 0.000579 79599 0.021797 0.000518 100216 0.022142 0.000465 126173 0.022009 0.000413 158854 0.022241 0.000370 200000 0.022100 0.000329 ============================================================================== PART 10. SUMMARY ============================================================================== exact charge-balance solutions computed : 3489396 charge balance worst relative residual : 4.352e-15 (19.6 eps) mass balance worst |sum alpha - 1| : 3.331e-16 (1.5 eps) strong acid / strong base worst error : 2.579e-12 pH over 28 points bisection vs numpy.roots worst difference: 6.395e-14 pH over 18 points bisection vs 60-digit decimal worst diff : 8.882e-16 pH over 12 points pure water pH : 7.000000000000 against 7.000000000000 HH in the classroom box (pKa 3-10, C 0.01-1 M, phi 0.2-0.8): P(error > 0.05 pH) = 0.02210 +/- 0.00033 mean |error| = 0.00457 pH HH over the wide box (pKa 0-14, C 1e-5 to 1 M, phi 0.05-0.95): P(error > 0.05 pH) = 0.61766 +/- 0.00109 at C = 1 M the 0.05 pH band runs pKa 2.92 to 10.84 at C = 0.1 M the 0.05 pH band runs pKa 3.92 to 9.84 at C = 1e-3 M it runs pKa 5.92 to 7.84 at C = 1e-4 M and below the 0.05 pH band is empty: no pKa works acetic acid, pKa 4.756, at 0.1 M: worst buffer-window HH error = 0.0082 pH chloroacetic acid, pKa 2.865, at 0.1 M: worst error = 0.2723 pH phenol, pKa 9.99, at 0.1 M: worst error = 0.0653 pH runtime: 30.3 s