Problem solving in chemistry using Eureka

BASIC, FORTRAN, or Pascal. Although writing one's own programgives much flexi- bility, anyone who has spent weeks writing and debugging large programs...
11 downloads 0 Views 3MB Size
edited by RUSSELL H. BAT Kenyon College Gambier. OH 43022

the computer bulletin boord Problem Solving in Chemistry Using Eureka F. 1.Chau a n d Andy S. W. Chlk Department of Applied Biology and Chemical Technolaav Hong Kong Polytechnic Hung Hom, Kowloon. Hong Kong

-.

Microcomputers are used very often in chemistry for numerical calculations, data manipulation, and graphical presentation. However, moat students and teachers have had to write their own programs in generalpurpose programming languages such as BASIC, FORTRAN, or Pascal. Although writing one's own programgives much flexibility, anyone who has spent weeks writing and debugging large programs in these languages knows that this flexibility comes at a price. There is a growing number of software packages available for scientific users that allow one to solve mathematical problems, analyze data, plot graphs, or even to examine mathematical relations or models too complicated for pencil and paper. In this note, we present an example of one such package, Eureka, being used on an IBM PC for problem solving in our undergraduate general chemistry and physical chemistry courses. General Features of Eureka Eureka works on the basis of an editing window in which you enter equations, function definitions, constants, constraints, and units. Once the problem has been entered, one can exit the Editor window and activate the Solve command. Eureka first tries to obtain the solution directly by substituting constants. If the program makes six substitutions and still cannot reach answers for all the unknowns, the steepest-descent iterative process will be utilized to make educated guesses. After satisfying the equation, Eureka presents the results of calculations, the maximum error of the solution, and any warning messages in a Solution window.

