This Demonstration is based on [1] by Limpanuparb et al.
Snapshot 1: calculation for an acid solution diluted to a very low concentration, using a quartic equation
Snapshot 2: calculation for a buffer solution using a cubic equation, with input parameters that the Henderson–Hasselbalch equation neglects
Snapshot 3: calculation for a solution of pure water (no acid or base) at a high temperature, showing the effect of self-ionization of water
The quartic equation used for calculation [2, 3] is

.
The cubic equation used for calculation [4] is

.
Definitions of input variables:

is the acid dissociation constant;

(assume 0 for strong acid).

is the molar concentration of acid.

is the volume of acid in mL.

is the molar concentration of conjugate base.

is the base dissociation constant;

, (assume 0 for strong base).

is the molar concentration of base.

is the volume of base in mL.

is the molar concentration of conjugate acid.
Definitions of output variables:

is the molar concentration of hydronium ion.

is the molar concentration of hydroxide ion.
pH and pOH are the negative of the common logarithm of

and

, respectively.
Fraction of dissociation

is the ratio of equilibrium concentration of dissociated acid/base to initial concentration of the acid/base.
[1] T. Limpanuparb et al., unpublished work, submitted to
Journal of Chemical Education.
[2] P. Glaister, "A Unified Titration Formula,"
Journal of Chemical Education,
76(1), 1999 132.
doi:10.1021/ed076p132.
[3] R. de Levie, "Explicit Expressions of the General Form of the Titration Curve in Terms of Concentration: Writing a Single Closed-Form Expression for the Titration Curve for a Variety of Titrations without Using Approximations or Segmentation,"
Journal of Chemical Education,
70(3), 1993 209.
doi:10.1021/ed070p209.
[4] H. L. Pardue, I. N. Odeh and T. M. Tesfai, "Unified Approximations: A New Approach for Monoprotic Weak Acid-Base Equilibria,"
Journal of Chemical Education,
81(9), 2004 1367.
doi:10.1021/ed081p1367.