Re: Normal distribtion
- To: mathgroup at smc.vnet.net
- Subject: [mg49188] Re: Normal distribtion
- From: "Kevin J. McCann" <kjm at KevinMcCann.com>
- Date: Wed, 7 Jul 2004 01:42:21 -0400 (EDT)
- References: <7228735a.0407050100.4695fc68@posting.google.com> <QaednZQbSYcwpnTdRVn-vA@comcast.com> <ccdlms$sd5$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
A Histogram plot of this does not look very Gaussian to me. Min of zero, max of about 0.82. There are also typos in your code. Kevin "Roger L. Bagula" <rlbtftn at netscape.net> wrote in message news:ccdlms$sd5$1 at smc.vnet.net... > I found a better faster way to get a Gaussian/ white noise: > In Mathematica notebook style: > > x[a_]=(1+Sqrt[1-a^2))/a > Noise=Table[Exp[-x[Sin[2*Pi*Random[]]]^2/2/Sqrt[2*Pi],{n,1,500}] > ListPlot[noise,PlotRange--> All,PlotJoined->True] > > It is a projective line ( circle to line random taken as the basic for a > normal distribution's amplitude.) based algorithm. > Since it doesn't use either the polar method with has a choice loop or > the older 12 random method, the random operation has only to be used > once for each noise value. > It is faster by several factors and can be translated to almost any > language. > George Marsaglia wrote: > > "philou" <philou2000 at msn.com> wrote in message > > news:7228735a.0407050100.4695fc68 at posting.google.com... > > > >>Hi, > >>I heard that it was possible to get a realisation of a normal > >>distribution from two realisations of an uniform distribution. Can > >>someone explain me how to do that ? What transformations should I do ? > > > > > > Your hazy reference may have been based on my polar method for > > generating a pair of independent standard normal variates X and Y: > > > > If U and V are independent uniform in (-1,1), conditioned by > > > > S = U^2+V^2 < 1 > > > > then S is uniform in (0,1) and independent of the point > > (U/sqrt(S),V/sqrt(S)), which is uniform on the unit circumference. > > > > Thus if R=sqrt(-2*ln(S)/S) then > > X=R*U > > Y=R*V > > are a pair independent standard normal variates, obtained by > > projecting that uniform point on the unit circumference > > a random distance with a root-chi-square-2 distribution, > > exploiting the uniformity of S and its independence of > > the random point on the circumference. > > > > Of course one has to discard uniform (-1,1) pairs U,V > > for which S=U^2+V^2>1, so each normal variate is produced > > at an average cost of 4/pi=1.27 uniform variates. > > > > This method is sometimes improperly attributed to Box and Muller, > > who pointed out that pairs of normal variates could be generated as > > rho*cos(theta), rho*sin(theta) with rho root-chisquare-2 , sqrt(-2*ln(U)), > > and theta uniform in (0,2pi), a result we owe to Laplace, who showed us > > how to find the infinite integral of exp(-x^2) by getting its square > > as the integral of exp(-x^2-y^2), then transforming to polar coordinates. > > > > For a method faster than my polar method, requiring about 1.01 uniform > > variates per normal variate, try the ziggurat method of > > Marsaglia and Tsang, in volume 5, Journal of Statistical Software: > > http://www.jstatsoft.org/index.php?vol=5 > > > > George Marsaglia > > > > >