Phys 628: HW #1

Phys 628: HW #1
Jason E. Turnquist
1
Normally Distributed Random Data
The below figures where created in MATLAB 2007a using normally distributed
random data. The Box-Muller algorithm(1) was used to create a normally
distributed ensemble with zero mean (µ = 0) and unit variance (σ 2 = 1) from
two sets of uniformly distributed random numbers in the interval (0, 1]. Using
a linear transform of the form X = σZ + µ, the ensemble was given mean,
µ = −1 and standard deviation, σ = 0.5.
N ormal y Di stri b u ted R an d o m Data
µ = -0. 9 3713, σ = 0. 48772
0.5
0
−0.5
−1
−1.5
−2
−2.5
0
10
20
30
40
50
60
70
80
90
100
10
8
6
4
2
0
−2.5
−2
−1.5
−1
−0.5
0
0.5
−0.5
0
0.5
Cumul i ti ve D i stri buti on
1
0.8
0.6
0.4
0.2
0
−2.5
−2
−1.5
−1
Figure 1. Normally distributed random data for n = 100.
Preprint submitted to Elsevier
February 1, 2010
N ormal y Di stri b u ted R an d om Data
µ = -1. 020 2, σ = 0. 49852
1
0
−1
−2
−3
0
100
200
300
400
500
600
700
800
900
1000
70
60
50
40
30
20
10
0
−3
−2.5
−2
−1.5
−1
−0.5
0
0.5
1
−0.5
0
0.5
1
Cumul i ti ve D i stri buti on
1
0.8
0.6
0.4
0.2
0
−3
−2.5
−2
−1.5
−1
Figure 2. Normally distributed random data for n = 1000.
N ormal l y Di stri b u ted R an d om Data
µ = -0. 999 87, σ = 0. 49991
1
0
−1
−2
−3
−4
0
1000
2000
3000
4000
5000
6000
7000
8000
9000
10000
700
600
500
400
300
200
100
0
−3.5
−3
−2.5
−2
−1.5
−1
−0.5
0
0.5
1
Cumul i ti ve D i stri buti on
1
0.8
0.6
0.4
0.2
0
−3
−2.5
−2
−1.5
−1
−0.5
0
Figure 3. Normally distributed random data for n = 10000.
2
0.5
1
For a small number of data points (n) the set approximates a normal distribution. Increasing the numbers of data points the ensemble more closely
approximates the normal distribution as can be seen in the histograms for
n = 100, 1000, 10000.
By increasing the number of data points the Discrete Cumulative Distribution(4),
begins to become smoother and can be approximated by
D (x) =
�
P (x)
X≤x
�
1
≈
1 + erf
2
�
x−µ
√
σ 2
��
where P (x) is the normal distribution.
2
Uniformly Distributed Random Data
The below figures where created in MATLAB 2007a using uniformly distributed random data centered about zero (µ = 0) and contained in the interval [−2, 2].
U n i forml y Di stri b u ted R an d om Data
µ = -0. 027 338, σ = 1. 2243
2
1
0
−1
−2
0
10
20
30
40
50
60
70
80
90
100
5
4
3
2
1
0
−2
−1.5
−1
−0.5
0
0.5
1
1.5
2
0.5
1
1.5
2
Cumul i ti ve D i stri buti on
1
0.8
0.6
0.4
0.2
0
−2
−1.5
−1
−0.5
0
Figure 4. Uniformly distributed random data for n = 100.
3
U n i forml y Di stri b u ted R an d om Data
µ = -0. 004 6231, σ = 1. 1821
2
1
0
−1
−2
0
100
200
300
400
500
600
700
800
900
1000
30
25
20
15
10
5
0
−2
−1.5
−1
−0.5
0
0.5
1
1.5
2
0.5
1
1.5
2
Cumul i ti ve D i stri buti on
1
0.8
0.6
0.4
0.2
0
−2
−1.5
−1
−0.5
0
Figure 5. Uniformly distributed random data for n = 1000.
U n i forml y Di stri b u ted R an d om Data
µ = 0. 000 49312, σ = 1. 1619
2
1
0
−1
−2
0
1000
2000
3000
4000
5000
6000
7000
8000
9000
10000
250
200
150
100
50
0
−2
−1.5
−1
−0.5
0
0.5
1
1.5
2
0.5
1
1.5
2
Cumul i ti ve D i stri buti on
1
0.8
0.6
0.4
0.2
0
−2
−1.5
−1
−0.5
0
Figure 6. Uniformly distributed random data for n = 10000.
4
Discrete uniformly distributed(2) data has a constant probability. That is for
a set of random elements, the nth element has an equal probability of taking
on a value as any other element in the finite set. For a uniform distribution on
the interval [a, b], the discrete probability density function is a step function
and the discrete cumulative distribution function is a linear line with positive
slope.
This can be seen in the above figures. As the size of the ensemble increases,
the closer the probability density (histogram) approximates a step function
and the discrete cumulative distribution approximates a positive slope line
with slope m ≈ x−a
, over the interval [a, b] = [−2, 2].
b−a
References
[1] Weisstein, Eric W. "Box-Muller Transformation." From MathWorldA
Wolfram
Web
Resource.http://mathworld.wolfram.com/BoxMullerTransformation.html
[2] Weisstein, Eric W. "Normal Distribution." From MathWorld-A Wolfram
Web Resource. http://mathworld.wolfram.com/NormalDistribution.html
[3] Weisstein, Eric W. "Uniform Distribution." From MathWorld-A Wolfram
Web Resource. http://mathworld.wolfram.com/UniformDistribution.html
[4] Weisstein,
Eric
W.
"Distribution
Function."
From
MathWorld-A
Wolfram
Web
Resource.
http://mathworld.wolfram.com/DistributionFunction.html
5