12.07.2015 Views

COPYRIGHT 2008, PRINCETON UNIVERSITY PRESS

COPYRIGHT 2008, PRINCETON UNIVERSITY PRESS

COPYRIGHT 2008, PRINCETON UNIVERSITY PRESS

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

monte carlo simulations (nonthermal) 11310.8Random Number r0.60.40.200 20 40 60 80 100Sequence NumberFigure 5.2 A plot of a uniform pseudorandom sequence r i versus i. The points are connectedto make it easier to follow the order.5.2.2 Implementation: Random Sequence1. Write a simple program to generate random numbers using the linearcongruent method (5.1).2. For pedagogical purposes, try the unwise choice: (a, c, M, r 1 ) = (57, 1,256, 10). Determine the period, that is, how many numbers are generatedbefore the sequence repeats.3. Take the pedagogical sequence of random numbers and look for correlationsby observing clustering on a plot of successive pairs (x i ,y i )=(r 2i−1 ,r 2i ),i =1, 2,.... (Do not connect the points with lines.) You may “see” correlations(Figure 5.1), which means that you should not use this sequence for seriouswork.4. Make your own version of Figure 5.2; that is, plot r i versus i.5. Test the built-in random-number generator on your computer for correlationsby plotting the same pairs as above. (This should be good for seriouswork.)6. Test the linear congruent method again with reasonable constants like thosein (5.8) and (5.9). Compare the scatterplot you obtain with that of the built-inrandom-number generator. (This, too, should be good for serious work.)−101<strong>COPYRIGHT</strong> <strong>2008</strong>, PRINCET O N UNIVE R S I T Y P R E S SEVALUATION COPY ONLY. NOT FOR USE IN COURSES.ALLpup_06.04 — <strong>2008</strong>/2/15 — Page 113

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!