Calculation of pH during titration