(7 intermediate revisions by the same user not shown)
Line 1: Line 1:
We create a variables :  
+
We create variables :  
  
<math>A ~ exp(1/2)\n
+
A ~ exp(1/2)
  
w ~ unif[0, 2\pi]<math>
+
w ~ unif[0, 2pi]
  
 
then let :
 
then let :
  
<math>X = \sqrt(A)cos(w)\n
+
<math>X = \sqrt(A)cos(w)</math>
  
Y = \sqrt(A)sin(w)</math>
+
<math>Y = \sqrt(A)sin(w)</math>
 +
 
 +
Then you can go through the proof and show that the PDF of X and Y ~ N[0, 1]
 +
(The proof involves calculating the CDF of A and w, then the joint CDF of A and w to get the CDF of X or Y, then differentiat to get the PDF of X or Y)
 +
 
 +
Therefore, in c to produce a random variable with a gaussian distribution you simply do the following
 +
 
 +
<math>\sqrt(A) cos(drand48())</math>
 +
 
 +
where A is what you solved for from part b of problem 1

Latest revision as of 18:03, 20 October 2008

We create variables :

A ~ exp(1/2)

w ~ unif[0, 2pi]

then let :

$ X = \sqrt(A)cos(w) $

$ Y = \sqrt(A)sin(w) $

Then you can go through the proof and show that the PDF of X and Y ~ N[0, 1] (The proof involves calculating the CDF of A and w, then the joint CDF of A and w to get the CDF of X or Y, then differentiat to get the PDF of X or Y)

Therefore, in c to produce a random variable with a gaussian distribution you simply do the following

$ \sqrt(A) cos(drand48()) $

where A is what you solved for from part b of problem 1

Alumni Liaison

Basic linear algebra uncovers and clarifies very important geometry and algebra.

Dr. Paul Garrett