Calculating equilibrium concentrations by the ... - ACS Publications

Daryl P. Cobranchi, and Edward M. Eyring. J. Chem. Educ. , 1991, 68 (1), p 40. DOI: 10.1021/ed068p40. Publication Date: January 1991. Cite this:J. Che...
0 downloads 0 Views 1MB Size
Calculating Equilibrium Concentrations by the Continuation Method Daryl P. Cobranchi and Edward M. Eyring' University of Utah, Salt Lake City. UT 84112 The calculation of eouilibrium concentrations in c o u ~ l e d -~~~ chemical reactions is important in both research and chemical education. While there are manv numerical methods for solving nonlinear polynomial systems2 that arise in such calculations, no one technique has distinguished itself in terms of assured convergence, speed, and ease of programming and use. Methods based on Newton's method require good initial estimates in order to insure convergen~e.~ Optimization methods based on the minimization of Gihb's free energy always converge but only very slowly. A new method proposed by Myers and Myers3 always converges rapidly hut only at the expense of a complicated computer program dedicated solely to solving chemical equilibria. Another possible problem with some current methods is the failure to generate all of the possible r0ot.3.~We wish to point out a technique that does not require initial estimates, is faster than Gibh's minimization methods, is designed to generate all possible roots, and is possibly easier to teach to senior undergraduate or beginning graduate students than is the method of Myers and Myem3 Morgan's 1987 monograph5 clearly presents the continuation method of solving systems of polynomials. To solve the equation, f(x), a new function tf(x) (1 - t)g(x) is proposed where g(x) is a complex function whose solutions are known, and t is a number such that 0 5 t < 1. The value of t is increased from zero (typically in steps of 0.01), and the new function is solved by Newton's method employing the solution from the previous iteration as the starting point. This process is repeated until t equals 1, thus generating one root for f(x). Each root of the initial g(x) will then lead to a solution of f(x). Using the FORTRAN IV code included by Morgan5 we have recently presented a challenging equilibrium system in a first-year graduate course in analytical chemistry. The svstem involves the complexation of TI+ by NO%-inaqueous sb~ution.The five equilibria are6 K i - 103.15 M-I (1) Ht(aq) + NO,-(aq) e HNO,(aq) ~~~

~

~

~

+

' Author to whom correspondence should be addressed.

van Zeggeren. F.: Storey, S. H. The Computation of Chemical Equilibria; Cambridge University: New York, 1970. Myers, A. C.; Myers, A. L. J. Chem. Phys. 1986, 64, 5787-5795. See Smith, W. R.: Missen, R. W. J. Chem. Educ. 1989, 66,489490.

Morgan, A. 0. Solving Polynomial Systems Using Continuation for EngineeringandScientificPr0biems;Prentice-Hall:Englewood Cliffs. NJ, 1987. See Sillen. L. G.; Martell, A. E. Stability Constanh; Supplement No. 1, Special Publication No. 25: The Chemical Society: London, 1971 and later volumes in this series. 40

Journal of Chemical Education

The conservation equations are

+ [Hi] + [TIt] - [OH-] - [NO,-] = M [HNOJ + [NO,-] + 2[N,O,] + [NOt] + [TlNO,] = lo@ M [NOt]

(6) (7)

M in total thallium and in total for a solution that is nitrite species. Employing Morgan's notation, these eight equations can rapidly be reduced to two simultaneous quintic expressions:

A,,x?x; + A,~X;X, + A~~x:x~ +A , ~ X , X ~ ~ + A , , x , ~ + A ~ ~ x , x ~ + A ~ ~(9)x ~ + A ~ where X I = [HCIw,XP = [NO%-leq,All = KlKzK4, A n = KIKz,A13 = K4, A14 = -K4, A15 = 1.0, A16 = - ( W 3 Kq I), A17 = -K5K4, and Als = -K5; and

+

; A , , x , ~ x ~+~A ~ ~ X , ~+XA + A,,X;

~ ~+ A x ~ ~ x ~ x ~ ~

+ A,,X,X, + A2,X2+ A,, = 0 (10) where AZI= ~ K ~ K IA22 ~ K= ~ 2K3Kl2 , + KIKzK~.A23 = K&z,

A24 = K& Az5 = K4, A26 = K,, AZ7= 1.0, and Azs = -1.0 X These two quintic expressions will have 25 roots, all of which can he generated by Morgan's CONSOLBT program. In the present example there is only one positive real root: [Ht] = 5.60 X lo-' M [NO,-] = 5.56 x l0W M

The remaining (i.e., derived) concentrations are [HNOz] = 4.398 X [NOt] = 1.956 X [N203]= 3.066 X [TI+] = 9.996 X [T1N02]= 3.935 X [OH-] = 1.786 X

lo-' M 10-I5 M 10V M lo-' M 10-6M lo-" M

I t should be noted that this tvoe .. of calculation is not merelv an academic exercise hut orcurs frequently in kinetics research in which knowledae of the eauilihrium concentration facilitates extraction of kinetic of all species present information from relaxation data. While Morgan's program will compile and link successfully on a PC running Microsoft FORTRAN, we have found that a few minor changes in the code will allow a student unfamiliar with the program to run i t independently. These changes are mainly inputloutput statements. In the main program, CONSOLST, we have added the following statements immediately beyond the DIMENSION statement:

9

CHARACTER'15 OUTFIL WRITE (6,s) FORMAT (lX,' ENTER THE OUTPUT FILENAME>',$) READ (5,12) OUTFIL

12 FORMAT (A15) OPEN (UNIT = 8, FILE = OUTFIL, STATUS = 'NEW')

WRITE(6,32) L, K, J, 32 FORMAT (lX,'DEGOFX';12,'INTERM', IZ,'OFEQ.', 12,'

In the subroutine INPTAT we have commented out READ statements for I F L G P T , IFLGSC, IFLGCR, IFLGST. MAXIT. EPSBIG. and SSZBEG and fixed these parameters at

Finally, the run time for the ahove system on an IBM PC/AT with an 80287 coprocessor is approximately 1 min per root, or -25 min total time.

IFLGPT = 1 IFLGSC = 1 IFLGCR = 0 IFLGST = 0 MAXIT = 3 EPSBIG = 1.OD-2 SSZBEG = 1.OD-2

We have also included code prompting the user to input values for the other parameters. For example, immediately after the line DO60L=l,N

we have inserted

Conclusions The continuation method for solving complex polynomial equilibrium expressions is a straightforward way of presenting solution equilibrium concepts to advanced students. The use of the continuation method allows the educator both to present more challenging equilibria to the students and to introduce them to another use for a personal computer. Acknowledgment The authors gratefully acknowledge a telephone conversation with Alexander Morgan (General Motors), calculations made by Noah P. Adams, and funding from the National Science Foundation, Grant No. CHE-8822333.

Volume 68 Number 1 January 1991

41