Error analysis for multicomponent systems - Journal of Chemical

Bits and pieces, 38. An interactive computer program intended for advanced undergraduate and graduate courses in chemometrics...
0 downloads 0 Views 2MB Size
VOL ( L I W O L I I

L mol-1. An alternative approach to the study of phase transitions using the van der Waals equation has recently been presented by Mau and McIver (11). If desired, the Van der Waals plot can he compared withPVisotherms for a real gas, as outlined in a paper by Pauley and Davis (12). VDWVAP starts by allowing a student to select one of nine oossihle substances. Additional com~oundsmav readily he'added toexpand the available choices. After a temperature is entered, the program decides if this value is too low (point a would lie outside the volume range) or too high (no minimum in the P V curve is found). The minimum and the maximum in the curve are found and then the program tackles the task of finding PO. This is done by selecting a trial value of PO just slightly larger than the value of P a t point d and then computing areas S1 and S2. Area S1 is found, for example, by simply summing all the differences between this trial P and P between the points e and c. The trial PO is incremented to a larger value and new Sl's and S2's are found. As soon as S1 becomes larger than S2, this round of calculations is halted and then repeated near the eauilibrium pressure usingfiner increments in changes in the trialPO. In this way PO can be found to the nearest 0.01 atm in a reasonably short time. In effect the program solves the van der Waals eauation when it is arraneed - in its cubic form in terms of volime, i.e., PV3- ( R T + bP)V2+ a V - ab = 0

Flgure 3. Van der Wads Isotherms for CO. at several temperatures.

sion takes the van der Waals curve uo to b: however, in reality one would find that additional gascondenses and the svstem remains a t a nressure of 31.79 atm. the eauilihrium ;slue. The segment ;be thus represents an unstable region where the pressure of the vapor is greater than the condensation pressure of the liquid state. Decreasine the molar volume further takes the van der Waals press;re to values less than 31.79 atm, even though the actual pressure remains a t 31.79 atm. The segment cde thus represents another unstable region, one where the liquid should spontaneously form vapor bubbles. Finally at d the last gasebus COZdisappears and further decrease in the molar volume results in a sharp increase in the P V curve, indicatine the low comoressihilitv of the liauid (10). The line ae represents the equiiibrium vapor pressure, PO, of liquid COz at the specified temperature. Its location is found by considering that in going from point a to point e, whether by following the van der Waals path abcde or the real constant pressure path ace, the vapor has work done on it hv the surroundinas. The amount of work, w, performed on each path must he trhe same, i.e.,

where V,, and V, are the molar volumes at a and e, respectively. The net result of this is that the area abc must exactly equal the area cde. The trick is find P with the minimum amount of labor. The program VDWVAP was written to perform this calculation and also to generate sufficient points such that a student might sketch the van der WaalsPVisotherm. Doing this at several temperatures enables students to prepare nhase diaerams of the tvoe -. shown in Fieure 3 and also for 'CO~.SUC; a diagram can be used to finz the critical point, recoenizine that the van der Wads eauation is not terribly arr&ate near the critical temperature. This is done by connectine the discontinuities in the isotherms, as shown hy the dasheicurve in Figure 3. In this fashion a critical pressure of 73.2 atm and a critical volume of 0.120 L mol-I are found. The literature values (9) are PC= 72.8 atm and V, = 0.09423 794

Journal of Chemical Education

Finally, five additional points are produced to enable a student to sketch an isotherm as shown in Figure 2. It should he noted that this program does not produce isothermsat cemperatures above the critical point nor will it run too far below T.. If desired. students ran readilv calrulate the necessary data for temperatures above T,using either programmable calculators or a simple computer program. Lower temperatures may he accomodated by increasine the volume ranee used in the oroeram. ~ D W V A Pwas written in BAS~C& aDigital MicroVax I1 computer but also runs. albeit more slowlv and with sliehtlv less accuracy, on an IBM-PC. A listing of the program, along with documentation and sample output, is available from the author. The IBM-PC version is available from Project SERAPHIM.

-Error Analysis for Multicomponent Systems J. H. KaIIvaS ldaho State University Pocatello, l W 3 2 0 9

C. W. Blount Department of Geology ldaho State University Pocatello, ID 83209

-

Even thouel manv instrumental and quantitative textbooks contain a description of multicomponent spectrophotometric analysis, an error analysis of the method is not included. In addition, the algorithms represented do not allow for observations of the effect of spectral overlap, intensity ratios, or the number of wavelengths used for the chemical analvsis. For ideal multicomponent analysis i t is important to have good figures of merit such as selectivity, sensitivity, precision, and accuracy. It is necessary that the stud&understand and observe how a soectrum ideeree of spectral overlap, etc.) can influence these figures i f merit. Most snectrosco~ictechniaues follow Beer's law, which can he modeled as ' ~~

~~~

~~~

~

R=CK

where R is an rn X p matrix of responses for p wavelengths and rn standard samples, C is an m X n matrix of concentrations for n components and m samples, and K is the n X p calibration matrix. Error analysis of Beer's law has been well defined (13-17)through numerical analysis procedures. It is represented by

