fast ph calculations in aqueous solution chemistry

4
Tatam, Vol. 30, No. 3, pp. 20>208, 1983 Printedin Great Britain.All rightsreserved 0039-9140/83/030205-04Z+O3.00/0 Copyright 0 1983 PergamonPress Ltd ANNOTATION FAST pH CALCULATIONS IN AQUEOUS SOLUTION CHEMISTRY MARIE-N• ~~LLE PONS, JEAN-LOUIS GREFFEand JACQUES BORDET Laboratoire des Sciences du Genie Chimique, CNRS-ENSIC, 1, rue Grandville, F-54042, Nancy, France (Received 17 July 1981. Reoised 8 October 1982. Accepted 18 October 1982) Summary-A technique for computation of the neutralization curves of acid-base solutions, based on an optimization search method, has been developed. The criterion function is the absolute value of the calculated difference between the numbers of positive and negative charges present in the solutions. This technique is generally applicable for solution chemistry, but because of its speed of resolution and its accuracy, it is particularly useful in the control of a real-time process by a computer. In analytical chemistry, reactions in solution can be described by the equilibria and material balances involved. However, difficulties arise during numerical calculations for mixtures of acids and bases. For example, the calculation of the hydrogen-ion activity generally requires a powerful electronic calculator.‘” The usual approach is to write a polynomial equation in terms of hydrogen-ion concentration and then find a positive root. We wished to control the pH in neutralization reactions taking place in a complex process requiring a sophisticated control system.4 Computation of the neutralization curve was a necessary step in our control scheme, but was just one among many tasks to be done by the computer. The usual procedure for calculation of neutralization curves proved to be too time-consuming for real-time process control. We therefore developed a less sophisticated but powerful and fast procedure, suitable for a small process computer (MITRA 115SEMS). Some attempts have been already made in this direction5 but we think that our simple technique could be a very valuable tool. FORMULATION OF THE PROBLEM A general equation for the dissociation of an n-protic acid with apparent dissociation constants K;,, . . . Kk and thermodynamic dissociation con- stants KA, . . . Kh is: K, =[AH::,I[H,O+l= K fAH._,+l A, [AH::,‘? ,] A’fAHn_lfH’ The concentrations of the species in solution are given by C[H30+l”-’ fi Kak [AH;: ,] = k=l [H,O+l” + t [H30+]n-k fi K;, k=l ,=l where C is the total (analytical) concentration of the acid. The mathematical expressions quickly become difficult to deal with when mixtures of many components are considered. The activity coefficients are a function of the ionic strength, and may be predicted by various equations.6 pH computation The calculation of pH for mixtures of acids and bases requires knowledge of the equilibria involved, and the material and charge balances have to be evaluted. The resulting polynomial equation in [H,O+] is of- ten cumbersome to solve and requires great precision during the computation. The calculator we used first had a precision of only 1 in lo’, i.e., 1 + 10m6 = 1. We then started looking for a method that was not based on iteration involving high-precision calculation. This led us to an iterative method using an optimization search technique, the “golden section” method.’ This method is a single-variable elimination method used when there is no information available (at least easily) about the derivatives used in such techniques as the Newton-Raphson method. It involves deter- mining the optimum value of the independent variable by trial and error, with the search confined to progressively smaller intervals of size r, (j = 1, . . . J, and being finite) by elimination of unsuitable portions of the domain of search. The main characteristic of the method is that the intervals are successively decreased in geometric ratio T, given by z = L,- ,/L, = (1 + JJ)/2 This method is similar to the Fibonacci search method used by McMillan et a1.,5 without requiring that the numbers of trials be known in advance. Let F, be the number of negative charges per unit volume of solution and F2 the corresponding number of positive charges. Charge balance gives F, = F2. If this equality is obtained for only one value in the 205

Upload: marie-noelle-pons

Post on 14-Nov-2016

215 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: Fast pH calculations in aqueous solution chemistry

Tatam, Vol. 30, No. 3, pp. 20>208, 1983 Printed in Great Britain. All rights reserved

0039-9140/83/030205-04Z+O3.00/0 Copyright 0 1983 Pergamon Press Ltd

ANNOTATION

FAST pH CALCULATIONS IN AQUEOUS SOLUTION CHEMISTRY

MARIE-N• ~~LLE PONS, JEAN-LOUIS GREFFE and JACQUES BORDET

Laboratoire des Sciences du Genie Chimique, CNRS-ENSIC, 1, rue Grandville, F-54042, Nancy, France

(Received 17 July 1981. Reoised 8 October 1982. Accepted 18 October 1982)

Summary-A technique for computation of the neutralization curves of acid-base solutions, based on an optimization search method, has been developed. The criterion function is the absolute value of the calculated difference between the numbers of positive and negative charges present in the solutions. This technique is generally applicable for solution chemistry, but because of its speed of resolution and its accuracy, it is particularly useful in the control of a real-time process by a computer.

In analytical chemistry, reactions in solution can be described by the equilibria and material balances involved. However, difficulties arise during numerical calculations for mixtures of acids and bases. For example, the calculation of the hydrogen-ion activity generally requires a powerful electronic calculator.‘” The usual approach is to write a polynomial equation in terms of hydrogen-ion concentration and then find a positive root.

We wished to control the pH in neutralization reactions taking place in a complex process requiring a sophisticated control system.4 Computation of the neutralization curve was a necessary step in our control scheme, but was just one among many tasks to be done by the computer. The usual procedure for calculation of neutralization curves proved to be too time-consuming for real-time process control. We therefore developed a less sophisticated but powerful and fast procedure, suitable for a small process computer (MITRA 115SEMS). Some attempts have been already made in this direction5 but we think that our simple technique could be a very valuable tool.

FORMULATION OF THE PROBLEM

A general equation for the dissociation of an n-protic acid with apparent dissociation constants K;,, . . . Kk and thermodynamic dissociation con- stants KA, . . . Kh is:

K, =[AH::,I[H,O+l= K fAH._,+l A, [AH::,‘? ,] A’fAHn_lfH’

The concentrations of the species in solution are given

by C[H30+l”-’ fi Kak

[AH;: ,] = k=l

[H,O+l” + t [H30+]n-k fi K;, k=l ,=l

where C is the total (analytical) concentration of the acid. The mathematical expressions quickly become difficult to deal with when mixtures of many components are considered.

The activity coefficients are a function of the ionic strength, and may be predicted by various equations.6

pH computation

The calculation of pH for mixtures of acids and bases requires knowledge of the equilibria involved, and the material and charge balances have to be evaluted.

The resulting polynomial equation in [H,O+] is of- ten cumbersome to solve and requires great precision during the computation. The calculator we used first had a precision of only 1 in lo’, i.e., 1 + 10m6 = 1. We then started looking for a method that was not based on iteration involving high-precision calculation. This led us to an iterative method using an optimization search technique, the “golden section” method.’

This method is a single-variable elimination method used when there is no information available (at least easily) about the derivatives used in such techniques as the Newton-Raphson method. It involves deter- mining the optimum value of the independent variable by trial and error, with the search confined to progressively smaller intervals of size r, (j = 1, . . . J, and being finite) by elimination of unsuitable portions of the domain of search. The main characteristic of the method is that the intervals are successively decreased in geometric ratio T, given by

z = L,- ,/L, = (1 + JJ)/2

This method is similar to the Fibonacci search method used by McMillan et a1.,5 without requiring that the numbers of trials be known in advance.

Let F, be the number of negative charges per unit volume of solution and F2 the corresponding number of positive charges. Charge balance gives F, = F2. If this equality is obtained for only one value in the

205

Page 2: Fast pH calculations in aqueous solution chemistry

206 ANNOTATION

possible domain of the variable pH’ (= -log [H,O+], F, - F2 will take the value zero only once, so the absolute value 1 F, - F2 1, will have a unique minimum and therefore be a one-variable unimodal function. This is most important, and our discussion deals with this characteristic.

Consider titration of a single triprotic acid, AH,, of total concentration C, with a strong monoprotic base, BOH. The species in solution are H30+, B+ and OH-, AH,, AH’- and A’-. Thus

F, = [OH-] + [AH;] + 2[AH*-] + 3[A’-]

F2 = [H,O+] + [B+].

Now, for a given titration data-point, consider how F, and F, will change as the value of [H,O+] is changed, in order to find where ) F, - F2 ) has its minimum. Since F, = [H,O+] + [B+], we have dF,/d[H,O+] = 1. That is, F2 increases when [H,O+] increases.

F, can be written as

GV FL = [H,o+1

KA, [HjO+]* + 2 KA, K;\$-I30+1 + KA, K$,&3[H30+]’

+ ‘[H30+13 + KA, [H30+]* + Kai KA,[H,O+] + KA, Ka2KA3

= G, + CK;,G,.

Thus

dF, dG, dG2 d = d + CK’l d[H,O+]

and dG, KW -= -___

4H@+l W,O+l*

which is strictly negative. Putting

Y = [H30+]’ + K;, [H30+]*

we have

+K;, Ka2 [H,O+] + K;, Ka2 Ka3

[H30+14 + 4K~,[H,O+]’

dGz + [K;, Ka2 + 9K;2K;3][H30+]2 ---= _ dF-W+l Y*

4K;, Kk2Ka3 W,O+l + &.I K2)*G3 -

Y*

which is strictly negative. Therefore dF,/d[H,O+] is strictly negative and F,

decreases when [H,O+] increases, i.e., when pH’ decreases. Hence F, and F2 change value in opposite directions when pH’ is changed, and the function 1 F, - F2 1 will be equal to zero when pH’ corresponds to the value for electrical balance. Therefore ( F, - F2 ( is unimodal. The pH’ corresponding to the data point is calculated by applying the golden section method, starting with the boundary condi- tions pH’ = 0 and pH’ = 14. The calculation is repeated for each data point required.

Fig. 1. Search for the minimum of IF, - F,J. --- F,; “‘.. F2; - IF,---F,J.

In this derivation, F, represents all the negative charges carried by the anions resulting from the dissociation of bases and/or acids existing in the mixture. For each dissociation sequence, we obtain a term G2. F2 represents all the positive charges carried by the cations resulting from the dissociation of bases and/or acids existing in the mixture. In the example taken the expression for F2 is very simple, but in a more complicated dissociation of the type Z&A”+. . . HA+. . . A, there would be an additional term G3 which increases as pH’ decreases (see Appen- dix), but a unimodal one-variable function IF, - F2 1 is still obtained, and its minimum can be computed by means of the golden section method.

The functions F, and F2 are plotted in Fig. 1, which also illustrates the progressive size reduction of the search interval.

The true pH is calculated from pH’ by taking the activity coefficients into account, according to the procedure shown in Fig. 2.

IMPLEMENTATION

The computer used for the calculations presented in this paper was a MITRA 15 (SEMS) with 64 kbyte of memory with an 800-nsec machine cycle. The process computer MITRA 115 @EMS) has the same memory capacity, but is faster.

The program was written in Fortran. The golden section technique subroutine, which can be found in most program libraries, requires 380 bytes of store. The user has to write his own subroutine to compute the function 1 F, - F, 1 for his particular problem.

The MITRA 15 computer took 0.1 set to calculate one -log [H,O+] value (pH) with an accuracy of 0.01 pH unit. Convergence was obtained within two iter- ations, the convergence criterion (a, the difference between two successive calculated pH values, see Fig. 2) being E = 0.01.

Determination of neutralization curves

The method described was compared with the Newton-Raphson method for the determination of a

Page 3: Fast pH calculations in aqueous solution chemistry

ANNOTATION 201

Start > 6,-l. i=l,...,N

PH o,d'lOO.

1

Kk=6(Kti,di)

I

N number of

ionic species

in solution

the concentrations of the

E precision adjustable by the user

Fig. 2. Flow diagram for pH computation.

neutralization curve for 50 ml of O.lM polyprotic acid (pK, = 0.85, pK, = 1.49, pK, = 5.77, pK, = 8.22) by 0.4M strong base. The calculation time was 5 sec. The golden section method used less core, and gave exactly the same results as the Newton-Raphson method.

Titration curves and distribution diagrams were calculated for citric acid (pK, = 3.07, pK, = 4.15, pK, = 6.40). The curves obtained were similar to those published elsewhere.8

The method was also used to determine the indi- vidual concentrations of hydrochloric, acetic and orthophosphoric acid in a mixture. The experimental curve for titration with O.lM sodium hydroxide was evaluated by means of a multivariable search technique.’

CONCLUSION

A new method for determination of the pH of mixtures of acids and bases has been developed. It uses a “golden section” optimization technique, requires little computer memory and is relatively fast. It has been successfully implemented on a real-time process computer controlling a neutralization pro- cess. It could also be used on a microprocessor, because the golden section method is simple to pro- gram. The technique should be useful in other fields of the chemistry of solutions. Acknowledgements-The authors are grateful to Professor J. Villermaux, Chairman of Laboratoire des Sciences du Genie Chimique, and wish to thank P. Bourret and G. Scacchi for their helpful discussions. The financial support of the Delegation G6nerale P la Recherche Scientifique Technique is gratefully acknowledged.

APPENDIX

For dissociation sequences of the type H,A”+ . . HA+ . . . A, there is an additional term, G,, in I$: n-1 n-2

[HrO+]n KAk+2[H,0+1217 K,+...+n[H,O+]

G, = C k=l k=I

R-&O+]“+ i [H,O+l”-k i K;, k=I ,=I

For example, when n = 3

dG Ka:K;;iKA,+4KA:KA2KA,[H,O+]+{~~,:,K62+9K;\,KA2K~,}[H,O+]2 -= WP+l Y2

+4Kk,K;,[H,O+]‘+ K;,[H30+14

Yr

with Y=[H30+13+ K~,[H30+]2+K;,K;,~I,0+]+ KA,KA2KA3; dG,/dv,O +] is strictly positive; G, is increasing when [H,O+] is increasing, i.e., when pH’ is decreasing.

Page 4: Fast pH calculations in aqueous solution chemistry

208 ANNOTATION

REFERENCES 5. G. D. McMillan, H. A. Grosby and R. C. Waggoner, Instrum. Chem. Pet. Int., 1979, 15, 27.

1. D. D. Perrin and I. G. Sayce, Tuhnta, 1967, 14, 6. G. K. Pagenkopf, Introduction to Natural Water Chem- 833. istry. Dekker, New York. 1978.

2. G. L. Breneman, J. Chem. Educ., 1974, 51, 812. 7. W.H. Ray and J. Szekely; Process Optimization. Wiley, 3. E. R. Rang, Computers and Chemistry, 1976. 1, 91. New York. 1973. 4. M. N. Pans, khdse Docteur Ir&nieur, institut 8. R. Rosset,‘D. Bauer and J. Desbarres, Chimie analy-

National Polytechnique de Lorraine, Nancy, June tique a& solutions et microinformatique. Masson, Paris, 1980. 1979.