I'm trying to calculate pH values of solutions containing water and acetic acid. The relevant equations have been defined and I now want to find a solution using Mathematica.
For a specific acid concentration (0.0001) I can do the following.
Solve[(concentrations && equilibrium && requirements) /. {c2 -> 0.0001}]
But I would prefer to solve the system of equations once and then insert the acid concentration. But the following code does not work
Solve[(concentrations && equilibrium && requirements)] /. {c2 -> 0.0001}
Which throws the following error
Solve::ratnz: Solve was unable to solve the system with inexact
coefficients. The answer was obtained by solving a corresponding
exact system and numericizing the result. >>"
My working code so far is shown here
concentrations = cHp == c1 + c3 && cOHm == c1 && cCH3COOm == c3 && cCH3COOH == c2 - c3;
equilibrium = 10^-14 == cHp cOHm && 1.1614 10^-5 == cCH3COOm cHp/cCH3COOH;
requirements = cHp > 0 && cOHm > 0 && cCH3COOH > 0 && cCH3COOm > 0;
Plot[-Log[10, cHp] /.
Solve[(concentrations && equilibrium && requirements) /. {c2 ->
x}], {x, 0, 0.00010}, PlotRange -> {2, 9}]


With[{c = 0.1}, -Log10[x] /. First@Solve[10^-4.76 == x^2/(c - x) && x > 0, x]]... – J. M.♦ Aug 24 '12 at 14:14N@NSolve[(concentrations && equilibrium) /. {c2 -> x, cHp -> 2}, WorkingPrecision -> 50]– Daniel Lichtblau Aug 24 '12 at 15:07