[

IIAdI/lldl < o n W 0 i l A r l l ~ l l r l+ l l l ~ l l l l l ~ l l ](13) where 11 AcllIllcII is the total relative error for the estimated concentrations of all components, IIArll/llrll and IIMIIIIIKII are the total relative errors for the sample responses and calibration, respectively, and cond(K) is the condition number for the K matrix. 11.11 signify the norm of a vector or matrix. The condition number is usually estimated as the ratio of the largest eigenvalue to the smallest eigenvalue of the K matrix. Cond(K) reoresents error maenification of the relative errors inhere2 with the analysis-sample as shown through ea 13. Since the maenitude of cond(K) is directlv influenced b; the shape of thesample spectrum (selectivity and sensitivity), the accuracv and orecision are also influenced. Thus. cond(kl can be used as ameasure of the combined effect of analyte spectra on analyte concentration estimates. That is, the smaller cond(K) is the greater the selectivity and sensitivity present and the more accurate and precise the concentration estimates will be. The interactive program described is intended for advanced undereraduate and " eraduate courses in chemometries. Our chemometrics class uses i t as a laboratory exercise. The program allows students t o simulate UV-vis spectrophotometry and will permit a student to design particular sets of standard soedra to observe trends in cond(lO. Factors to be explored during lab consist of the number of components, degree of resolution, and intensity ratios. The method used to simulate the multicomponent system consists of generating Gaussian curves of the form

The program described is written in FORTRAN IV for use on a H P 1000 computer system. The plotting program is a FORTRAN 77 subroutine to the main FORTRAN IV program and makes use of the H P Advanced Graphics Package (AGP) subroutines. A H P 2623 terminal and a H P 7475A plotter are required. Alternative H P terminals and H P plotters can he used provided the user has the appropriate work station progranls available. However, the lah can be operated on anv terminal if d o t s are not needed. In addition. the plotting program can be used separately in conjunction with another FORTRAN nroeram. The comolete oroeram requires 140 K bytes df memory when used o n a HP 1000 system. The authors will supply a source listing of the FORTRAN IV main program and the FORTRAN 77 plotting subroutine as well as the laboratory handout given to each student. The handout consists of an overview of the error analysis theory and derivations along with step-by-step instructions on operating the program. Acknowledgment The authors are thankful to the Idaho State University Computer Service Center and to Brian Hughes for their assistance in computer operations and software development. We also wish to thankChristopher Wininger, formerly with Idaho State University Computer Services, for his assistance.

-

I ( x ) = A exp[-(x

- C)2/2B2]

(14)

where A is the maximum amplitude, B is the band halfwidth, C is the abscissa value (wavelength in our case) corresponding to the function maximum, and I is the absorption at wavelengthx. During the program x is set tovary from 1to 100 while the student decides on values for A, B, and C for each component chosen. Overlapping bands are constructed by summing the respective number of Gaussian curves (one curve Der comnonent). he p r o g r k is broken down into two parts. One part allows for observations of trends in cond(K) with changes in spectra while the second part lets the students simulate a chemical analvsis t o test theorv (ea 13) with actual results. The program starts by offering these choices to the user. In either case, prompts requests the number of components, peak amplitude, band half-width, and the wavelength of the peak amplitude. If the user is only examining trends in cond(K), noiseless signals are generated by eq 14 and a cond(K) is computed and printed to the screen. The user then has the ontion to see d o t s of the snectra. chanee the number of con;ponents, c h k g e A, change B, i h a n g e c , or simulate a chemical analvsis of this svstem or another. Plots can be made as overlays or individually. For the analvsis -Dart.. the user decides on the concentration levels for the sample and standards. Random noise is added to the spectra by a Monte Carlo method (18).A normal distribution with a mean zero and a standard deviation equal to a 3% relative standard deviation of the noise-free signal is used. Ten perturbations are performed allowing standard deviations of concentration estimates to be made. After a chemical analysis the student can see the plots, run another analysis with the same parameters or new ones, or observe more trends in cond(K).

Simulation Valparaiso University Valparaiso, IN 46383

I have written and made available to Project SERAPHIM a computer program that can be used to simulate experiments in free radical oolvmerization. In this.. the erowth of .. variouslengthchains Lssikulatedand the resultingdistribulions oresented as eraohs. first of thenumber fraction distribution, second of the-weight fraction distribution. One experiment simulates termination by disproportionation; a second, termination by coupling. The hardware required to use this program includes an IBM PC or X T personal computer with a t least 320 KB of RAM, the Intel 8087 mathematics coprocessor, and a graph ics monitor. One version of the program can be run on either a color monitor or a monochrome monitor with a graphics card: the other. which uses color.. reauires eraohics . a color " . card and monitor. In addition, to print a graphics screen dumo. a dot matrix minter such as Eoson FX 80 or comnatible is needed. A computer totally compatible with the ~ B M machines cited can be used provided the screen access and sound I10 control are identical to the IBM's. The operator enters a monomer concentration, monomer molecular weight, and initiator concentration. The computer uses polymer growth kinetics principles to calculate a free radical concentration based on the initiator and a ratio of rate of propagation to rate of termination based on the free radical concentration and the monomer concentration. A random-number generator is used to determine whether a unit counter. U. is incremented or the looo is ended. which constitutes &r&ation. If the random number is greater 11, the counter is incremented by one; than l/(RATIO otherwise, the loop ends. In the case of the disproportionation simulation, the variable U serves to determine a variable, DP[U], that is incremented by one a t the end of the loop, thus counting one more chain of length U. After the "growth" of 5000 chains, the distribution is divided into 200 portions based on chain lengths and the number fraction of each portion plotted on

+

Volume 65 Number 9 September 1988

795