, 70

Cheney, WA 99004. Many of the business spreadsheet programs can be used to answer .... A starting value was chosen for X (amount of. N2 reacting) that...
0 downloads 0 Views 2MB Size
edited by JOHN

Bits and Pieces, 28

Press.

Van

moles

der

Waals

gas

1

Tenp

271

W. MOORE

Volvae 2 2 1 8 . 2 2 4 . 8 2 2 . 1 8 2 . 2 4 8 ,4488 , 2 2 4 0 ,1128 , 8 5 6 0 Ideal Press. .@I .I 1. 18. 56.88 188. 2 8 8 . 8 6BB.B

Most authors of Bits and Pieces will make available listings andlor 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. Revised Guidelines for Authors of Bits and Pieces appeared in the December 1982 and December 1983 issues of the JOURNAL. Several nroerams described in this article and marked as such are k a z a b l e from Project SERAPHIM. T o obtain these materials as well as to get a Project SERAPHIM Catalog, write to: John W. Moore, Director, Project SERAPHIM, Department of Chemistrv. Eastern Michigan Universitv.

----- ----- ---..-... . . . . .. . . . .. . . . .. . . . .

Figure 1. Pressure of ideal versus van der Waalr gas at 273 K.

T i t r a t i o n curve weak a c i d

mL base

G. L. Breneman

Eastern Washington University Cheney, WA 99004

Many of the business spreadsheet programs can be used to answer "What if?" chemistry questions because they have the mathematical functions needed for science (such as logs, trig functions, square root) as well as special functions that make these programs so useful in recalculating and displaying results after chanees have been made. Annlications in.. voking student gradeiand the calculation of activities have previously been reported in THIS JOURNAL (1.2). Here are Hevera~others. Ideal versus van der Waals Gas At what pressure does a gas deviate significantly from ideal behavior? A spreadsheet was set up with several gases and their van der Waals constants down the left side and a series of volumes and the corresoondine ideal nressures along thr top (see Fig. I ) . The pressures fruni van der \Vaals euuation filled in thr grid. 'l'hr formulas for Dressure (ideal and van der Waaisl used moles, tcmprruture, and wrlume as \.nrial~lesso r h ~ s wuld e he chaneed and the whderrid recalculated. The series of volumes\ere all related to the leftmost volume so one volume change would change all the others. The a and b values were arranged in increasing order down the grid so trends based on their differences can be easily seen. The answer to our question is immediately obvious. The deviation is slight a t 1atm, more pronounced a t 10 atm, and very significant a t 50 atm and varies some depending on which eas is being considered. Other thines are also aonark ifthe deviation increaseskth the Val& of ent. ~ h amount the constants a and b. Some of the deviations are positive and some are negative until very high pressure is reached, where alldeviations are positive. The negative values are due to the van der Waals kquations attempting to deal with liquefaction of some of the gases. The attempt is not too good, of course, but is better than the ideal gas law which does nothing about it. Note that a t 273 K the van der Waals equation still has CCll as a gas almost obeying the ideal gas law a t 1atm instead of being the liquid it actually is.

Figure 2. Titration of a weak acid with a strong base.

The whole calculation can he redone quickly for a different number of moles simply by changing one location on the grid. You can probably already think of other things you would like to try. For example, it would he very easy to add other gases and their constants to the grid. Equlllbrlum Figure 2 shows a titration curve calculation and t lot. Visica1c;ncludes bar-graphing ability. The graphs arlvery limited hut in some cases may he useful. This titration involves a weak acid titrated with strong hase. The usual weak acid, buffer, and weak hase approximations are used and the concentration of the acid (which is changeable) always equals the concentration of the hase so the end point will always he at 20 mL of hase. The eauilibrium constant of the acid can he changed to show the effect on the curve. When this grid is dis~lavedon the screen VisiCalc allows insertion of a vertical window so the plot can be put next to the base volumes and the DH values will then be unseen. ~ i g u r 3e shows an equilibrium calculation for the reaction 2 HI. The equilibrium constant can be changed HZ + 12 and the starting concentrations can he given any values. The quadratic formula was used toget the final concentrations a t

a

-

Volume 63 Number 4

April 1986

321

equilihrium. There is a prohlem with this approach in that there are two solutions to the eauation. One will be correct and the other nonsense. By triai and error i t was found in this case that usina the neaative sign in the quadratic formula gives the correct result using this equifihrium constant and a variety of starting concentrations. This may not hold under all cases (for example, if K were less than bne) so on the grid are shown the a, b, and c values and the two possible solutions. By changing one location i t is possible to use the other solution. This is easy to do with VisiCalc. K is calculated from the resulting equilibrium concentrations to check that the solution is correct. In this case Kp = KC SO the starting and equilihrium amounts can he interpreted as either concentrations or partial pressures. What ahout the reaction for the production of ammonia and others that do not lead to a quadratic equation? This looked like a real challenge for VisiCalc since there is no explicit formula for rootsof fourth degree polynomials. A common approach to this type of problem is an iterative procedure such as the ~ e w t o n - ~ a p b s omethod. n The approach is based on the derivative of the function anduses the eauation X h e w ) = X(old) - flf' where X(old) is an initial guess or the last value of the'rbot, X(new) is the new improved value, f and P are the values of the nolvnomial and its derivative respecti;ely using X(old). ~nfdrtukatelyVisiCalc has no branching command to stop the iteration at a certain predetermined accuracy. In addition there is the always present problem of determining a first guess. Figure 4 shows the approach that was used. First a relatively large fixed number of iterations was used to ensure convergence. A starting value was chosen for X (amount of Nz reacting) that was reasonable assuming only reactants were nresent initiallv. The intermediate results of 19 iterationskere displayedand then the final X was used to calculate the final equilhrium concentrations. As a check, K was recalculated from these to compare with the original value. The old X, an intermediate value of the polynomial (the formula was too long to fit in one grid location), the polynomial value, its derivative, and the new X were displaved for ,each step. In this example convergence was compl&eh four steps. This was typical when other starting concentrations and K's were used. The time for the calculation to be done after a change in data was about 6 s on an Atari computer. Typically an Apple I1 or IBM PC will he significantly faster. A horizontal window can be set by VisiCalc so that the details of the iteration can he covered un and the startine and final concentrations can he together. The example uses a value of Kc so the concentrations should be interpreted as molarity. If the related Kp is used then the starting and final values are partial pressures. If the calculation is done for different total pressures (start with higher partial pressures for higher total pressure) the effect of the total pressure on the percent ammonia a t equilihrium can he determined. Change K to show the effect of different temperatures. The ahove results could be obtained with pencil, paper, and log tables, with a slide rule, with a calculator, or with a computer using a variety of languages. Does VisiCalc offer any advantages over these other methods? The time involved eliminates all these possibilities except for a computer using some high-level language. I have been programming in a variety of languages on many different computers for over 20 years and my conclusion, after a little experience with VisiCalc, is that for the types of uses described ahove VisiCalc is definitely much better. For example the time to work out the polynomial for the NH3equilihrium is the same no matter how the calculations are done. The comparison ends there. The ability to replicate formulas allows pages of results to flow across the screen using VisiCalc before you could finish typing in a BASIC program let alone debug it. Students have trouble seeing trends by just looking a t equations. The tables of results made possihle by VisiCalc

