Calculating the pKa of a weak acid