LINGEN-A general linear least squares program

trometer (a spectral handout from the instructor would suffice if no instrument were availahle). The mass swctrum is then studied with the objective o...
2 downloads 0 Views 1MB Size
trometer (a spectral handout from the instructor would suffice if no instrument were availahle). The mass swctrum is then studied with the objective of obtaining the I& values of the molecular ion peak and the five peaks of greatest relative intensity although a search could be done with less than the six items. The student then fills a retrieve form with his spectral data. Since we have purposely placed in our data base several sets of compounds with the same molecular weight (an advantageousbption of this technique), a search u&ng only the MW item in the retrieve form (if it is correct) will result in many matches. Inserting questionable data (is this M+ or M+ 2 peak, for example) in a retrieve form is discouraged since no match or an incorrect match could result. If a student searches with six correct items of spectral data, one unique match will he displayed since a t present no two compounds in our data hase have exactly matching spectral information. By matching the unknown's infrared and NMR data with that expected for each literature-confirmed data hase match, most students are able to make an unambiguous assignment of identity. The described svstem of constmctine and searchine" a mass spectral library has several advantag& particularly for educators. Bv decidine what com~oundsto include and what data for each compouni is to be &red for most effective matching, a user can virtually customize his own personal library. No knowledge of computer programming is necessary for any of the described operations; instead, brief, facile commands guide the user through all software functions. When employing this system, a student is naturally required to interpret a mass spectrum accurately, precisely, and to the maximum extent so that the number of matches will be minimized. The software package is relatively inexpensive and, of course, can he used for other electronic filina- a~plications .(apparatus and chemical inventory, student grade register, etc.).

NLLSQ (11) readily solves the general linear problem, provided that the individual deviations & - a - bx;) are divided hy (02,~ b2a2xi)1/2in the YCALC subroutine, so that correctly weighted residuals are returned to the main (optimizing) part of the program. However, because weighted linear analvsis is freauentlv required in scientific research, we thought it would he v&thwhile to develop a microcomputer program in BASIC to solve this specific problem. A minimum in S , the sum of the weighted squares of residuals, will occur when the two derivative equations

+

+

~~

Sherril D. Chrlstlan and Edwln E. Tucker University of Oklahoma Norman. OK 73019

+

The problem of fitting data to the model equation y = a bx, where y is the dependent variable and x is the independent variable, is not a trivial one (5-9). I t can he shown that when ) the measured both the measuredy values (yl, y2,. ..y ~and x values (XI, xz, . . .XN)are subject to errors, fitting data to the linear model requires use of nonlinear least squares analysis (5-7). LINGEN is aBASIC program for the Apple 11+ or IIe that will fit data t o y = a bx, given N sets of values of yi, xi, ayi,and axi,where aYiand a,; are estimates of the standard deviations in y; and xi, respectively. In using the principle of least squares to fit data t o y = a bx, i t can be shown that the function to be minimized is

+

+

where the weighting factors (Wi) for the individual data sets are seen to depend on ayi,axi,and b. T o obtain the correct least squares solution, i t is necessary to use a strategy that permits a and b (the only variables in eqn. (1) t o vary in an unrestricted way, with the goal of finding an absolute minit mum in S. The algorithm of Levenhera and M a r ~ u a r d(10). which is the basis for many modern nonlinear least squares promams,. mav. he used to minimize S and to obtain the optimum values of a and b (10). For example, the progiam Journal of Chemical Education

and JSlJb = 0

are solved simultaneouslv for the values of a and b. Althoueh the second of these equations is somewhat complicated, the first is readily solved for a , yielding an expression

~~~~

LINGEN-A General Linear Least Squares Program

788

JSlJa = 0

When this expression for o is substituted into the equation &Slab = 0, a highly nonlinear equation involving the single unknown, b, is obtained. T o solve this equation, i t is convenient to use Newton's method, starting with the approximate value of b ohtained by ordinary (unweighted) linear least squares analysis. The program LINGEN obtains the optimum values of a and b, and calculates the standard errors in these parameters, the minimum value of S. the correlation coefficient. and the covariance of a and b. LINGEN includes numerohs REM statements. to show what is hao~eninein the various arts of the and an INFORMATIOI~section descriging the method of analvsis and wavs to enter data. The oromam is NO: 17 from I'rojwt S K K A I ~ H I M at , available on ~ p b l Disk e a cost of $4 (make check payable to Project SEHAI'HIM).

A Low-Cost Data Acquisition System for the Apple II+ Computer Wllllam S. Wagner, Carl D. Slater, and Arthur S. Ambrose Northern Kentucky University Highland Heights. KY 41076 We have constructed for the Apple 11+ a very low cost (--$I01 acquisition interface that has a maximum rate of 8,000 points per second and is otherwise limited only by the sophistic&ion of the uner-supplird software. It canacquiredata under either BASIC or machine code control. It demonstrates the principles of data acquisition and can he used in quantitative and instrumental analysis classes for recording spectra, chromatograms, and titration curves. We have also found it to be useful in physics lecture demonstrations of Newton's Law of cooling of a heated thermocouple and simple harmonic motion of a mass spring or a pendulum. Interfacing hardware includes the ADC 0809, a 7404 inverter, two 741 op amps, and a 16-conductor rihhon cahle that fits the Apple 110connector slot. The ADC 0809 requires an analog input voltage in the 0- to 6-volt range. This is provided by the linear amplifier composed of the two 741 op amps as shown in Figure 4. The linear amplifier is designed to accommodate a variety of analog input ranges. I t has a high input impedance, differential input stage followed by a gain adjustable stage with an adjustable offset voltage. This insurea that the input voltage to the ADC is in the proper range. A schematic showing complete wiring details is given in Figure 4. Listings of representative programs are available from the authors upon receipt of a stamped, addressed, letter-size envelope.