computer series, 142
edited bv JAMES P. BIRK Arizona State University Tempe, AZ 85287-1604
Bits and Pieces, 48 Guidelines for authors of Bits and Pieces appeared in July 1986; The number of Bits and Pieces manuscripts in supposed to decrease in the future--see the July 1988 and March 1989 issues. B i t s and Pieces authors who descrihe programs willmakeavailable linstings and/or machine readable versions of their programs. Please read each description carefully to determine compatibility with your own computing environment hefare requestingmaterialsfrom any of the authors. Some programs described in this article and marked as such are available fmm Project SERAPHIM at $15 per disk ($20 foreign and Canada). Make cheeks payable to Project SERAPHIM. To order, or to hecome a member of SERAPHIM Clearinghouse and receive a catalog ($20 per year), write to: John Moore, Director, Project SERAPHIM,Department of Chemistry, University of Wisconsin-Madison, 1101 University Avenue, Madison, WI 53706.
Calculation of Vapor Pressure Using Mathematica Joseph H. Noggle and Robert H. Wood The University of Delaware Newark, DE 19716
(1)
This equation will be true for any I: P pair that represents a n equilibrium state. Because you must know the volumes to calculate the integral, and the pressure to calculate the volumes, this must be dope iteratively. Students can learn a great deal about ~ h a s eequilibrium by doing such calculations, but the computational effort using either calculators or traditional programming languages is forbidding. We have used compiled programs, but this approach is weak because the program is just a black box to the student.
A Convenient Math Program for PC's I n recent years, programs have become available for PC's for doing both numeric a n d symbolic mathematics. Mathematical is one such program that is beginning to find a place in chemical research. I t is very easy to use, and can be run on relatively inexpensive hardware (PC with A single 386SX ~rocessor). .. statement can redace dozens of lines of code in a traditional p r o ~ ~ u m m i nlanguage. g This makes it an attractive 1001 for problems such u s this one. 'Wolfram Research, Inc., Champaign, IL61820-7237. 2 ~ hequation e and a table of constants may be found in Noggle, J. H. PhysicalChemistry,2nd ed.; Harper Collins: Glenview, IL, 1989.
810
Journal of Chemical Education
Solving the Problem All that is needed is to define a function pav, TI to calculate t h e pressure from the gas law, for example, the Redlich-Kwong equation of state.' ptlvm, TJ:= RTKvm - b) - a/SqrtPrl/(vm(vm+b))
Vapor pressures can be calculated from the equation of state P(V,T ) by minimizing the Gibbs free energy, giving the following equation.
v~~~,a
Figure 1. Isotherm for nitrogen ( T = 120 K) calculated using the Redlich-Kwong equation.
Then define another function to calculate the volume, which will be the roots of a cubic equation. vf[p, TJ:= vre= Caseslvm /.Solvelpffvm, TI==p,vml, This function returns two volumes that, when different, represent the molar volume of the gas and the liquid. Finally, we define a function to evaluate the left-hand side of eq 1. fmin[p, TJ := ( I V ~ VII, =;~[P,TI; Then the problem bewmes finding values of T and p a t which the function fmin is 0. For a given temperature, the pressure can be determined with FindRoot[fmin[p, TI, IP, pl. ~211 The range p l and p2 for searching is critical. I t can be determined by inspecting the isotherm (easily made with Mathematica). Figure 1 clearly demonstrates that the vapor pressure for nitrogen (at 120 K) lies between 22 and 27 atm. In fact, this range must be less than the range from the maximum to the minimum of the undulation of the isotherm. Otherwise, the function vfwill find only one root. Then fmin will he 0, not because the pressure is the vapor pressure, but because the equation of state a t the pressure and temperature has only one root. The range is particularly important near the critical point where the undulations bewme very shallow.
Calculating boiling temperatures for a given pressure is very similar. FindRoot[fmin[p, TI, IT,TI, T21 Once again, specifying the temperature range is critical. It can be refined by plotting isotherms or simply calculating values of fmin at ;ariou&mperatures. Comparing Equations With this method it is very easy to compare various gas laws (by simply changing pf and the constants). We encourage our students to use various gas laws, and to compare their results to experimental results. Of the two constant equations of state, the Redlich-Kwong (RK) equation is eenerallv the best. It is substantiallv better than van der k'aals (;dw). For examole. the normal boiline ooint of nitroeen (77.33 K) is calculated by RK as 78.5 ~ c i by d vdw as 65.7 K. The normal boiling point of ethane (184.57 K) is calculated by RK as 183.47 K and by vdw as 146.34 K. Better equations such as Peng-Robinson can be used with slightly more work. Miscellaneous Information Such calculations take several minutes each when using a Macintosh IIsi or a 386-387SX116 computer, depending of course on how closely the range is specified.Additional detail is available via Internet:
[email protected].
Mass Spectra and the Macintosh: Isotope Pattern Calculator A Program to Calculate Isotopic Ratios for Molecular Fragments L. J. Arnold
University of Waikato Hamilton, NZ
Figure 2. Main window after calculating an isotope pattern buttons. The format and font menus can be used to change the appearance of the plot, which can then be printed. The Customise function allows the user to enter abundance data for isotopically enriched species and commonly used groups into a library file. Selecting Print Pattern from the fde menu will bring up the print window, where the eight most recently calculated isotope patterns can be manipulated and then printed. If there are any problems with the operation of Isotope Pattern Calculator, on-line help is available by clicking the mouse in the Help button on the main window. Miscellaneous lnformation Isotope Pattern Calculator (v.1.6.1) was written entirely in THINK Pascal, and thus some parts are copyrighted by THINK Technologies Inc. This utility is wmpatible with all models of Apple Macintosh on which it has been tested5 and with system versions 4.2 and later. It is distributed under the sharewake system. A copy of Isotope Pattern Calculator can be dbtained by writing to the author. We request that a disk be sent on which to copy the program.
Isotope Pattern Calculator calculates the expected isotope ratio for any given molecular fragment. The natural abundances for all the element^,^ as well as some common fragments, are incorporated in the package. This program was developed because it is difficult to calculate the isotope pattern for fragments of species like A S ~ F ~ ~ ( C Oby) ~ ~ _ , hand. lsotope Pattern Calculator (v.1.6.1) Isotope Pattern Calculator can be used to calculate the isotopic ratio for any molecular fragment. The pattern can be displayed on the screen, printed, or saved to disk to be read into a graphics package or word processor. Up to eight att terns are maintained in memorv and can be nrinted on one page. To calculate isoto~icratios. the user twes the formula of the fragment into ;he molechar form& box (see Fig. 2). Various formats such as Ge(SnMe& and IFeCp(COlzlzare accepted. Then the mouse is used to click the Calculate button. The percentage isotopic ratio is shown in the main window? To view the ratio graphically, the Display button is selected to provide the display window as shown in Figure 3. The isotopic ratios of the last eight fragments calculated can be cycled through using the previous and next 3~lernentalabundances were taken from CRC Handbook of Chemistry and Physrcs, Mtn ed.;Weast, R. C., Ed: 1983-1 984. 'isotop c percentages are acurale to wthin +0.005%. 5Tne mooels tested nclme the 512 Ennancea, PJS,SE. Classic. and the llfx. "ational Instruments Corp., 6504 Bridge Point Parkway, Austin, TX 78730.
This is~SharcwarrUUtiv
Version 1.6.1 I-[
[
T
I[
T
...
I ...b y k s h m o l d
Figure 3. lsotope pattern as displayed on the screen.
Using Icon-Based Programmlng for Classroom Demonstrations David E. Goodney Willarnette University 900 State St. Salem, OR 97301 Recently our department purchased a package, which consists of an 110 board and LahVIEw programming language, for interfaking laboratory instruments to a Macintosh computer. LabVIEW is one of several commercially available products designed to ease data acquisition and Volume 69 Number 10 October 1992
811