Ediia's Note: h e lo lowmg mmmems on me revoews ot GASLAWS puol shed n the Decemoer 1983 l s s w nd cale changes mnoe in Pro ect SERAPrllM materials in response to reviewer suggestions. They also indicate a common problem faced by authrns whoby to write microcomputer-basedhillsthal involve
numeric problems.
J
Comments on Reviews of GASLAWS Robert D. Allendoerter SUNY Buffalo Buffalo, NY 14214 GASLAWS is an adaptation of a mainframe program we have used for a number of years as part of an extensive CAI package. For each unit in the lecture course, e.g., ideal gases, there is a program the students use as a first problem set to cover mechanical-type exercises upon conclusion of the unit. Students work the ~ r o b l e mas t a terminal and a summarv of their scores goes to'the instructor. As a result of this philoso~. . h individual v Droaams do not contain expository material, . .. discussion uf thr program's srope, or an-indicaiion nf the scorine system. Thesc lire provided in a single - handout at the h e g i n & g of the semester. In-program directions are intended to be terse but complete,-as reminder of any forgotten feature of the package. T h e program is designed to be modifiable, and it may be necessary to tailor thehirections to a local situation. Examples noted by the reviewers where this would appear desirable are: (1) numeric expressions like 3.514 can be entered as problem answers, as stated in the introduction, a t the end of each nroblem. and in the SCRATCH PAD directions:. (2) . the hierarchy (if arithmetic operations and the need fur parentheses is stated in thc SCRATCH PAL) directions: 13)answers calculated by SCRATCH PAD can be submitted directly as nroblem responses without rekevina, . .. bv. using the *-kev .. . lcature, hut this featurr was only implicit in the instrurtiond. It has been madr rxplicit in the updated wrsion a)that future users will not miss ihis important feature. The rurrrnt program prints all numeric values to three significant figures dour in SCRATCH PAD), and checks arruracs of respunses to 1'70. Thrsr twn parameters ran br varied easiliby theinstructor. The prohlemi with significant figures, noted by the reviewers are inherent in Microsoft BASIC and not unique to GASLAWS or the IBM PC. BASIC will not print trailing zeros to the right of the decimal point, i.e., 13.0 and ,210 are printed as 13 and .21; therefore occasional discrepancies in significant figures are bound to occur. A similar problem that occurs only occasionally and was not noted by the reviewers is printing of some numbers with repeating nines, e.g. 49.9999 when 50 is intended, despite the programmer's best efforts. This problem seems to occur less frequently with the IBM BASIC-compiler and can be circumvented completely by printing only double precision numbers, but that doesn't help when significant figures are important.
a
166
Journal of Chemical Education
Computer-Simulated Distributions of Molecular Speeds Susan E. Gier and M. A. Wartell, James Madison University Harrisonburg. VA 22807 Computer-aided instruction has many uses, important amone which is the simulation of experiments that would be too costly or too complicated for a student laboratory. One t the studv of kinetic theory and such e x ~ e r i m e n concerns molecuiar velocity distributions as they develop on a microcosmic scale. Phvsicallv, such experiments are difficult and are often replaced by-studies df indirectly related macro phenomena such as the transport properties of gases, the complexity of which often obscures the important aspects of the theories which are being emphasized. We have developed a computer-assisted package that not only simulates the experimentally accessible three-dimensional problem of the unfoldingof velocity distributions, but also allows study of one- and two-dimensional cases. Experimentally, the simulation relates directly to kinematic descriptions of shock waves, explosive modeling, and distributions in sunersonic nozzle beams where relaxation from an initial energy input is important. Pedagogically, the package allows the instructor to h e l students ~ obtain a strong intuitive understanding of velocity distributions and their development by proceeding from conceptually simple to conceptually complex situations while retaining a direct tie to physical realitv. Thus, the student can be led through an increasingly complex set of simulated situations that finally result in an understandable, usable model of three-dimensional physical This group of simulated experiments has several objectives in addition to the primary goal of providing data useful in studying kinetic theory. and velocity distributions. Among these are I ) Teaching computcr pnrgramming. 2) Teaching ~ t a r ~ s t ~data ral anslw%. 31 Tenrhing the usdulnrzs and l~m~rotions of rndtl%. The package is appropriate for use inphysical chemistry laboratory and can be easily modified for use in advanced freshman laboratories A common approach to the developinent of the kinetic theorv of cases found in many physical chemistry texts ( 1 ) consi& o r an ab initio treatmind making use of a velocity space approach to yield a two-dimensional form. Actually, using such a model, the one., two., and three-dimensional forms can be derived. All three differential functions are shown in Table 1along with the mean, most probable, and root-mean-square speed associated with each one. Graphical representations of the distribution functions are shown in Figure 1.
Figure 1. Theoretical distributions. Speed/104 cm s-' versus (liN)(dn,/ d ~ ) / 1 0 -s~cm-'. One dimension - - - ; t w o dimensions .-.; threedimensions ...... T = 300K. m = 2.0 emu.
While the final form of the three-dimensional distrihution function is shown in most texts, it is uncommon to see the final one-or two-dimensional distrihution function oresented. Also. it is interesting to note that the most probable speed for one-dimensional svstem is zero. Programs were written to simulate one., two., and threedimensional distributions. In all cases, up to 100 particles comprise the system under study. Particle direction of motion and position are chosen randomly. However, for each particle, the following parameters can he specified: mass, radius, and speed. In the simplest situation, one begins with particles havine" the same mass. radius. and soeed. . , although anv" comhination of parameters is possible. Finally, for the system the overall dimensions of the particle container (line, square, or cube) can be chosen as a function of the space occupied by the oarticles (length. area. or volume). After i"iti2 are determined, the particles are allowed to move and collide. All collisions in the two- and three-dimensional systems are assumed to he elastic including those with the walls. In the one-dimensional system, however, insufficient degrees of freedom exist for the distrihution to develoo, so i t is necessarv that collisions with the walls he inelastic.'That is, the partiele closest to each wall can lose or gain energy randomly on collision with the wall in quantities up to the energy possessed by the particle. As the distrihution unfolds, the speed, position, and direction of motion of each particle can he monitored a t chosen intervals. A histogram of number of particles versus speed can he printed a t any time along with an overlay of the theoretical normal curve as calculated from the differential forms shown in Table 1. Termination of the oroeram results in a orintout of final data as listed above in graihical and tabula; form. T h e programs were written in extended BASIC for use on a Hewlett-Packard 9845B (56K), and can he modified for most other systems of similar size. Explanations, directions, and appropriate documentation are also a part of the package. Depending on the speeds, system size, number of particles, and size of particles, elapsed real time to randomization varies. Students can be asked to perform individual experiments on systems up to 100 particles; however, the speed distribution develops only after a relatively long real-time interval. If computation time is critical, each student can he asked to work with systems of 50 particles or fewer observed over short, specified time intervals and data can he combined for final analysis. System dimensions can also he altered to insure more collisions per time interval. In tvoical exoeriments. a student is asked to run a simulation 0i.50 iden'tical parti'cles beginning a t identical speeds. Then, there are several data accumulation and analysis tasks which the student is asked to perform, given the raw data for 50 oarticle simulations for each class member. Fieure 2 shows typical data sets for one., two-, and three-dimensional cases.
a
-
Figure 2. Experimental (bars) and theoretical (dashed lines) distributions. Speed/104cm s-I ~ e r s u s ( l / M ( d n , l d c ) / l O ~cm-'. ~s Part a, onedimension; part b, two dimensions: part c. three dimensions. rn = 2.0 am": initial speed = 1.0 X lo5 cmls.
Data shown are ten composites of 50 particles each. Superimoosed on each eraoh is a theoretical distrihution curve. ~ i a l y s i and s deveropkent is accomplished as follows. 1) The student confirms that collision elasticitv is maintained in the two- and three-dimensional systems by writing a oronram that calculates svstem enerev ... a t beeinnine and end clit~16 simuli~tiun.T h r studmt also deterniiies thrfinal inelastir conmihution of wall rulliswns i n the one-dimensional case. 2) The student comoares, ctuantitativelv and auditativelv, the one., two., and thrke-dimensional resilts from the similation to the theoretical curves. In order to accomolish this, each studtmt must wrltea proyr;m that u.111acwmulnteand plot a h ~ i t ~ g r aof mclass data and plot a normnlr~rdthtwn~ind curve. Quantitative comparison of simulated data with theoretical prediction is accomplished using a chi-square goodness-of-fit calculation (2) comoarine simulation results to each theoretically predicted curve. T& comparison program is written as Dart of the histoeram oroeram and is used for both individualstudent data se'ts as kell"as whole class results. Volume 61
Number 2
February 1984
167
3) T h ~ h t u d e n d(,rive$ t and n,mpnrr> \.i~luesfor C.,r. f'ml,. and (,', i i ~ ra11 5vstvms r'nr both thcwrrticnl and ;im~llatvd results 41 The student discusrrs all I I S P P C ~i f thedi~taand results In rssav fnrm, explaininr.stari