Given by Geoffrey C. Fox at Delivered Lectures of CPS615 Basic Simulation Track for Computational Science on 22 October 96. Foils prepared 12 November 1996
Outside Index
Summary of Material
This starts by finishing the simple overview of statistics |
Covering Gaussian Random Numbers, Numerical Generation of Random Numbers both sequentially and in parallel |
Then we describe the central limit theorem which underlies Monte Carlo method |
Then it returns to Numerical Integration with the first part of discussion of Monte Carlo Integration |
Outside Index
Summary of Material
Geoffrey Fox |
NPAC |
Room 3-131 CST |
111 College Place |
Syracuse NY 13244-4100 |
This starts by finishing the simple overview of statistics |
Covering Gaussian Random Numbers, Numerical Generation of Random Numbers both sequentially and in parallel |
Then we describe the central limit theorem which underlies Monte Carlo method |
Then it returns to Numerical Integration with the first part of discussion of Monte Carlo Integration |
"A Small Miracle" asserts that: |
If x1 x2 are uniformly distributed in [0,1] -- Then:
|
are Gaussianly distributed |
with mean = 0 and standard deviation = 1 |
while g1 and g2 are independent. |
Proof: Consider |
Integral: |
with g1 g2 going to Polar coordinates (r=radius, angle) |
and then transform to x1and x2 by |
(-2lnx1)1/2 = radius i.e. x1=exp(-r2/2) and |
2px2 = angle |
Intuitively, random numbers come from large physical systems whose size implies that different atoms act (decay) independently, e.g. observed time of decay of radioactive particle is a random number. |
Computers generate "pseudo random numbers"
|
xn+1 = (axn + c) mod m
|
See Knuth1 or Numerical Recipes2. |
1) Knuth, D.E., "Seminumerical Algorithms "Vol. 2, The Art of Computer Programming, Addison-Wesley Publishing Co.1969 |
2) Flannery,B.P., Press,W.H., Teukolsky,S.A., Vetterling,W.T., "Numerical Recipes in Fortran", The Art of Scientific Computing, Cambridge University Press 1992 |
Take the choice: |
m = 231 |
a = 1103515245 |
c = 12345 |
Implemented in C as (64 bit) |
newran = [a*oldran+c] & MASK |
floatran = newran/2147483648.0 |
oldran = newran |
floatran is uniformly distributed in [0,1] |
MASK has lower 31 bits = 1and all higher bits = 0 |
This intuitively says that lower order bits of a complex multiplication are "essentially" random |
You do not need to "understand" this. |
It is useful to check random number generator. |
Is xn+i independent of xn for different values of i= 1...? |
Also, note one must specify a "seed" = initial value x0 |
Then "random numbers" follow deterministically. |
x0 => x1 => x2 ...... |
Set seed (x0) from "Time of Day" |
Save seed so can rerun program.. |
An old Turbo Pascal Random Number Generator |
There are correlations .... |
More than 1,000,000 random numbers generated by Turbo-Pascal v3.0 and plotted as (xn,xn+1) pairs. |
Parallel random numbers are somewhat nontrivial. |
If have N processors, must have numbers independent within and between processors. |
See "Solving Problems on Concurrent Processors"
|
One strategy is to have one stream and make every N'th number go to a given processor. This can be done very efficiently as described in reference above. |
The result is:
|
Let xi be independent random numbers -- each with same distribution p(x). |
Distribution of x: p(x) anything (reasonable) |
Distribution of y: Gaussian but more importantly sharply peaked with width of peak -> 0 |
x and z are random variables with distributions - one has n copies of each |
y = S (zi=f(xi))/n is a random variable with a distribution ,even though we only have one value for y we can calculate properties of this distribution including most importantly the expected error in y |
This is most importantly applied in case f(x)=x and the above allows one to calculate error in basic central limit theorem application to y = S xii/n |
We review the different Integration Formulae |
Gaussian Integration |
Unequally spaced prescribed points |
Monte Carlo Integration |
See Original Foil |
See Original Foil |
See Original Foil |
See Original Foil |
See Original Foil |
See Original Foil |
See Original Foil |
See Original Foil |
See Original Foil |
See Original Foil |
See Original Foil |
See Original Foil |
See Original Foil |
See Original Foil |
See Original Foil |
See Original Foil |