These results can also he saved on disk or printed by activating the Report window. Eureka can also be employed to plot functions that have been defined and to present graphs in either the text mode or in the graphics mode. A number of built-in mathematical functions are available in Eureka, involving standard trigonometric and hyperhalie functions, financial calculations, abs, exp, factorial.. In.. loe. ni.. derivatives. lowest value, highest value, tractional part. rmeginary and real parts, definite integrals, normal cu. mulafive distribution, p o l y n m d reprerentation, square root, and sum. Furthermore, directives can also he adopted to assign the accuracy of calculations, specify whether or not to consider complex-number solutions, initialize search values for solutions, look for a maximum or minimum value rather than a solution, change the range of values for searching, and some others. Eureka can be applied to problem solving in chemistry in at least four different areas: least-squares fitting, equation solving, simulation, and function plotting. An example on pH calculations is given here to illustrate the use of the equatian-solving facilities available. The pH value of a weak acid HA can be obtained by solving the four simultaneous equations, 1to 4, as shown in the figure. In these equations, K,, K., and (HA01 denote respectively the self-ionization constant of water, the ionization constant, and the formal concentration of the weak acid. From these three known quantities, and four unknown concentrations [OH-], [HA], [A-1,

;

he p~ o f a

weak acid can be

obtained from

the

and [H+], and hence p H , can he derived from the four equations. However, determination of [Ht] requires the solution of a cubic equation. Approximation methods such as the successive approximation treatment are often used to obtain the hydrogen-ion concentration. Furthrrmor~,the concentrationof OH-isoften nrglerted in thecalrulation. The eauation file ior Eureka. as shown in the fieuie. .. . allows one to obtain all the unknown concentrations and thuravoid diatractmi: one by complicated mathemotienl treatments. However, the introducrwn of constraints into an equation file and the verification of results obtained for various concentrations still require students to have a basic understanding of the problem under study. The eouation file as shown in the fimre " ran he extended to pH ralculatiuns on weak acidr with different valuer ofionirationconstants. In the learning proress, students are encouraged to find pH values by varying magnitudes of K,, for moderate to very weak acids. Furthermore, from the hydrogen ion concentrations derived from the equation file and those from other approximation methods such as the successive aooroximation treatment, students ran have a better understanamg on the validity of the assumptions involved. ~~

~

~

..

(Continued on page A62)

Define units:

following

equations:.

+

;

HA

:

Ka =

;

Kw= [nil

; ;

= H + + AIH+I[A-I/[xal

-111 -12) LH+l[OH-I = 1.00e-14-13] = LA-] + [OH-] -141

"20

Determine

t h e PH

of

Solution: variables

values

a 2 . 1 O M HOAC

so1ution.

EdHor'sNote: The Informationregarding Lotus Measure given in footnote 3 on page A231 of the September 1988 Computer Bulletin Boardwas obsolete at the time of p~bllation.Exclusive rights to Lotus M e 6 sure were acquired by National Instruments in me sorina . " of 1988. Thev anno.nced an snhancw version 2 0 m OC~P Der 1988, whlcn now supports EM PSI2 sysmmr as we 1 as PCIXTIAT In aad,f on.

National lnshuments is providing full customer support for Lotus Measure. The new Verslon of Lotus Measure is available for $495 from National Instruments, 12109 Technology Blvd.. Austin. TX 78727: (512) 250.9119. National Instruments offers a 10% educational discount on this version.

; Given data: K v = 1.00e-14 Ka = 1.76e-05 H A 0 = 2.10 ; Equations:

H=HA'Ka/A OH = Kw

/ H

A=H-OH

Maximum errar

HA0 = HA + A p H = -1oglOlHl pOH = -1o~1010H1

is

2.4074213e-11

; constraints: H >= 0 : OH = . 0 HA )= 0 : A )= 0 : XAO >- 0 K W >= 0 : Ka ,= 0

An equation file forthe defermlnationof pH and Concentrations of ionic species of a weak acid

Volume 66

Number 2

February 1989

A61

bulletinboord --

--

Editor's Note In addition to Eureka, two other generalpurpose equation-solving software packages are of potential interest to chemical educators: MathCAD and T K Solver Plus. For further information about Eureka, contact Borland International, 4585 Scotts Valley Drive, Scotts Valley, CA95066; about MathCAD, contact Mathsoft, Inc., One Kendall Square, Cambridge, MA 02139; and about TK Solver Plus, contact Technical Systems, 1220 Rock Street, Rockford, IL 61101. Several reviews of these equation solvers have appeared recently: 1. Stewart. G . A. BYTE 1988. 1312). 168: BYTE 1987, S t e r e o Helix Stereo view 01 al~hahelix structure

Making Stereo Pair Views with Molecular Editor

"Move" menu, and choose "Rotate". The right hand view will rotate enough so that when the pair is viewed either with a stereo viewer or by defocusing the eyes, it will give the illusion of a sinele.. three-dimensional model in the center of the screen. Of course, it may also be printed out for observation away from the computer. ~~~~

Trevor Roblnson Department of Bimhemistry University 01 Massachusetts Amherst, MA 01003 The program Molecular Editor for Macintosh computers (available from Kinko's Academic Courseware Exchange, 255 West Stanley Ave., Ventura, CA 93001) is an easy to use and inexpensive program for building, rotating, andohserving molecular structures in three dimensions. I t has an additional capability not mentioned in the aecompanying documentation. Any molecule that has been constructed can very easily he converted into a stereo pair view so that its three-dimensional nature becomes even more vivid tnan when "rotated" on a tlat screen. The following step-by-step proeedure for making stereo pairs has been used by one of my classes and seems to he foolproof. The figwe shows a stereo view of the alpha helix of protein structure, which was produced by this method. The model to be converted to a stereo view must be small enoueh to fit on half of the screen. If too big, it can be reduced by usingthe'Scale Model" function. Select the model using marquee or the "Select All" command under "Edit" menu. Move it to fit into the left half of the screen l,y holding down the 'Option" key, then position the cursor arrow on any atom in the model, and mwe it to position. While it is still selected, choose"Copy"under the"Edit"menu,click the mouse button, and then choose "l'aste". This will "paste"acopy of the model directly on top of the original. Now, while it is still selected, hold down "Option" and "Shift". position the cursor arrow on any atom, and move the "top" copy to the right so that the space between corresponding atoms in the two copies is about 6 cm. Select the right hand copy. Choose "Rotation Settings" under the "Move" menu. Set a t '5 around the Y-axis, and "Single Step". Go back to the

A62

Journal

of

Chemical Education

~

~

~

~

..

Generating Individualized Exam Questions Bruce N. Campbell, Jr. SUNY Potsdam Potsdam, New York 13676 Much concern has been focused recently on making easier the use of computers in teaching. Software must match what is already dane in the course, or the instructor must modify the program, modify the organization of the course, or write the software to he used. These tasks may well he sufficiently onerous that the whole activity is avoided. Another approach would be to employ "generic" software, intended to be easily modified by the user. Commonly available examples are software packages that allow the integrated use of database, spreadsheet, and word-processing activities. This note reports a simple use of such software to generate individualized take-home examination questions. I t bas been my practice to include a question in one of my biochemistry examinations h that requlres the student to ~ a p enzyme kinetic data,calrulate from thegraph values for V.... -..and K v (with and without inhibitor), and draw~appropriateconclusions. Even with due warning, the actual graphing in class monopolizes the time of most students. The answer appeared to be to give the graphing question as a take-home part of the exam, using Appleworks to create a different problem for each student. Each problem consisted of two parts: the directions and a table of data. The directions were stored as a word-processor file. The unique table of data was generated from a spreadsheet file.

The spreadsheet fie was established with values for V,, and Knn (with and without inhibitor), run number, concentration of substrate and effector compounds and columns for kinetic values to oermit lot tine the d a t a by the hlich&lis-Genton: Lineweaver-Rurke, or Hams equations. Elsewhere on thespreadsheet an answer key was generated by recording the values of Vm, and KM as each run was performed. The cells for the kinetic values were established as formulas hased on the values for V-, KM,and [S] that had been supplied. The calculation was dane in the manual mode. The file was ~ e v e dand then the run number and the kinetic data, complete with headings, were transferred to an intermediate memory (clipboard) with a copy as a block command. The question text in the word processor could then be called and the data block added to it before printing. The process could he repeated with new values inserted into the ooerator cells for the next run. The storage area (answer key) w a s consulred to be sure there was no duplication of values coupled with type of inhillition. It is also important to know [he range of values that will give useful graph* with the IS] values used. After the last problem has been printed, the answer key can be printed also. This approach could be used for problem requiring analysis of large amounts of data and emphasizes the possibility of using available generic software with facile user modification to fit specific course situations.

Enhancing Physical Chemistry Lectures with Overhead Monitors Davld M. Whlsnant Woffwd College

Spartanburg. SC 29301 The uses of microcomputers to enhance lecture presentations has been described',

hut for many of us this teaching method has been of only limited utility because of the extra effort reauired or the lack of suitable equipment. Moving a computer on a m o h h cart to a classroom may take considerable time, and, even II it can be moved to the room without much trouble, a computer not equipped with a large-screen monitor will produce text that may he illegible to many students in the classroom. For a number of years I have been interested in using a comouter in mv ohvsical chemistrv lectures but. ~. because of the prohlrmr mentioned above, hme done so infrequently. This is unfortunate hecaune physical chemistry lectures lend themselves to the use of computers: after deriving an equation we can present applications, using a computer to do the long calculations and display graphs. In the last year or so this approach has become feasible because of the availahilitv of reasonahlv oriced lantoo comnuters and mnniu~rrthat fit on overhead projectorr. The diuplay projected by such a monitor is readily visible and both the computer and monitol are light enough to he carried to the classroom by the instructor. The set-up time for this system is short, less than 5 minutes if the overhead projector is already in the classroom. During the 1981-1988 academic year I used an overhead monitor, hoth a Kodak Datashow and an Eiki DD-1000, along with a Zenith 2-181 laptop computer to present computer demonstrations in many of my physical chemistry lectures. These demonstrations usually take an equation that has just been derived and use it, sometimes with exoerimental data from the literature. to eeherate eraohs for disolav on the scree". A " number of programming languages are suitable for this purpose; I have chosen to use a spreadsheet package, S~perCalc4~. because a spreadsheet makes it easy for the teacher to generate graphs and to alter the program duringlecture if questions come up from the students. One template used eerly in the course allows the teacher to choose the temperature and one of five gases (He, Ar, N1,Con,and CHd and then to display simultaneously theP-Visotherms for an ideal gas and a real gas, the latter represented by the BeattieBridgeman equation. Another graph stored with the templste plots the percent difference between the ideal and real gases as a function of pressure. This demonstration helm stimulate discussion about the condimod tions for which the ideal eas law is a " apprunimation and gives the atudents some f e e h g fur how well it applies under normal conditions. Another template is a variation of one prepared under the auspices of Project SERAPHIM. After the wave function and energies for the particle in a box have been derived, this template can he used to show the first four wave functions or their energy levels, given the mass of the particle and size of the box. A third templste helps illustrate some uf the thermodynamic propertiesofrut,herlike elasturnerr. The lecture hegins with a demonstration of how rubber hands contract with increasing temperature and then moves to a computer demonstration using this template, which has been programmed with experimental stress-elongation data3 far two temperatures. These data can he displayed in graph form, for instance, as

.. .

~ , ~. ~ .

..

~~

- .

~~~~~~~~~~~p ~~~

. .

~

~~~~~~

~~

-~ ~

~

~

~~~

force vs. the extension ratio (a= LILo)or as force vs. a - l/a2, yielding a nearly straightline eraoh4 in the second case. Leastsquares fits of the second graph for the two temperatures give mterrepta that are nearly zeroand slopes that are in the same ratio a9 the corresponding temperatures, implying that the force at a constant length is directly proportional to the temperature. The increase in force with temperature, observed in the initial demonstration, is apparent from a third graph superimposing force vs. length curves for hoth temperatures. The lecture then moves to a thermodynamic treatment of elastomers5 during which we use results from the templates to help discover that the equations describing ideal elastomers are similar to equations describing ideal gawn. This portion of the lecture ends with e discusrion of how the beha\,ior of hoth ideal gases and elastomers is related to changes in entropy. These three templates illustrate how computer-driven displays using overhead monitors can enhance and even become integral parts of Lectures in physical chemistry. The spreadsheet templates allow the use of experimental data to make lectures more concrete and often generate good class discussions. I have been pleased with how they have been received hy students and hope to expand their use in the future.

~~

~~

~~

Grow. J. M. J. Chem. Educ. 1963, 60, 10621063. SuperCalc4. Computer Associates. 2195 Fortune Drive. San Jwe. CA 95131. Anthony. R. L.; Caston. R. H.; Oum. E. J. Phys. Chem. 1942,46.826-840. 'Mart. J. E. J. Chem. Educ. 1964,58,898-903. Alberty. R. A. PhysIc~lChemistry, 7th ed.: Wiley: New York. 1987; pp 124-129.

~~

~~~~

Volume 66

Number 2

February 1989

A63