A numerical method to calculate equilibrium concentrations for single

Jun 1, 1991 - Using a Spreadsheet Scroll Bar to Solve Equilibrium Concentrations. Andrés Raviolo. Journal of Chemical Education 2012 89 (11), 1411-14...
3 downloads 0 Views 2MB Size
computer ~ e r i e ~12 .6

edited by JAMES P. BlRK Arizomstate university, Tempe, 852.

Bits and Pieces, 46 Guidelines for Authors of Bits and Pieces appeared in July 1986; the number of Bits and Pieces manuscripts is expected to decrease in the future--see the July 1988 and March 1989 issues. H i t s and Pieces authors whodescribe programs will make available listings and/or machine-readable versions of their programs. please read each description carefully to determine compatibility with your own computing environment before requesting materials from any of the authors. Some programs described in this article and marked as such are available from Project SERAPHIM a t $5 per 5%-in. disk, $10 per 3Y2-in. disk; program listings and other written materials are available for $2 each: $2 domestic or $10 foreign postage and handling 1s required for each shipment. Make checks oavatjle to k'roiect SI.:HAPHI'M. T o order, or get a P ~ ~ ~ ~ ~ ~ S E R catalogue, A P H I Mwrite to: John W. Moore, Director, Project SERAPHIM, Department of Chemistry, University of Wisconsin-Madison, 1101 University Avenue, Madison, WI 53706. (Project SERAPHIM is supported by NSF: Directorate for Science and Engineering Education.)

A Numerical Method To Calculate Equilibrium Concentrations for Single-Equation Systems E. Wenin University of Vermont Burlington, VT 05405

Chemical equilibria are usually discussed in terms of the Gibbs free energy and chemical potentials ( I ) or affinities (2). In a previous paper (3)we have given an alternate proof, that the equilibrium concentrations for a chemical reaction

with the characteristic equilibrium constant K are uniquely

determined by the initial concentrations Ao, Bo.. . of the reactants and Uo, Vo... of the products. If one takes into account that the extent of reaction is limited by the fact that no concentration can be negative, one finds that the caution "Chemical Equilibrium and Polynomial Equations: Beware of Roots" urged by Smith and Missen (4) need not he a concern. Here we show how the argument used in our proof alsoleads to a simple, quantitative method tocalculate equilibrium concentrations for a process with given stoichiometry, equilibrium constant, and initial concentrations. As the technique outlined below does not require one to multinlv,out exnlicitlv. anv. . polvnomials, it can, in fact, be applied equally well to chemical equations given in terms of integer It isguaranteed or of noninteeerstoichiometriccoefficients.' to converge, i.e., t o establish arbitrarily narrow brackets to the equilibrium concentrations. With the extent of reaction denoted by x, we define the two functions

.

R(x) = K[A]"[B]~. .. = K(Ao- a .x)"(B,

+ U .zHVo+

P(l) = [UIY[Iq". . . = (UO

- b .r)*...

U

.x)Y..

.

A pure substance in a separate condensed phase does not 488

Journal of Chemical Education

enter R(x) or P(x) explicitly but is only represented as a factor of unity. The chemical requirement that a concentration (or a partial pressure of a gas) must be positive or zero limits the valid range of x to the interval bounded from above by I,, the smallest x for which a concentration, i.e., a term in parentheses in the expression for R(x), is zero. I t is bounded from below by XI,zero in the most common cases where the initial concentration of a t least one product is zero, otherwise by the least negative x that makes a term in P(x) zero2. As we have discussed in (3), the two functions show avery simple behavior in the interval of interest. In the eiven. .. . fullv- factored form, they are easily evaluated for integer and for noninteger exponents. The chemical eauilihrium corresoonds to the uniaue point of intersection pix) = R(x) inside the initial inter&. A number of numerical methods exist to solve such a problem. The chemical constraints guarantee that, for a valid x below the equilibrium, R(x) is greater than P(x) and that the opposite order holds for x above the equilibrium. A bisection algorithm, therefore, is a simple but effective technique to calculate the equilibrium, i.e., to find an arbitrary narrow bracket for it: Evaluating P(x) and R(x) a t the midpoint x = (xh x1)/2 of the current interval, the lower limit X I is replaced by x if R(x) is greater than P(x), otherwise the upper limit xh is replaced by the current x. If P(x) = R(x), a solution is found. If this is not the case, the bisection is repeated in the subinterval containing the solution until the bracket (xh - xl) falls below a given convergence criterion. As an alternative, one may simply carry out a fixed number of bisection steps. After 20 steps, for example, the final interval is just under one millionth of the initial interval, which should be sufficiently small except in cases of very large or very small equilibrium constants3. The equilibrium concentrations are thencalculated with thefinalx from [A],, = (Ao -a. I), etc., for the reactants and [U]., = (Uo u x), etc., for the products. As an illustration: (a) The gas reaction

