
Random
should produce a terse description of all the options of the random number
utility. Typing
man Random
should generate the manual page for the random number generator, which is
a bit more descriptive. You can do the same for PlotAtoms and our other
tools.
If this doesn't work, you don't have
LASSPTools
in your path (or MANPATH).
If you're not in physics at Cornell, this likely means that you'll need
to install some of them.
You can use the mouse to "cut and paste" from this HTML page to avoid
typing. It should go fast...
Random -objects 1 Random -objects 1 -seed 2345 Random -objects 10The vertical bar "|" is a pipe: it connects the output of one program to the input of the next. The utility "histogram" will bin the random numbers into equally spaced intervals:
Random -objects 1000 | histogramThe output of histogram is a bunch of boxes, which are meant to be plotted. "xmgr" is a rather nice plotting package. It normally reads in files, so we have to tell it we're reading our curve from a pipe:
Random -objects 1000 | histogram | xmgr -source stdin
Random -objects 1000 -flat -3 5 | histogram | xmgr -source stdin Random -objects 1000 -gaussian 2. | histogram | xmgr -source stdin Random -objects 1000 -exp 17 | histogram | xmgr -source stdinand different generators:
Random -objects 1000 -exp 17 -griff | histogram | xmgr -source stdin
Random -objects 10 -flat -0.5 0.5random walk ("accumulate objects" sums the random numbers):
Random -objects 10 -flat -0.5 0.5 -accumulate objectsplot random walk ("\" continues onto the next line)
Random -objects 3000 -flat -0.5 0.5 -accumulate objects \ | xmgr -source stdin
Random -objects 10 -matrix 1 2 -accumulate objects -flat -0.5 0.5We get (x,y) pairs for the steps of the drunkard's walk! We can use PlotAtoms to make an animation. PlotAtoms takes (x,y) pairs from the standard input, and plots them. Try typing
PlotAtoms 1 2 2 4 4 1(ending with two "returns"): this should put three spheres at the given locations. Frames in the animation are separated by blank lines in the input: "Random" puts blank lines between objects, so
Random -objects 1000 -matrix 1 2 -accumulate objects -flat -0.5 0.5 \ | PlotAtoms -xmin -5 -xmax 5 -ymin -5 -ymax 5should give you a random walk animation. By adding rows to the matrix
Random -objects 3 -matrix 5 2 -accumulate objects -flat -0.5 0.5we can have several atoms flying around:
Random -objects 100 -matrix 10 2 -accumulate objects -flat -0.5 0.5 \ | PlotAtoms -xmin -3 -xmax 3 -ymin -3 -ymax 3more, smaller atoms make for a diffusing cloud:
Random -objects 200 -matrix 300 2 -accumulate objects -flat -0.5 0.5 \ | PlotAtoms -xmin -5 -xmax 5 -ymin -5 -ymax 5 -radius 6 -color yellowMeasure the radius as a function of time: see that it grows as sqrt(t). What is the diffusion constant?
Random walk (length 10, here done by accumulating columns):
Random -objects 1 -matrix 10 1 -index -accumulate cols -flat -0.5 0.5squared distance of random walk:
Random -objects 1 -matrix 10 1 -index -accumulate cols \ -flat -0.5 0.5 -squareplot squared distance of longer walk:
Random -objects 1 -matrix 1000 1 -index -accumulate cols \ -flat -0.5 0.5 -square | xmgr -source stdinlots of fluctuations! Plot five
Random -objects 5 -matrix 1000 1 -index -accumulate cols \ -flat -0.5 0.5 -square | xmgr -source stdinSee how average works on five short walks:
Random -objects 5 -matrix 10 1 -index -accumulate cols \ -flat -0.5 0.5 -square | xmgr -source stdin Random -objects 5 -matrix 10 1 -index -accumulate cols \ -flat -0.5 0.5 -square -average | xmgr -source stdinand then plot the average of 100 long walks:
Random -objects 100 -matrix 1000 1 -index -accumulate cols \ -flat -0.5 0.5 -square -average | xmgr -source stdin
Random -objects 2 -flat -0.5 0.5 -matrix 3000 1 -accumulate objects \ | histogram -sep -s 0.1 \ | pre_gr xmgr.animate \ | xmgr -pipehistograms after first five steps
Random -objects 5 -flat -0.5 0.5 -matrix 1000 1 -accumulate objects \ | histogram -sep -s 0.1 \ | pre_gr xmgr.animate \ | xmgr -pipeClick the A/S button to see the whole range.
Jim Sethna, sethna@lassp.cornell.edu
Statistical Mechanics: Entropy, Order Parameters, and Complexity,
now available at
Oxford University Press
(USA,
Europe).