Ionic Equilibrium: A Mathematical Approach