-

322

Journal of Chemical Education

Reaction: H2 + I2

K

=

atarc

--,2HI

50.5

at 448"

HI 2

12 1

HI 1

...........................X=+SQRT ....... .. X=-SORT a, b, c

46.5

-155.5

100 2.475250 ,8688057

X

,8688857

at e q u i l . 1.131194

,1311943 2.737611

--..-------.....---......----.....--

-

Figure 3. Equilibrium calcdation solving a quadratic equation far the reaction H,

+ I,

2HI.

Reaction:

+ N2 - - >

3HZ

K =

function a,b,c.d.e 1st d e r i " a.b.c,d

,105

2NB3

at 4 7 2 C

( x = N2 reacting)

2.835

-11.34

13.01

-11.34

11.34

-34.02

26.02

-11.34

2.835

Old r .I

.3007358 ,3510374 .3527188

,3527203 .3527203 .3527203 .3527203 .3527203 .3527203 ,3527203 ,3527203 ,3527203 ,3527203 ,3527203 ,3527203 ,3527203 .3527203 .3527203 -3527203

-...-----.....----.....-----..-.---at e q u i l . 1.911839 ,6472797 ,7054406

K =

.la50000

-

Figure 4. Equilibrium calcuktion solving a fwrlhdegee equatii fw reaction 3H2+ N* 2NH3.

the

make these trends much more obvious and in the long run will help students learn to see trends from the equations. The more actual results they see the quicker they will make that transition. Using VisiCalc to prepare visual aids and copies to he handed out to students should be extremely useful. Live demonstrations in class with enough monitors for all to see the results could be especially useful since then i t will he possible to answer the students' own "What if?" questions immediately after they ask them. If the program and your grid setup can he made available to the students they can experiment on their own.

VisiCalcTMin the General Chemistry Laboratory' Sam1 I. lbrahlm Evergreen Valley College San Jose. CA 95135 A useful appliration hat illustrates the power and rapahilityol'the electronic worksheet isdescril~edbelow. It usesa special VisiCalc file known as the Data Interchange Format

'

Presented at the 30th Northern CaliforniaComputer Conswtiwn Conference,Evergreen Valley College, San Jose, CA, April 1984.