+

+ .

at 975 "C has K = 2.79. With initialpressures 4 atm for Hp and 1atm for CO, the equilibrium is found a t x = 0.947. The equilibrium pressures in atmospheres are:

' The synthesis of ammonia, forexample, is given in many texts as 1/2N2+ 3/2H, = NH,; K, = 780 at 25 'C. In the special cases where all reactants are pure solids or liquids must oe supplied oy liquids. 9 x ) = 1 and X , must be supplied. For very large or very small equilibrium constants the approximate treatments of standard textbooks may be more appropriate. In the case of HgS with K,, = 1.6 X 10V2,one may also wonder about the significance of the result that the solid is in equilibrium with 1 L solution containing 0.0076 Hg2and SZ- ions. q x ) = K. and an estimate for the upper bodno x. the user. Similarly. if products are pure solids or

(b) Solubility of PbC12 in a 0.05 M NaCl solution: In this case an upper limit x h = 0.1 is given as input. The solubility product is K = 1.5 X The initial concentrations of the two products are [Pb2+]= 0 and [CI-] = 0.05. The calculated equilibrium concentrations are [Pb2+]= 0.00435 and [CI-] = 0.0587.

Two-Dimensional Atomic and Molecular Orbital Displays Using Mathematica Randolph Cooper and Joseph Casanova' California State University, Los Angeles Los Angeles, CA 90032

Figure 1. The p, orbital wmours viewed in the XYplane with the orbital center slightly above the plane.

The powerful new mathematics application Mathema-

tics" evokes a challenge to develop applications to chemically significant problems. One of the common topics discussed in undergraduate instruction that lends itself to calculation with Mathematica is the d i s ~ l a vof s h a ~ e sof atomic and molecular orbital wave functi&1s~.5).We ha\.e prepared a set of instructions within Mathematica (called a "packwe") that permit computation and display of atomic add molecular orbital wave function contour diaprams. The package, entitled Orbitals.m, is intended for use with ~ a t h e m a t i c a on the Macintosh microcomputer. The wave functions of simple atomic orbitals (8, p, d, etc.) are computed and displayed using well-known mathematical equations. An example of this is the mathematical representation of the spherical 2s orbital by the equation: N,,(x2

+ yz + ~ ~ ) ' ~ ~ e x p [+- cy2( x+~z ~ ) ' ' ~ ]

Figure 2. A prpr r molecular orbital viewed in the XYplane

where Nzaand c are positive constants. Hybrid atomic or molecular orbitals are described as a linear combination of atomic orhitals. Each atomic orbital is assigned a coefficient proportional to its contribution to the hybrid atomic or molecular orbital with the usual condition that the orbitals be orthonormal. In this package Slater ( 6 ) equations are used to describe the atomic orbital wave functions. All orbital contours are calculated de nouo from an instruction set. The package permits calculation of four types of atomic orbitals: s, p, hybrids of sp, and d. A contour diagram of the wave function in the X Y , XZ, or YZ planes is plotted. Orbitals may be rotated from the principle axis in the specified plane. Figure 1graphs a p, orbitalviewed in the X Y plane with the orbital center slightly above the plane. The package 0rbitals.m permits the calculation of hybrid atomic and molecular orbitals. T o view the s orbital of the two p, orbitals of ethene, two pyorbitals are added. Each of the twop, orbitals is given a normalizing coefficient ( l l d 2 ) . The nuclei of the two p, orbitals are given coordinates such that the distance between the nuclear centers of the respective p, orbitals corresponds t o a typical double bond length (1.33 A). The graphic display of such a calculation is shown in Figure 2. An example of the input format required to generate Figure 2 is given below: Figure 3. The d,wbital viewed in the XYplane. A prolection has been added for clarity. A detailed description of each element of the code is available but cannot be given here. An alternative way to mix two atomic orhitals uses abuiltAuthor to whom correspondence should be addressed. Mathematica is an application available on the Apple Macintosh (as well as other machines)capable of symbolic as well as numerical mathematical manipulations. Mathematica version 1.1, by Stephen Wolfram, Daniel Grayson. Roman Maeder. Henry Cejtin. Theodore Gray. Stephen Omohundro, Daniel Ballman, and Jerry Keiper. Wolfram Research Inc.. P.O. Box 6059, Champaign. IL 61821.

in command "Mix", which instructs the package to determine the coefficients automatically. The two orbitals to be mixed are specified along with the percent contribution of each, given a number in decimal or fractional form. A little familiarity with the characteristics of Mathematics make i t possible to render three-dimensional representations of the wave function from this same 0rbitals.m package. An example of this, ad,, orbitalviewed in the X Y plane, is given as Figure 3. Volume 66

Number 6

June 1991

487