update of file
This commit is contained in:
@@ -2,3 +2,7 @@ translating doconce text in Statistics.do.txt to ipynb
|
||||
Failed to remove ans_at_end environment
|
||||
Failed to remove sol_at_end environment
|
||||
output in Statistics.ipynb
|
||||
translating doconce text in Statistics.do.txt to ipynb
|
||||
Failed to remove ans_at_end environment
|
||||
Failed to remove sol_at_end environment
|
||||
output in Statistics.ipynb
|
||||
|
||||
@@ -1000,7 +1000,7 @@ print(Eigvals)
|
||||
!ec
|
||||
|
||||
|
||||
======= Random Numbers =======
|
||||
===== Random Numbers =====
|
||||
!bblock
|
||||
|
||||
Uniform deviates are just random numbers that lie within a specified range
|
||||
@@ -1017,7 +1017,7 @@ or Monte Carlo computer work.
|
||||
|
||||
|
||||
|
||||
======= Random Numbers, better name: pseudo random numbers =======
|
||||
===== Random Numbers, better name: pseudo random numbers =====
|
||||
!bblock
|
||||
|
||||
A disclaimer is however appropriate. It should be fairly obvious that
|
||||
@@ -1037,7 +1037,7 @@ numbers, hopefully abiding to the following criteria:
|
||||
|
||||
|
||||
|
||||
======= Random number generator RNG =======
|
||||
===== Random number generator RNG =====
|
||||
!bblock
|
||||
The most common random number generators are based on so-called
|
||||
Linear congruential relations of the type
|
||||
@@ -1064,7 +1064,7 @@ of the division $13/9$, namely $4$.
|
||||
!eblock
|
||||
|
||||
|
||||
======= Random number generator RNG and periodic outputs =======
|
||||
===== Random number generator RNG and periodic outputs =====
|
||||
!bblock
|
||||
|
||||
The problem with such generators is that their outputs are periodic;
|
||||
@@ -1094,7 +1094,7 @@ just $2$.
|
||||
!eblock
|
||||
|
||||
|
||||
======= Random number generator RNG and its period =======
|
||||
===== Random number generator RNG and its period =====
|
||||
!bblock
|
||||
Typical periods for the random generators provided in the program library
|
||||
are of the order of $\sim 10^9$ or larger. Other random number generators which have
|
||||
@@ -1112,7 +1112,7 @@ number is the sum of the $l-i$th and $l-j$th values with modulo $M$,
|
||||
!eblock
|
||||
|
||||
|
||||
======= Random number generator RNG, other examples =======
|
||||
===== Random number generator RNG, other examples =====
|
||||
!bblock
|
||||
Such a generator again produces a sequence of pseudorandom numbers
|
||||
but this time with a period much larger than $M$.
|
||||
@@ -1138,7 +1138,7 @@ which according to the authors has a period larger than $2^{94}$.
|
||||
!eblock
|
||||
|
||||
|
||||
======= Random number generator RNG, other examples =======
|
||||
===== Random number generator RNG, other examples =====
|
||||
!bblock
|
||||
Instead of using modular addition, we could use the bitwise
|
||||
exclusive-OR ($\oplus$) operation so that
|
||||
@@ -1162,7 +1162,7 @@ it is given by $m\wedge n$.
|
||||
|
||||
|
||||
|
||||
======= Random number generator RNG, RAN0 =======
|
||||
===== Random number generator RNG, RAN0 =====
|
||||
!bblock
|
||||
|
||||
We show here how the linear congruential algorithm can be implemented, namely
|
||||
@@ -1200,7 +1200,7 @@ $q$ and $r$ are chosen so that $r < q$.
|
||||
|
||||
|
||||
|
||||
======= Random number generator RNG, RAN0 =======
|
||||
===== Random number generator RNG, RAN0 =====
|
||||
!bblock
|
||||
|
||||
To see how this works we note first that
|
||||
@@ -1217,7 +1217,7 @@ $[N_{i-1}/q]$ just yields a constant which is multiplied with $M$.
|
||||
|
||||
|
||||
|
||||
======= Random number generator RNG, RAN0 =======
|
||||
===== Random number generator RNG, RAN0 =====
|
||||
!bblock
|
||||
We can now rewrite Eq. (ref{eq:rntrick1}) as
|
||||
|
||||
@@ -1247,7 +1247,7 @@ label{eq:rntrick4}
|
||||
|
||||
|
||||
|
||||
======= Random number generator RNG, RAN0 =======
|
||||
===== Random number generator RNG, RAN0 =====
|
||||
!bblock
|
||||
The term $[N_{i-1}/q]r$ is always smaller or equal $N_{i-1}(r/q)$ and with $r < q$ we obtain always a
|
||||
number smaller than $N_{i-1}$, which is smaller than $M$.
|
||||
@@ -1265,7 +1265,7 @@ set to $0$.
|
||||
|
||||
|
||||
|
||||
======= Random number generator RNG, RAN0 code =======
|
||||
===== Random number generator RNG, RAN0 code =====
|
||||
!bblock
|
||||
|
||||
!bc cppcod
|
||||
@@ -1552,7 +1552,7 @@ int main(int argc, char* argv[])
|
||||
|
||||
|
||||
|
||||
======= Which RNG should I use? =======
|
||||
===== Which RNG should I use? =====
|
||||
!bblock
|
||||
* C++ has a class called _random_. The "random class":"http://www.cplusplus.com/reference/random/" contains a large selection of RNGs and is highly recommended. Some of these RNGs have very large periods making it thereby very safe to use these RNGs in case one is performing large calculations. In particular, the "Mersenne twister random number engine":"http://www.cplusplus.com/reference/random/mersenne_twister_engine/" has a period of $2^{19937}$.
|
||||
* Add RNGs in Python
|
||||
|
||||
Reference in New Issue
Block a user