MathGroup Archive 2004

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Re: Normal distribtion

  • To: mathgroup at smc.vnet.net
  • Subject: [mg49233] Re: [mg49201] Re: Normal distribtion
  • From: DrBob <drbob at bigfoot.com>
  • Date: Thu, 8 Jul 2004 02:51:12 -0400 (EDT)
  • References: <7228735a.0407050100.4695fc68@posting.google.com> <QaednZQbSYcwpnTdRVn-vA@comcast.com> <ccdlms$sd5$1@smc.vnet.net> <200407070542.BAA25013@smc.vnet.net> <opsar4ygzgiz9bcq@monster.cox-internet.com> <40EC4EF3.4010802@netscape.net> <opsasec0j9iz9bcq@monster.cox-internet.com> <40EC7792.3070705@netscape.net>
  • Sender: owner-wri-mathgroup at wolfram.com

I don't get error messages from the notebook, which just proves it isn't the same code.

In the post I responded to, you had:

x[a_] = (1 + Sqrt[a])/a

In the notebook, you have:

x[a_] = (1 + Sqrt[1 - a^2])/a

So... Does that really make me a complainer?

Bobby

On Wed, 07 Jul 2004 15:22:10 -0700, Roger L. Bagula <rlbtftn at netscape.net> wrote:

> Dear Dr. Bob,
> So far you are the only complainer about it not working.
> I'm using Mathematica 3.01.
> I'm sending a notbook with this.
> 5.01 should translate it.
> I can only get you a version 4.01 with my classic Mac os 9.2
> and I have to use another start up disk to do that because the reader
> nullifies my 3.01
> if I use the same disk partition.
> DrBob wrote:
>
>> That code doesn't work in Mathematica 5.0.1. What software do you mean
>> by "3d"?
>>
>> Bobby
>>
>> On Wed, 07 Jul 2004 12:28:51 -0700, Roger L. Bagula
>> <rlbtftn at netscape.net> wrote:
>>
>>> Dear DrBob,
>>> I just did it in 3d.
>>> It works so fine!
>>> DrBob wrote:
>>>
>>>> Did you test that code?
>>>>
>>>> Sin is often negative, hence x[Sin[....]] is Complex. Listplot, Max,
>>>> Min, and Floor can't handle complex data, so there are LOTS of error
>>>> messages.
>>>>
>>>> Bobby
>>>>
>>>> On Wed, 7 Jul 2004 01:42:40 -0400 (EDT), Roger L. Bagula
>>>> <rlbtftn at netscape.net> wrote:
>>>>
>>>>> 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
>>>>>>>
>>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>>
>>>
>>
>>
>>
>



-- 
DrBob at bigfoot.com
www.eclecticdreams.net


  • Prev by Date: Re: sorting polynomials by the degree of certain terms
  • Next by Date: monte carlo simulations
  • Previous by thread: Re: Re: Normal distribtion
  • Next by thread: Re: Normal distribtion