Let a Computer Balance Your Chemical Equations and Determine the

Let a Computer Balance. Your Chemical Equations and Determine the Number of Independent Reactions. E. Weltin. University of Vermont. Burlington, Vermo...
0 downloads 0 Views 3MB Size
-

. . .. .

JAMES P. B I R ~ Arizona State Universiv Tempe, AZ 85287-1604

computer series, 160 Let a Computer Balance Your Chemical Equations and Determine the Number of Independent Reactions E. Weltin University of Vermont Burlington, Vermont 05405 The balancing of some chemical equations is such a simple task that it barely warrants any second thoughts. Other cases, notably some redox reactions are of such complexity, that special methods using half-reactions and oxidation numbers have been developed. They, as well as the balancing of equations by inspection described in textbooks, require a fair knowledge of chemistry to be used effectively. A system consisting of the chemical species C, O,, CO and COz illustrates another aspect of the problem. The equations : 2C + 0, = 2co

(1)

c+o,=co2

(2)

The Matrix Method The only information required is a list of n chemical species given by their chemical formula.' They need not be classified as reactants or products, and groups such as a n ethyl group or a nitrate ion may be treated as a single constituent, provided the group is carried through the reaction as a unit. From the formulas the program builds automatically a formula matrix F consisting of one row for each species and one column per constituent, which is defined as either a chemical element, a group, or the net charge q (positive or negative) ofthe species. For the carbon-oxygen example mentioned above the formula matrix is:

As all species are neutral a charge column contains all 0's and does not need to be included. This example has n = 4 species and m= 2 constituents. The formula matrix is augmented by a n x n unit matrix:

C + co, = 2co 3C + 20, = 2co + co, are only some out of a number of perfectly good balanced equations that can be written for these species. A species may be a reactant as well as a product and it is far from obvious that there are only two independent reactions in this system, that is, any other equation may be written as a combination of the two basic reactions. Which reactions are considered basic is entirely a matter of choice. The number of independent reactions, however, is a characteristic property of the chemical system and plays an important role, for example, in the Gibbs phase rule (I) f=n-r-p+2 which relatesf, the number of degrees of freedom, top, the number of phases, n, the number of chemical species, and r , the number of independent chemical reactions (2). None of the typical methods discussed in general chemistry texts, that is, the inspection and oxidation number methods, can determine reliably the number of independent reactions. I t is the strength of matrix methods that they establish this number unambiguously, including the cases of no reaction, a single reaction, or multiple reactions. One particular matrix method has been described by Blakley (3) and used by Smith and Missen (4, 5) and by Alberty (6-8).We present here a different matrix-based approach that is particularly well-suited for application on a computer, because it automatically takes care of any potential problems connected with linear dependencies and is guaranteed to produce a correct solution. For the mathematically inclined reader, the underlying mathematical rational is presented in the Appendix, the actual computational steps are discussed in the text.

Computations

The computational steps operate on columns of this matrix: 1. Normalization Step: calculate if s > 0 then2replace F, by s-m . FUfor i = 1,2, ...,n 2. Projection Step: for a column k and a normalized (bystep 1)columnj calculate t = C,F,.F,

and replace . F by F,

(7)

- t .Flifori = 1,2, ._.,n

The algorithm can be stated as follows: Initialize m' = rn. Normalize the first column. Starting with k = 2 repeat the following steps until n nonzero columns are generated: (i) project fmm mlumn k the columnsj = 1, ..., k-1 (steps2) 'On a mmputer standard notat on s Lsed except mat sto ch ometrc factors and charge are wrlnen on1 ne, not as s ~ band - sJperscripts GroJps are oes~gnateoemer oy a s ngle caplta letter or oy a capital followed by one lowercase letter 2Actuaily sis testeo aga nst a sma I n~mericalto erance. 11s 1s less than me tolerance tnen sand !he whole co m n s set equal to zero. Volume 71

Number 4 Aoril 1994

295

(ii)normalize resultant column k (step 1) (iii) if s is greater than zero (or a given tolerance) reoeat with the next k: otherwise. deiete the current zero column and, if k is less or equal to m' reduce m' by one, repeat with the same k.

-

The aleorithm is terminated after n nonzero columns are generated. The number r = (n - m') is the number of indeen dent chemical reactions amone - the piven - chemical seeLies. If r = 0 no reactionis possible. If r z 0 then the frs&' columns of F are no loneer of oarticular interest. hut the last r columns represen