How to produce discreet Gaussian sequences: Algorithm and code

Reading time: 5 minute
...

📝 Original Info

  • Title: How to produce discreet Gaussian sequences: Algorithm and code
  • ArXiv ID: 1107.3291
  • Date: 2011-12-19
  • Authors: Sparisoma Viridi, Veinardi Suendo

📝 Abstract

Algorithm and code to produce sequences whose members obey Gaussian distribution function is reported. Discreet and limited number of groups are defined in the distribution function, where each group is represented only with one value instead of a range of value. The produced sequences are also checked back whether they still fit the discreet distribution function. Increasing of number of particles N increases the value of correlation coefficient R^2, but increasing number of groups M reduces it. Value R^2 = 1 can be found for N = 1000000 at least with M = 5000$ and for M = 10 at least with N = 1000.

💡 Deep Analysis

Figure 1

📄 Full Content

Gaussian distribution function plays important role in many fields of science, such as in mathematical modeling [1], in physical sciences [2], in quantum chemistry [3], with integral in nuclear physics [4], and in semiconductor devices [5]. Then a need comes up how a sequence, that its members obey Gaussion distribution function, could be produced, since it is needed, for example in molecular dynamics simulatons [6]. A procedure to produce the sequences is presented in algorithm and C++ code.

Gaussian or normal distribution function can be represented in the form of

where µ is the average of z and σ is the width of normal distribution curve.

The factor in front of right side of Equation ( 1) is due to normalization of

Variable z is a certain parameter that obeys Gaussian distribution function, it can be particle velocity, particle diameter, or particle mass.

Equation (2) can be proved using

so that

Peak of f (z) is located at z = µ with value

and at z = µ ± 1 2 σ it gives

An example of f (z) is given in Figure 1.

Suppose that there are N particles in a system, that number of particles N(z) who has property of z is defined by

where according to Equation (2) it must hold that

In this case, it is considered that property z has only positive value.

It is imposible even with nowadays most advanced computer facilities to produce continue number of particles in order of one mole, which equals to about 10 23 particles. In this report only small number of particles is considered. The distribution function is also simplified by dividing it into limited and discreet groups of particles. Within each group there is only one value (certain property of particle) which represents the group instead of a range of value from minimum to maximum value of the group.

Suppose that there is M groups of particles with equal width ∆z, which group the total number of particles N. First step is how to find z min and z max where at these values N(z) can be considered zero. Since we deal with particles than it is more simple to use the int() function which returns the integer value of N(z). It means that f (z) is considered zero when N(z) = 1 -ǫ, then

with ǫ a small defined value. Then width ∆z can be found through

Group i is represented by z i , which is

As it has been declared previously, in group i there is only one value of z which is z i . It is only for the sake of simplicity. Each group has number of particles that must obey the Gaussian distribution function. Number of particle in each group is

Since there is a round down process (throug the int() function) for each group in order to find N i from N(z i ) then it can be concluded that

a difference that deviates the discreet groups of particles from the Gaussian distribution function. The factor in front of right side of Equation ( 12) is due to discreet number of particle groups.

An algorithm of implementation of Equation ( 8) -( 12) can be summerized as follow

and when there are indistinguishable

The later means that particles at the same group are identical, which means the particles are identify only by their property z i .

The easiest way to buid the sequence is by lining the particle from each group in incremental order, such as

This sequence is named as the zeroth sequence.

The sequences beside zeroth sequence can be generated by permutating zeroth sequence. Number of sequences can be produced is according to Equation ( 14) and (15). In this report we propose a mechanism to generate a sequence from zeroth sequence by using random() and swap() function which is already built-in in C++. The algorithm is as follow

The sum of generated value of N i for each group i in a sequence will be less than total number of particle as given by Equation ( 13), which means an error. This error can be calculated using a common correlation coefficient

where

with N ′ is total number of generated particles

Equation ( 17) -( 21) will be used the next section to calculate the error in produced sequences.

An illustration for two discreet Gaussian distribution function is given in Figure 2, which is produced by our program gaussg. It has been found that the value N ′ shown in Equation ( 12) can not be used in the continue function to fit the discreet values. Then, the new fitting function will be

where

The correlation coefficient in Equation ( 17) is caculated using

Variation of number of particles N and number of groups M are also observed as illustrated in Figure 3 and Figure 4, respectively. It can be seen that larger N gives better R 2 and larger M gives bad R 2 . Number of groups should be more than or equal to N/M that the program gaussg can handled. The next results are the sequences that produced from N d (z i ) as shown in Figure 5. Only first four seeds are used to generate four sequences. These sequences has the same distribution function, which has µ = 0.5,, σ = 0.1, N = 100, and M = 10. These results are produced by program gausss.

Two programs, gaussg

📸 Image Gallery

cover.png

Reference

This content is AI-processed based on open access ArXiv data.

Start searching

Enter keywords to search articles

↑↓
ESC
⌘K Shortcut