Re: Normal distribtion

*To*: mathgroup at smc.vnet.net*Subject*: [mg49201] Re: Normal distribtion*From*: "Roger L. Bagula" <rlbtftn at netscape.net>*Date*: Wed, 7 Jul 2004 01:42:40 -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

To give a way of showing the symmetrical distribution I worked this program up. I use the Sign[2*Random[]-1] trick to get an equal sign distribution so that both sides of the distribution which is even can be seen. Since this distribution is closer to single valued on the real line even a 10000 it is very noisy. An equalized distribution with count: x[a_]=(1+Sqrt[a])/a noise=Table[Sign[2*Random[]-1]*Exp[-x[Sin[2*Pi*(2*Random[]-1)]]^2/2]/Sqrt[2*Pi],{n,1, 10000}]; ListPlot[noise,PlotRange->All, PlotJoined-> True] b=Table[Floor[2500*noise[[n]]],{n,1,10000}]; b0=Dimensions[b][[1]] bmax=Max[b] bmin=Min[b] c=Table[Count[b,n],{n,Floor[bmin],bmax}]; ListPlot[c,PlotJoined->True,PlotRange->All] Roger L. Bagula wrote: > 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 >> >> > >

**Follow-Ups**:**Re: Re: Normal distribtion***From:*DrBob <drbob@bigfoot.com>