Titration calculations and diprotic acid curves