Normal distribution starting with a uniformed distribution

AI Thread Summary
The discussion focuses on generating a normal distribution of velocities from a uniformly distributed sequence between [0,1] using FNT95 with Plato. The user seeks assistance in coding a loop to populate velocity arrays VX, VY, and VZ for N=125 while ensuring the standard deviation (sigma) is defined. A suggested method involves using two independent uniform variables, U and V, to derive normally distributed variables X and Y. The formula provided allows for the generation of normally distributed values with specified mean (mu) and standard deviation (sigma), leveraging the properties of the bivariate normal distribution in polar coordinates. The user expresses appreciation for the algorithm, noting its utility for their project.
Jamil
Messages
8
Reaction score
0
Hi comunity! I need to make a code o a normal distribution of velocities, starting whit a random secuence uniformly distributed between [0,1]. I am using FNT95, with Plato. I want to obtain a ''for'' bucle with I=1,N for the velocities.
It is importan for the distribution to have sigma defined.
The code is:

Fortran:
PARAMETER (N=125)
INTEGER (SELECTED_INT_KIND(4)) I !Átomo I-ésimo
REAL, DIMENSION(1:N):: VX(N), VY(N), VZ(N)

    DO 200 I=1,N
    VX(I)=?¿
    VY(I)=?¿
    VZ(I)=?¿
    ENDDO
Could anyone help me?? Thank you! :nb)
 
Technology news on Phys.org
The simplest way to generate a normally distributed variable from uniform ones is probably to use two independent variables U, V, both uniformly distributed on [0,1].

If you want ## X\sim \mathcal{N}(\mu_X,\sigma_X) ## ,

Set ## X=\mu_X+\sigma_X \sqrt{-2 \ln(2\pi U)}\cos(2\pi V) ##

You actually obtain a pair of independent normal variables this way, the second one being :

## Y=\mu_Y+\sigma_Y \sqrt{-2 \ln(2\pi U)}\sin(2\pi V) ##

The reason behind this comes from looking at the bivariate normal distribution in polar coordinates.
 
Last edited:
  • Like
Likes jim mcnamara
thank you! I have seen this algorithm before, but with sigma=1. It is very useful to my proyect! Thans again! :smile:
 
Thread 'Is this public key encryption?'
I've tried to intuit public key encryption but never quite managed. But this seems to wrap it up in a bow. This seems to be a very elegant way of transmitting a message publicly that only the sender and receiver can decipher. Is this how PKE works? No, it cant be. In the above case, the requester knows the target's "secret" key - because they have his ID, and therefore knows his birthdate.

Similar threads

Replies
12
Views
2K
Replies
5
Views
2K
Replies
8
Views
4K
Replies
6
Views
2K
Replies
4
Views
2K
Replies
7
Views
4K
Replies
4
Views
3K
Replies
6
Views
2K
Replies
3
Views
2K
Back
Top