Calculation of pH at different points