Hi
I need some random numbers from an uniform distribution like gaussian
distribution.
How can I employ this distribution in fortran 90?
Thanks in advance.
|
|
0
|
|
|
|
Reply
|
elaheh.adibi (11)
|
5/14/2012 6:31:01 PM |
|
On Monday, May 14, 2012 1:31:01 PM UTC-5, Elaheh wrote:
> Hi
> I need some random numbers from an uniform distribution like gaussian
> distribution.
> How can I employ this distribution in fortran 90?
>
> Thanks in advance.
Our library, RANDLIB, contains random number generators for many statistical
distributions including the uniform and Gaussian (although not for a
uniform like Gaussian). It is written in Fortran95 and is available free
from
biostatistics.mdanderson.org/SoftwareDownload
Barry W Brown
|
|
0
|
|
|
|
Reply
|
brownbar (9)
|
5/14/2012 6:52:44 PM
|
|
Elaheh <elaheh.adibi@gmail.com> wrote:
> I need some random numbers from an uniform distribution like gaussian
> distribution.
> How can I employ this distribution in fortran 90?
Note that the Gaussian and uniform are different distributions, so it
doesn't make much sense to describe something as "uniform like
Gaussian".
Also note that it makes a *LOT* of difference whether you want a
Gaussian distribution or something "like" it. There are several popular
methods for Gaussian. If you want more general distributions, your
options might be far more restricted.
I see that Barry Brown posted a link to a package of routines, so I
won't go dig one up.
--
Richard Maine | Good judgment comes from experience;
email: last name at domain . net | experience comes from bad judgment.
domain: summertriangle | -- Mark Twain
|
|
0
|
|
|
|
Reply
|
nospam47 (9742)
|
5/14/2012 10:58:36 PM
|
|
In article <1kk3df7.1uxr8npnv5kkiN%nospam@see.signature>,
nospam@see.signature (Richard Maine) writes:
> Note that the Gaussian and uniform are different distributions, so it
> doesn't make much sense to describe something as "uniform like
> Gaussian".
It is relatively easy to get a random number from a Gaussian
distribution once one has one from a uniform distribution.
Or, if you have some spare CPU cycles, just build the sum on N random
numbers from a uniform distribution and divide by N. As N approaches
infinity, the sums so built approach a Gaussian distribution.
Of course, this is not very efficient. However, it does illustrate WHY
error distributions are often Gaussian (i.e. they are the sums of
random, uncorrelated errors).
|
|
0
|
|
|
|
Reply
|
helbig (4874)
|
5/15/2012 7:59:20 AM
|
|
On 05/14/2012 08:31 PM, Elaheh wrote:
> I need some random numbers from an uniform distribution like gaussian
> distribution.
I take "like" to mean "as well" here, otherwise it doesn't make sense. I also
assume you are satisfied with non-cryptographically secure, pseudo-random,
otherwise you might want to look into some library like OpenSSL.
> How can I employ this distribution in fortran 90?
real :: u
call random_number(u)
random_number will give you a pseudo-random number under a uniform distribution
regime.
In case you already have two random numbers u and v from a uniform distribution
(0.0,1.0), you might try the algorithm from wikipedia to obtain a
normal-distributed number r.
real, parameter :: pi = 3.1415
r = mean + variance * sqrt(-2.0 * log(u)) * cos(2.0 * pi * v)
Hint: you might want look into the distribution random_number actually gives
you, also pi is probably not given exactly enough in my example.
Regards, Thomas
|
|
0
|
|
|
|
Reply
|
jahns (51)
|
5/15/2012 8:36:46 AM
|
|
On 14.05.12 20:31, Elaheh wrote:
> Hi
> I need some random numbers from an uniform distribution like gaussian
> distribution.
> How can I employ this distribution in fortran 90?
>
> Thanks in advance.
There's always the Box--Muller transform. It turns uniformly distributed
random numbers into normal gaussian distributed ones. (See other
comments on what "uniform distribution" means, too.)
https://en.wikipedia.org/wiki/Box%E2%80%93Muller_transform
Paul
|
|
0
|
|
|
|
Reply
|
paul.anton.letnes1 (77)
|
5/15/2012 11:00:55 AM
|
|
"Phillip Helbig---undress to reply" wrote in message
news:jot2co$vr4$1@online.de...
In article <1kk3df7.1uxr8npnv5kkiN%nospam@see.signature>,
nospam@see.signature (Richard Maine) writes:
> Note that the Gaussian and uniform are different distributions, so it
> doesn't make much sense to describe something as "uniform like
> Gaussian".
It is relatively easy to get a random number from a Gaussian
distribution once one has one from a uniform distribution.
Or, if you have some spare CPU cycles, just build the sum on N random
numbers from a uniform distribution and divide by N. As N approaches
infinity, the sums so built approach a Gaussian distribution.
Of course, this is not very efficient. However, it does illustrate WHY
error distributions are often Gaussian (i.e. they are the sums of
random, uncorrelated errors).
---> It's not that difficult to calculate the exact pdf and cdf for the sum
of two uniforms or three uniforms. For three, it is remarkably close to a
standard normal. But the practical drawback to this method, which was once
proposed and once used, is that the tails will be too light.
-- e
|
|
0
|
|
|
|
Reply
|
epc8 (1259)
|
5/15/2012 3:57:12 PM
|
|
e p chandler <epc8@juno.com> wrote:
(snip)
> It is relatively easy to get a random number from a Gaussian
> distribution once one has one from a uniform distribution.
> Or, if you have some spare CPU cycles, just build the sum on N random
> numbers from a uniform distribution and divide by N. As N approaches
> infinity, the sums so built approach a Gaussian distribution.
http://en.wikipedia.org/wiki/Irwin%E2%80%93Hall_distribution
I remember reading about this one before I even knew about Normal
distributions. It is commonly done by adding up 12 uniformly
distributed values and subtracting six, which approximates the usual
normalized Gaussian with variance of 1.0. (The variance is N/12.)
> Of course, this is not very efficient. However, it does illustrate WHY
> error distributions are often Gaussian (i.e. they are the sums of
> random, uncorrelated errors).
Depending on the speed of COS, SIN, LOG, and SQRT, it could be a
lot faster than Box-Muller.
> ---> It's not that difficult to calculate the exact pdf and cdf for the sum
> of two uniforms or three uniforms. For three, it is remarkably close to a
> standard normal. But the practical drawback to this method, which was once
> proposed and once used, is that the tails will be too light.
Tails are always the problem. While Box-Muller should give pretty
good tails, though they do somewhat depend on how close to uniform
the uniform generator is for smaller values. But to get good tails,
you need a really large number of samples.
-- glen
|
|
0
|
|
|
|
Reply
|
gah (12261)
|
5/15/2012 7:48:05 PM
|
|
>> Of course, this is not very efficient. However, it does illustrate WHY
>> error distributions are often Gaussian (i.e. they are the sums of
>> random, uncorrelated errors).
>
> Depending on the speed of COS, SIN, LOG, and SQRT, it could be a
> lot faster than Box-Muller.
Without going into the "speed" debate, I'd like to point out that
Box-Muller can be done without any COS or SIN.
https://en.wikipedia.org/wiki/Box_muller
There's only one SQRT and one LOG evaluation, at most. That should help
performance a bit, too.
Paul
|
|
0
|
|
|
|
Reply
|
paul.anton.letnes1 (77)
|
5/16/2012 5:47:03 AM
|
|
|
8 Replies
194 Views
(page loaded in 0.115 seconds)
Similiar Articles: multivariate Gaussian Distribution - comp.soft-sys.matlab ...Hi All, I'm trying to find out the probability of certain even using multivariate Gaussian distribution. Input is 12 dimension feature vector, wit... calculating 95-percentile for a non-Gaussian distribution - comp ...Hello all, Is it possible to calculate 95-percentile of a non-Gaussian distribution without having to define its exact distribution? thank you v... Gaussian Mixture Model Fitting to PDF or Histogram - comp.soft-sys ...Hi all; My question is how we can fit a mixture of Gaussian to a distribution, not to the data directly. Let's assume that we have got only the dis... The Inverse cumulative distribution function for Inverse Gaussian ...Hi! I would like to know how to find the inverse cumulative distribution function for the inverse Gaussian(Wald Distribution). Is there any built i... PROC NLMIXED: finite gaussian mixture distribution of latent ...PROC NLMIXED: finite gaussian mixture distribution of latent exogenous variables in a structural equation model Follow random# histogram with gaussian overlay - comp.soft-sys.matlab ...Overlay on top of this normalized histogram a plot of the continuous gaussian distribution. c. Calculate the mean and standard deviation of this vector, and add these ... univariate bimodal distribution - comp.soft-sys.matlabHello, I am looking to use Matlab to fit experimental 1D data with a Gaussian bimodal distribution. I've been looking into the gmdistribution f... Double Gaussian - comp.soft-sys.matlabThe first step would be to choose the data to fit (x and/or y axis) as a new data set, next step to choose "fitting" & then the double gaussian distribution a1*exp(-((x ... Gaussian Mixture Model - comp.soft-sys.matlabHi all; My question is how we can fit a mixture of Gaussian to a distribution, not to the data directly. Let's assume that we have got only the dis... set the number of iterations in Gaussian mixtures (using ...Hi! I'm trying to fit Gaussian mixture distributions with K components to the data in X using the Matalb function gmdistribution.fit(X,K). It work... Normal distribution - Wikipedia, the free encyclopediaIn probability theory, the normal (or Gaussian) distribution is a continuous probability distribution that has a bell-shaped probability density function, known as ... Gaussian function - Wikipedia, the free encyclopediaIn fluorescence microscopy a 2D Gaussian function is used to approximate the Airy disk, describing the intensity distribution produced by a point source. 7/29/2012 6:46:17 PM
|