# A note on random number generation

Save this PDF as:

Size: px
Start display at page:

## Transcription

1 A note on random number generation Christophe Dutang and Diethelm Wuertz September

2 2 OVERVIEW OF RANDOM GENERATION ALGORITMS 2 Nothing in Nature is random... a thing appears random only through the incompleteness of our knowledge. Spinoza, Ethics I 1. 1 Introduction Random simulation has long been a very popular and well studied field of mathematics. There exists a wide range of applications in biology, finance, insurance, physics and many others. So simulations of random numbers are crucial. In this note, we describe the most random number algorithms Let us recall the only things, that are truly random, are the measurement of physical phenomena such as thermal noises of semiconductor chips or radioactive sources 2. The only way to simulate some randomness on computers are carried out by deterministic algorithms. Excluding true randomness 3, there are two kinds random generation: pseudo and quasi random number generators. The package randtoolbox provides R functions for pseudo and quasi random number generations, as well as statistical tests to quantify the quality of generated random numbers. 2 Overview of random generation algoritms In this section, we present first the pseudo random number generation and second the quasi random 1 quote taken from Niederreiter (1978). 2 for more details go to randomness/. 3 For true random number generation on R, use the random package of Eddelbuettel (2007). number generation. By random numbers, we mean random variates of the uniform U(0, 1) distribution. More complex distributions can be generated with uniform variates and rejection or inversion methods. Pseudo random number generation aims to seem random whereas quasi random number generation aims to be deterministic but well equidistributed. Those familiars with algorithms such as linear congruential generation, Mersenne-Twister type algorithms, and low discrepancy sequences should go directly to the next section. 2.1 Pseudo random generation At the beginning of the nineties, there was no state-of-the-art algorithms to generate pseudo random numbers. And the article of Park & Miller (1988) entitled Random generators: good ones are hard to find is a clear proof. Despite this fact, most users thought the rand function they used was good, because of a short period and a term to term dependence. But in 1998, Japenese mathematicians Matsumoto and Nishimura invents the first algorithm whose period ( ) exceeds the number of electron spin changes since the creation of the Universe ( against ). It was a big breakthrough. As described in L Ecuyer (1990), a (pseudo) random number generator (RNG) is defined by a structure (S, µ, f, U, g) where S a finite set of states, µ a probability distribution on S, called the initial distribution, a transition function f : S S, a finite set of output symbols U, an output function g : S U. Then the generation of random numbers is as follows: 1. generate the initial state (called the seed) s 0

3 2 OVERVIEW OF RANDOM GENERATION ALGORITMS 3 according to µ and compute u 0 = g(s 0 ), 2. iterate for i = 1,..., s i = f(s i 1 ) and u i = g(s i ). Generally, the seed s 0 is determined using the clock machine, and so the random variates u 0,..., u n,... seems real i.i.d. uniform random variates. The period of a RNG, a key characteristic, is the smallest integer p N, such that n N, s p+n = s n. Finally, we generally use one of the three types of output function: g : N [0, 1[, and g(x) = x m, g : N ]0, 1], and g(x) = x m 1, g : N ]0, 1[, and g(x) = x+1/2 m. Linear congruential generators are implemented in the R function congrurand Linear congruential generators There are many families of RNGs : linear congruential, multiple recursive,... and computer operation algorithms. Linear congruential generators have a transfer function of the following type f(x) = (ax + c) mod m 1, where a is the multiplier, c the increment and m the modulus and x, a, c, m N (i.e. S is the set of (positive) integers). f is such that x n = (ax n 1 + c) mod m. Typically, c and m are chosen to be relatively prime and a such that x N, ax mod m 0. The cycle length of linear congruential generators will never exceed modulus m, but can maximised with the three following conditions increment c is relatively prime to m, a 1 is a multiple of every prime dividing m, a 1 is a multiple of 4 when m is a multiple of 4, see Knuth (2002) for a proof. When c = 0, we have the special case of Park- Miller algorithm or Lehmer algorithm (see Park & Miller (1988)). Let us note that the n + jth term can be easily derived from the nth term with a puts to a j mod m (still when c = 0). 1 this representation could be easily generalized for matrix, see L Ecuyer (1990) Multiple recursive generators A generalisation of linear congruential generators are multiple recursive generators. They are based on the following recurrences x n = (a 1 x n a k x n k c) mod m, where k is a fixed integer. Hence the nth term of the sequence depends on the k previous one. A particular case of this type of generators is when x n = (x n 37 + x n 100 ) mod 2 30, which is a Fibonacci-lagged generator 2. The period is around This generator has been invented by Knuth (2002) and is generally called Knuth-TAOCP-2002 or simply Knuth- TAOCP 3. An integer version of this generator is implemented in the R function runif (see RNG). We include in the package the latest double version, which corrects undesirable deficiency. As described on Knuth s webpage 4, the previous version of Knuth-TAOCP fails randomness test if we generate few sequences with several seeds. The cures to this problem is to discard the first 2000 numbers. 2 see L Ecuyer (1990). 3 TAOCP stands for The Art Of Computer Programming, Knuth s famous book. 4 go to knuth/news02.html#rng.

4 2 OVERVIEW OF RANDOM GENERATION ALGORITMS Mersenne-Twister These two types of generators are in the big family of matrix linear congruential generators (cf. L Ecuyer (1990)). But until here, no algorithms exploit the binary structure of computers (i.e. use binary operations). In 1994, Matsumoto and Kurita invented the TT800 generator using binary operations. But Matsumoto & Nishimura (1998) greatly improved the use of binary operations and proposed a new random number generator called Mersenne-Twister. Matsumoto & Nishimura (1998) work on the finite set N 2 = {0, 1}, so a variable x is represented by a vectors of ω bits (e.g. 32 bits). They use the following linear recurrence for the n + ith term: x i+n = x i+m (x upp i x low i+1)a, where n > m are constant integers, x upp i (respectively x low i ) means the upper (lower) ω r (r) bits of x i and A a ω ω matrix of N 2. is the operator of concatenation, so x upp i x low i+1 appends the upper ω r bits of x i with the lower r bits of x i+1. After a right multiplication with the matrix A 1, adds the result with x i+m bit to bit modulo two (i.e. denotes the exclusive-or called xor). Once provided an initial seed x 0,..., x n 1, Mersenne Twister produces random integers in 0,..., 2 ω 1. All operations used in the recurrence are bitwise operations, thus it is a very fast computation compared to modulus operations used in previous algorithms. To increase the equidistribution, Matsumoto & Nishimura (1998) added a tempering step: y i x i+n (x i+n >> u), y i y i ((y i << s) b), y i y i ((y i << t) c), y i y i (y i >> l), ( ) 0 1 Iω 1 Matrix A equals to whose right multiplication can be done with a bitwise rightshift operation a and an addition with integer a. See the section 2 of Matsumoto & Nishimura (1998) for explanations. where >> u (resp. << s) denotes a rightshift (leftshift) of u (s) bits. At last, we transform random integers to reals with one of output functions g proposed above. Details of the order of the successive operations used in the Mersenne-Twister (MT) algorithm can be found at the page 7 of Matsumoto & Nishimura (1998). However, the least, we need to learn and to retain, is all these (bitwise) operations can be easily done in many computer languages (e.g in C) ensuring a very fast algorithm. The set of parameters used are (ω, n, m, r) = (32, 624, 397, 31), a = B0DF, b = 0 9D2C5680, c = 0 EF C60000, u = 11, l = 18, s = 7 and t = 15. These parameters ensure a good equidistribution and a period of 2 nω r 1 = The great advantages of the MT algorithm are a far longer period than any previous generators (greater than the period of Park & Miller (1988) sequence of or the period of Knuth (2002) around ), a far better equidistribution (since it passed the DieHard test) as well as an very good computation time (since it used binary operations and not the costly real operation modullus). MT algorithm is already implemented in R (function runif). However the package randtoolbox provide functions to compute a new version of Mersenne-Twister (the SIMDoriented Fast Mersenne Twister algorithm) as well as the WELL (Well Equidistributed Long-period Linear) generator.

5 2 OVERVIEW OF RANDOM GENERATION ALGORITMS Well Equidistributed Long-period Linear generators The MT recurrence can be rewritten as x i = Ax i 1, where x k are vectors of N 2 and A a transition matrix. The charateristic polynom of A is χ A (z) = det(a zi) = z k α 1 z k 1 α k 1 z α k, with coefficients α k s in N 2. Those coefficients are linked with output integers by x i,j = (α 1 x i 1,j + + α k x i k,j ) mod 2 for all component j. From Panneton et al. (2006), we have the period length of the recurrence reaches the upper bound 2 k 1 if and only if the polynom χ A is a primitive polynomial over N 2. The more complex is the matrix A the slower will be the associated generator. Thus, we compromise between speed and quality (of equidistribution). If we denote by ψ d the set of all d-dimensional vectors produced by the generator from all initial states 1. If we divide each dimension into 2 l2 cells (i.e. the unit hypercube [0, 1[ d is divided into 2 ld cells), the set ψ d is said to be (d, l)-equidistributed if and only if each cell contains exactly 2 k dl of its points. The largest dimension for which the set ψ d is (d, l)-equidistributed is denoted by d l. The great advantage of using this definition is we are not forced to compute random points to know the uniformity of a generator. Indeed, thanks to the linear structure of the recurrence we can express the property of bits of the current state. From this we define a dimension gap for l bits resolution as δ l = k/l d l. 1 The cardinality of ψ d is 2 k. 2 with l an integer such that l k/d. An usual measure of uniformity is the sum of dimension gaps 1 = ω δ l. l=1 Panneton et al. (2006) tries to find generators with a dimension gap sum 1 around zero and a number Z 1 of non-zero coefficients in χ A around k/2. Generators with these two characteristics are called Well Equidistributed Long-period Linear generators. As a benchmark, Mersenne Twister algorithm is characterized with k = 19937, 1 = 6750 and Z 1 = 135. The WELL generator is characterized by the following A matrix T 5,7, T I ,... I 0 0 L 0 where T. are specific matrices, I the identity matrix and L has ones on its top left corner. The first two lines are not entirely sparse but fill with T. matrices. All T. s matrices are here to change the state in a very efficient way, while the subdiagonal (nearly full of ones) is used to shift the unmodified part of the current state to the next one. See Panneton et al. (2006) for details. The MT generator can be obtained with special values of T. s matrices. Panneton et al. (2006) proposes a set of parameters, where they computed dimension gap number 1. The full table can be found in Panneton et al. (2006), we only sum up parameters for those implemented in this package in table 1. Let us note that for the last two generators a tempering step is possible in order to have maximally equidistributed generator (i.e. (d, l)- equidistributed for all d and l). These generators are implemented in this package thanks to the C code of L Ecuyer and Panneton.

6 2 OVERVIEW OF RANDOM GENERATION ALGORITMS 6 name k N 1 1 WELL512a WELL1024a WELL19937a WELL44497a Table 1: Specific WELL generators SIMD-oriented Fast Mersenne Twister algorithms A decade after the invention of MT, Matsumoto & Saito (2008) enhances their algorithm with the computer of today, which have Single Instruction Mutiple Data operations letting to work conceptually with 128 bits integers. MT and its successor are part of the family of multiple-recursive matrix generators since they verify a multiple recursive equation with matrix constants. For MT, we have the following recurrence x k+n = ( ) ( ) Iω r x k A x 0 0 k+1 A x 0 I k+m. r } {{ } h(x k,x k+1,...,x m,...,x k+n 1 ) for the k + nth term. Thus the MT recursion is entirely characterized by h(ω 0,..., ω n 1 ) = (ω 0 ω 1 )A ω m, where ω i denotes the ith word integer (i.e. horizontal vectors of N 2 ). The general recurrence for the SFMT algorithm extends MT recursion to h(ω 0,..., ω n 1 ) = ω 0 A ω m B ω n 2 C ω n 1 D, where A, B, C, D are sparse matrices over N 2, ω i are 128-bit integers and the degree of recursion is n = = 156. The matrices A, B, C and D for a word w are defined as follows, ( wa = wb = ) << 8 w 128 ( w 32 >> 11 w, ) c, where c is a 128-bit constant and the bitwise AND operator, wc = w >> 128 8, wd = w << 32 18, where << 128 denotes a 128-bit operation while >> 32 a 32-bit operation, i.e. an operation on the four 32-bit parts of 128-bit word w. Hence the transition function of SFMT is given by f : (N ω 2 ) n (N ω 2 ) n (ω 0,..., ω n 1 ) (ω 1,..., ω n 1, h(ω 0,..., ω n 1 )), where (N ω 2 )n is the state space. The selection of recursion and parameters was carried out to find a good dimension of equidistribution for a given a period. This step is done by studying the characteristic polynomial of f. SFMT allow periods of 2 p 1 with p a (prime) Mersenne exponent 1. Matsumoto & Saito (2008) proposes the following set of exponents 607, 1279, 2281, 4253, 11213, 19937, 44497, 86243, and The advantage of SFMT over MT is the computation speed, SFMT is twice faster without SIMD operations and nearly fourt times faster with SIMD operations. SFMT has also a better equidistribution 2 and a better recovery time from zeros-excess states 3. The function SFMT provides an interface to the C code of Matsumoto and Saito. 1 a Mersenne exponent is a prime number p such that 2 p 1 is prime. Prime numbers of the form 2 p 1 have the special designation Mersenne numbers. 2 See linear algebra arguments of Matsumoto & Nishimura (1998). 3 states with too many zeros.

7 2 OVERVIEW OF RANDOM GENERATION ALGORITMS Quasi random generation Before explaining and detailing quasi random generation, we must (quickly) explain Monte- Carlo 1 methods, which have been introduced in the forties. In this section, we follow the approach of Niederreiter (1978). Let us work on the d-dimensional unit cube I d = [0, 1] d and with a (multivariate) bounded (Lebesgues) integrable function f on I d. Then we define the Monte Carlo approximation of integral of f over I d by f(x)dx 1 n f(x i ), I d n i=1 where (X i ) 1 i n are independent random points from I d. The strong law of large numbers ensures the almost surely convergence of the approximation. Furthermore, the expected integration error is bounded by O( 1 n ), with the interesting fact it does not depend on dimension d. Thus Monte Carlo methods have a wide range of applications. The main difference between (pseudo) Monte- Carlo methods and quasi Monte-Carlo methods is that we no longer use random points (x i ) 1 i n but deterministic points. Unlike statistical tests, numerical integration does not rely on true randomness. Let us note that quasi Monte- Carlo methods date from the fifties, and have also been used for interpolation problems and integral equations solving. In the following, we consider a sequence Furthermore the convergence condition on the sequence (u i ) i is to be uniformly distributed in the unit cube I d with the following sense: J I d 1 n, lim 1 J (u i ) = λ d (J), n + n i=1 where λ d stands for the d-dimensional volume (i.e. the d-dimensional Lebesgue measure) and 1 J the 1 according to wikipedia the name comes from a famous casino in Monaco. indicator function of subset J. The problem is that our discrete sequence will never constitute a fair distribution in I d, since there will always be a small subset with no points. Therefore, we need to consider a more flexible definition of uniform distribution of a sequence. Before introducing the discrepancy, we need to define Card E (u 1,..., u n ) as n i=1 1 E (u i ) the number of points in subset E. Then the discrepancy D n of the n points (u i ) 1 i n in I d is given by D n = sup J J Card J (u 1,..., u n ) n λ d (J) where J denotes the family of all subintervals of I d of the form d i=1 [a i, b i ]. If we took the family of all subintervals of I d of the form d i=1 [0, b i], D n is called the star discrepancy (cf. Niederreiter (1992)). Let us note that the D n discrepancy is nothing else than the L -norm over the unit cube of the difference between the empirical ratio of points (u i ) 1 i n in a subset J and the theoretical point number in J. A L 2 -norm can be defined as well, see Niederreiter (1992) or Jäckel (2002). The integral error is bounded by 1 n n i=1 f(u i ) f(x)dx I d V d(f)d n, where V d (f) is the d-dimensional Hardy and Krause variation 2 of f on I d (supposed to be finite). Actually the integral error bound is the product of two independent quantities: the variability of function f through V d (f) and the regularity of the sequence through D n. So, we want to minimize the discrepancy D n since we generally do not have a choice in the problem function f. 2 Interested readers can find the definition page 966 of Niederreiter (1978). In a sentence, the Hardy and Krause variation of f is the supremum of sums of d-dimensional delta operators applied to function f.

8 2 OVERVIEW OF RANDOM GENERATION ALGORITMS 8 We will not explain it but this concept can be extented to subset J of the unit cube I d in order to have a similar bound for J f(x)dx. for D n : ( ) log log n D n = O. n In the literature, there were many ways to find sequences with small discrepancy, generally called low-discrepancy sequences or quasi-random points. A first approach tries to find bounds for these sequences and to search the good parameters to reach the lower bound or to decrease the upper bound. Another school tries to exploit regularity of function f to decrease the discrepancy. Sequences coming from the first school are called quasi-random points while those of the second school are called good lattice points Quasi-random points and discrepancy Until here, we do not give any example of quasirandom points. In the unidimensional case, an easy example of quasi-random points is the sequence of n terms given by ( 1 2n, 3 2n,..., 2n 1 2n ). This sequence has a discrepancy 1 n, see Niederreiter (1978) for details. The problem with this finite sequence is it depends on n. And if we want different points numbers, we need to recompute the whole sequence. In the following, we will on work the first n points of an infinite sequence in order to use previous computation if we increase n. Moreover we introduce the notion of discrepancy on a finite sequence (u i ) 1 i n. In the above example, we are able to calculate exactly the discrepancy. With infinite sequence, this is no longer possible. Thus, we will only try to estimate asymptotic equivalents of discrepancy. The discrepancy of the average sequence of points is governed by the law of the iterated logarithm : ndn lim sup = 1, n + log log n which leads to the following asymptotic equivalent Van der Corput sequences An example of quasi-random points, which have a low discrepancy, is the (unidimensional) Van der Corput sequences. Let p be a prime number. Every integer n can be decomposed in the p basis, i.e. there exists some integer k such that n = k a j p j. j=1 Then, we can define the radical-inverse function of integer n as φ p (n) = k j=1 a j p j+1. And finally, the Van der Corput sequence is given by (φ p (0), φ p (1),..., φ p (n),... ) [0, 1[. First terms of those sequence for prime numbers 2 and 3 are given in table 2. n in p-basis φ p (n) n p = 2 p = 3 p = 5 p = 2 p = 3 p = Table 2: Van der Corput first terms The big advantage of Van der Corput sequence is that they use p-adic fractions easily computable on the binary structure of computers.

9 2 OVERVIEW OF RANDOM GENERATION ALGORITMS Halton sequences The d-dimensional version of the Van der Corput sequence is known as the Halton sequence. The nth term of the sequence is define as (φ p1 (n),..., φ pd (n)) I d, where p 1,..., p d are pairwise relatively prime bases. The discrepancy ( of) the Halton sequence is asymptotically O log(n) d. n The following Halton theorem gives us better discrepancy estimate of finite sequences. For any dimension d 1, there exists an finite sequence of points in I d such that the discrepancy ( ) log(n) d 1 D n = O 1. n Therefore, we have a significant guarantee there exists quasi-random points which are outperforming than traditional Monte-Carlo methods Faure sequences The Faure sequences is also based on the decomposition of integers into prime-basis but they have two differences: it uses only one prime number for basis and it permutes vector elements from one dimension to another. The basis prime number is chosen as the smallest prime number greater than the dimension d, i.e. 3 when d = 2, 5 when d = 3 or 4 etc... In the Van der Corput sequence, we decompose integer n into the p-basis: k n = a j p j. j=1 Let a 1,j be integer a j used for the decomposition of n. Now we define a recursive permutation of a j : (1978). 2 D d, a D,j = k Cja i D 1,j mod p, j=i 1 if the sequence has at least two points, cf. Niederreiter where C i j denotes standard combination j! i!(j i)!. Then we take the radical-inversion φ p (a D,1,..., a D,k ) defined as φ p (a 1,..., a k ) = k j=1 a j p j+1, which is the same as above for n defined by the a D,i s. Finally the (d-dimensional) Faure sequence is defined by (φ p (a 1,1,..., a 1,k ),..., φ p (a d,1,..., a d,k )) I d. In the bidimensional case, we work in 3-basis, first terms of the sequence are listed in table 3. n a 13 a 12 a 2 11 a 23 a 22 a 21 φ(a 13..) φ(a 23..) /3 1/ /3 2/ /9 7/ /9 1/ /9 4/ /9 5/ /9 8/ /9 2/ /27 1/ /27 10/ /27 19/ /27 22/ /27 4/ /27 12/27 Table 3: Faure first terms Sobol sequences This sub-section is taken from unpublished work of Diethelm Wuertz. The Sobol sequence x n = (x n,1,..., x n,d ) is generated from a set of binary functions of length ω bits (v i,j with i = 1,..., ω and j = 2 we omit commas for simplicity.

10 2 OVERVIEW OF RANDOM GENERATION ALGORITMS 10 1,..., d). v i,j, generally called direction numbers are numbers related to primitive (irreducible) polynomials over the field {0, 1}. In order to generate the jth dimension, we suppose that the primitive polynomial in dimension j is p j (x) = x q + a 1 x q a q 1 x + 1. Then we define the following q-term recurrence relation on integers (M i,j ) i M i,j = 2a 1 M i 1,j 2 2 a 2 M i 2,j... 2 q 1 a q 1 M i q+1,j 2 q a q M i q,j M i q where i > q. This allow to compute direction numbers as v i,j = M i,j /2 i. This recurrence is initialized by the set of arbitrary odd integers v 1,j 2 ω,..., v,j 2 q ω, which are smaller than 2,..., 2 q respectively. Finally the jth dimension of the nth term of the Sobol sequence is with x n,j = b 1 v 1,j b 2 v 2,j v ω,j, where b k s are the bits of integer n = ω 1 k=0 b k2 k. The requirement is to use a different primitive polynomial in each dimension. An e?cient variant to implement the generation of Sobol sequences was proposed by Antonov & Saleev (1979). The use of this approach is demonstrated in Bratley & Fox (1988) and Press et al. (1996) Scrambled Sobol sequences Randomized QMC methods are the basis for error estimation. A generic recipe is the following: Let A 1,..., A n be a QMC point set and X i a scrambled version of A i. Then we are searching for randomizations which have the following properties: Uniformity: The X i makes the approximator Î = 1 N N i=1 f(x i) an unbiased estimate of I = [0,1] d f(x)dx. Equidistribution: The X i form a point set with probability 1; i.e. the random- ization process has preserved whatever special properties the underlying point set had. The Sobol sequences can be scrambled by the Owen s type of scrambling, by the Faure-Tezuka type of scrambling, and by a combination of both. The program we have interfaced to R is based on the ACM Algorithm 659 described by Bratley & Fox (1988) and Bratley et al. (1992). Modifications by Hong & Hickernell (2001) allow for a randomization of the sequences. Furthermore, in the case of the Sobol sequence we followed the implementation of Joe & Kuo (1999) which can handle up to 1111 dimensions. To interface the Fortran routines to the R environment some modifications had to be performed. One important point was to make possible to re-initialize a sequence and to recall a sequence without renitialization from R. This required to remove BLOCKDATA, COMMON and SAVE statements from the original code and to pass the initialization variables through the argument lists of the subroutines, so that these variables can be accessed from R Kronecker sequences Another kind of low-discrepancy sequence uses irrational number and fractional part. The fractional part of a real x is denoted by {x} = x x. The infinite sequence (n{α}) n 0 has a bound for its discrepancy D n C 1 + log n. n This family of infinite sequence (n{α}) n 0 is called the Kronecker sequence. A special case of the Kronecker sequence is the Torus algorithm where irrational number α is a square root of a prime number. The nth term of the d-dimensional Torus algorithm is defined by (n{ p 1 },..., n{ p d }) I d,

11 3 EXAMPLES OF DISTINGUISHING FROM TRULY RANDOM NUMBERS 11 where (p 1,..., p d ) are prime numbers, generally the first d prime numbers. With the previous inequality, we can derive an estimate of the Torus algorithm discrepancy: ( ) 1 + log n O. n Mixed pseudo quasi random sequences Sometimes we want to use quasi-random sequences as pseudo random ones, i.e. we want to keep the good equidistribution of quasi-random points but without the term-to-term dependence. One way to solve this problem is to use pseudo random generation to mix outputs of a quasirandom sequence. For example in the case of the Torus sequence, we have repeat for 1 i n draw an integer n i from Mersenne-Twister in {0,..., 2 ω 1} then u i = {n i p} Good lattice points In the above methods we do not take into account a better regularity of the integrand function f than to be of bounded variation in the sense of Hardy and Krause. Good lattice point sequences try to use the eventual better regularity of f. If f is 1-periodic for each variable, then the approximation with good lattice points is I d f(x)dx 1 n n f i=1 ( ) i n g, where g Z d is suitable d-dimensional lattice point. To impose f to be 1-periodic may seem too brutal. But there exists a method to transform f into a 1-periodic function while preserving regularity and value of the integrand (see Niederreiter 1978, page 983). We have the following theorem for good lattice points. For every dimension d 2 and integer n 2, there exists a lattice points g Z d which coordinates relatively prime to n such that the discrepancy D n of points { 1 n g},..., { n ng} satisfies D s < d n + 1 ( ) 7 d 2n log m. Numerous studies of good lattice points try to find point g which minimizes the discrepancy. ( Korobov test g of the following form 1, m,..., m d 1 ) with m N. Bahvalov tries Fibonnaci numbers (F 1,..., F d ). Other studies look directly for ) the point α = g n (p e.g. α = 1 d d+1,..., p d+1 or some cosinus functions. We let interested readers to look for detailed information in Niederreiter (1978). 3 Examples of distinguishing from truly random numbers For a good generator, it is not computationally easy to distinguish the output of the generator from truly random numbers, if the seed or the index in the sequence is not known. In this section, we present examples of generators, whose output may be easily distinguished from truly random numbers. An example of such a generator is the older version of Wichmann-Hill from For this generator, we can even predict the next number in the sequence, if we know the last already generated one. Verifying such a predicition is easy and it is, of course, not valid for truly random numbers. Hence, we can easily distinguish the output of the generator from truly random numbers. An implementation of this test in R derived from McCullough (2008) is as follows. > wh.predict <- function(x) + { + M1 <

12 4 DESCRIPTION OF THE RANDOM GENERATION FUNCTIONS 12 + M2 < M3 < y <- round(m1*m2*m3*x) + s1 <- y %% M1 + s2 <- y %% M2 + s3 <- y %% M3 + s1 <- (171*26478*s1) %% M1 + s2 <- (172*26070*s2) %% M2 + s3 <- (170*8037*s3) %% M3 + (s1/m1 + s2/m2 + s3/m3) %% 1 + } > RNGkind("Wichmann-Hill") > xnew <- runif(1) > maxerr <- 0 > for (i in 1:1000) { + xold <- xnew + xnew <- runif(1) + err <- abs(wh.predict(xold) - xnew) + maxerr <- max(err, maxerr) + } > print(maxerr) [1] 0 The printed error is 0 on some machines and less than on other machines. This is clearly different from the error obtained for truly random numbers, which is close to 1. The requirement that the output of a random number generator should not be distinguishable from the truly random numbers by a simple computation, is directly related to the way, how a generator is used. Typically, we use the generated numbers as an input to a computation and we expect that the distribution of the output (for different seeds or for different starting indices in the sequence) is the same as if the input are truly random numbers. A failure of this assumption implies, besides of a wrong result of our simulation, that observing the output of the computation allows to distinguish the output from the generator from truly random numbers. Hence, we want to use a generator, for which we may expect that the calculations used in the intended application cannot distinguish its output from truly random numbers. In this context, it has to be noted that many of the currently used generators for simulations can be distinguished from truly random numbers using the arithmetic mod 2 (XOR operation) applied to individual bits of the output numbers. This is true for Mersenne Twister, SFMT and also all WELL generators. The basis for tolerating this is based on two facts. First, the arithmetic mod 2 and extracting individual bits of real numbers is not directly used in typical simulation problems and real valued functions, which represent these operations, are extremely discontinuous and such functions also do not typically occur in simulation problems. Another reason is that we need to observe quite a long history of the output to detect the difference from true randomness. For example, for Mersenne Twister, we need 624 consecutive numbers. On the other hand, if we use a cryptographically strong pseudorandom number generator, we may avoid distinguishing from truly random numbers under any known efficient procedure. Such generators are typically slower than Mersenne Twister type generators. The factor of slow down is, for example for AES, about 5. However, note that for simulation problems, which require intensive computation besides the generating random numbers, using slower, but better, generator implies only negligible slow down of the computation as a whole. 4 Description of the random generation functions In this section, we detail the R functions implemented in randtoolbox and give examples. 4.1 Pseudo random generation For pseudo random generation, R provides many algorithms through the function runif parametrized with.random.seed. We encourage readers to look in the corresponding help

13 4 DESCRIPTION OF THE RANDOM GENERATION FUNCTIONS 13 pages for examples and usage of those functions. Let us just say runif use the Mersenne-Twister algorithm by default and other generators such as Wichmann-Hill, Marsaglia-Multicarry or Knuth- TAOCP congrurand The randtoolbox package provides two pseudorandom generators functions : congrurand and SFMT. congrurand computes linear congruential generators, see sub-section By default, it computes the Park & Miller (1988) sequence, so it needs only the observation number argument. If we want to generate 10 random numbers, we type > congrurand(10) [1] [4] [7] [10] One will quickly note that two calls to congrurand will not produce the same output. This is due to the fact that we use the machine time to initiate the sequence at each call. But the user can set the seed with the function setseed: > setseed(1) > congrurand(10) [1] e e-01 [3] e e-01 [5] e e-01 [7] e e-01 [9] e e-01 One can follow the evolution of the nth integer generated with the option echo=true. 1 see Wichmann & Hill (1982), Marsaglia (1994) and Knuth (2002) for details. > setseed(1) > congrurand(10, echo=true) 1 th integer generated : 1 2 th integer generated : th integer generated : th integer generated : th integer generated : th integer generated : th integer generated : th integer generated : th integer generated : th integer generated : [1] e e-01 [3] e e-01 [5] e e-01 [7] e e-01 [9] e e-01 We can check that those integers are the 10 first terms are listed in table 4, coming from http: // n x n n x n Table 4: 10 first integers of Park & Miller (1988) sequence We can also check around the 10000th term. From the site au/dsp/rand31/, we know that 9998th to 10002th terms of the Park-Miller sequence are , , , , The congrurand generates > setseed( ) > congrurand(5, echo=true) 1 th integer generated : th integer generated :

14 4 DESCRIPTION OF THE RANDOM GENERATION FUNCTIONS 14 3 th integer generated : th integer generated : th integer generated : [1] [4] with being the 9997th term of Park- Miller sequence. make comparisons with other algorithms. The Park-Miller RNG should not be viewed as a good random generator. Finally, congrurand function has a dim argument to generate dim- dimensional vectors of random numbers. The nth vector is build with d consecutive numbers of the RNG sequence (i.e. the nth term is the (u n+1,..., u n+d )). However, we are not limited to the Park- Miller sequence. If we change the modulus, the increment and the multiplier, we get other random sequences. For example, 1 th integer generated : 12 2 th integer generated : 60 3 th integer generated : th integer generated : 28 5 th integer generated : 204 [1] [4] Those values are correct according to Planchet et al. 2005, page SFMT The SF- Mersenne Twister algorithm is described in sub-section Usage of SFMT function implementing the SF-Mersenne Twister algorithm > setseed(12) > congrurand(5, mod = 2ˆ8, mult = 25, incr is= the 16, same. echo= First TRUE) argument n is the number of random variates, second argument dim the dimension. > SFMT(10) > SFMT(5, 2) #bi dimensional variates [1] [4] [7] [10] Here is a example list of RNGs computable with congrurand: RNG mod mult incr Knuth - Lewis e9 1 Lavaux - Jenssens Haynes e Marsaglia Park - Miller Table 5: some linear RNGs One may wonder why we implement such a short-period algorithm since we know the Mersenne-Twister algorithm. It is provided to [,1] [,2] [1,] [2,] [3,] [4,] [5,] A third argument is mexp for Mersenne exponent with possible values (607, 1279, 2281, 4253, 11213, 19937, 44497, 86243, and ). Below an example with a period of : > SFMT(10, mexp = 607) [1] [4]

15 4 DESCRIPTION OF THE RANDOM GENERATION FUNCTIONS 15 [7] [10] Furthermore, following the advice of Matsumoto & Saito (2008) for each exponent below 19937, SFMT uses a different set of parameters 1 in order to increase the independence of random generated variates between two calls. Otherwise (for greater exponent than 19937) we use one set of parameters 2. We must precise that we do not implement the SFMT algorithm, we just use the C code of Matsumoto & Saito (2008). For the moment, we do not fully use the strength of their code. For example, we do not use block generation and SSE2 SIMD operations. 4.2 Quasi-random generation Halton sequences The function halton implements both the Van Der Corput (unidimensional) and Halton sequences. The usage is similar to pseudo-rng functions [6,] [7,] [8,] [9,] [10,] You can use the init argument set to FALSE (default is TRUE) if you want that two calls to halton functions do not produce the same sequence (but the second call continues the sequence from the first call. > halton(5) > halton(5, init=false) [1] [1] init argument is also available for other quasi- RNG functions Sobol sequences > halton(10) > halton(10, 2) [1] [6] [,1] [,2] [1,] [2,] [3,] [4,] [5,] this can be avoided with usepset argument to FALSE. 2 These parameter sets can be found in the C function initsfmt in SFMT.c source file. The function sobol implements the Sobol sequences with optional sampling (Owen, Faure- Tezuka or both type of sampling). This subsection also comes from an unpublished work of Diethelm Wuertz. To use the different scrambling option, you just to use the scrambling argument: 0 for (the default) no scrambling, 1 for Owen, 2 for Faure- Tezuka and 3 for both types of scrambling. > sobol(10) > sobol(10, scramb=3) [1] [6]

16 4 DESCRIPTION OF THE RANDOM GENERATION FUNCTIONS 16 [1] [4] [7] [10] It is easier to see the impact of scrambling by plotting two-dimensional sequence in the unit square. Below we plot the default Sobol sequence and Sobol scrambled by Owen algorithm, see figure 1. > par(mfrow = c(2,1)) > plot(sobol(1000, 2)) > plot(sobol(10ˆ3, 2, scram=1)) Faure sequences In a near future, randtoolbox package will have an implementation of Faure sequences. For the moment, there is no function faure Torus algorithm (or Kronecker sequence) The function torus implements the Torus algorithm. > torus(10) [1] [4] [7] [10] These numbers are fractional parts of 2, 2 2, 3 2,..., see sub-section for details. > torus(5, use =TRUE) Sobol (no scrambling) u v Sobol (Owen) u v Figure 1: Sobol (two sampling types) [1] [4] The optional argument usetime can be used to the machine time or not to initiate the seed. If we do not use the machine time, two calls of torus produces obviously the same output.

17 4 DESCRIPTION OF THE RANDOM GENERATION FUNCTIONS 17 If we want the random sequence with prime number 7, we just type: Series torus(10^5) > torus(5, p =7) [1] [4] The dim argument is exactly the same as congrurand or SFMT. By default, we use the first prime numbers, e.g. 2, 3 and 5 for a call like torus(10, 3). But the user can specify a set of prime numbers, e.g. torus(10, 3, c(7, 11, 13)). The dimension argument is limited to ACF Lag Series torus(10^5, mix = TRUE) As described in sub-section 2.2.8, one way to deal with serial dependence is to mix the Torus algorithm with a pseudo random generator. The torus function offers this operation thanks to argument mixed (the Torus algorithm is mixed with SFMT). ACF > torus(5, mixed =TRUE) Lag [1] [4] Figure 2: Auto-correlograms In order to see the difference between, we can plot the empirical autocorrelation function (acf in R), see figure 2. > par(mfrow = c(2,1)) > acf(torus(10ˆ5)) > acf(torus(10ˆ5, mix=true)) First we compare SFMT algorithm with Torus algorithm on figure 3. > par(mfrow = c(2,1)) > plot(sfmt(1000, 2)) > plot(torus(10ˆ3, 2)) 4.3 Visual comparisons To understand the difference between pseudo and quasi RNGs, we can make visual comparisons of how random numbers fill the unit square. 1 the first prime numbers are take from http: //primes.utm.edu/lists/small/millions/. Secondly we compare WELL generator with Faure-Tezuka-scrambled Sobol sequences on figure 4. > par(mfrow = c(2,1)) > plot(well(1000, 2)) > plot(sobol(10ˆ3, 2, scram=2))

18 4 DESCRIPTION OF THE RANDOM GENERATION FUNCTIONS SFMT u v Torus u v Figure 3: SFMT vs. Torus algorithm 4.4 Applications of QMC methods d dimensional integration Now we will show how to use low-discrepancy sequences to compute a d-dimensional integral WELL 512a u v Sobol (Faure Tezuka) u v Figure 4: WELL vs. Sobol defined on the unit hypercube. We want compute I cos (d) = R d cos( x )e x 2 dx πd/2 n n i=1 cos d j=1 (Φ 1 ) 2 (t ij )

19 4 DESCRIPTION OF THE RANDOM GENERATION FUNCTIONS 19 where Φ 1 denotes the quantile function of the standard normal distribution. We simply use the following code to compute the I cos (25) integral whose exact value is a vanilla European call in the framework of a geometric Brownian motion for the underlying asset. Those options are already implemented in the package foptions of Rmetrics bundle 1. The payoff of this classical option is > I25 < > nb <- c(1200, 14500, ) > ans <- NULL > for(i in 1:3) + { + tij <- sobol(nb[i], dim=25, scramb=2, norm=true ) is quite simple + Icos <- mean(cos(sqrt( apply( tijˆ2/2, 1, sum ) ))) * piˆ(25/2) + ans <- rbind(ans, c(n=nb[i], I25=Icos, Delta=(Icos-I25)/I25 )) + } > data.frame(ans) n I25 Delta e e e-06 The results obtained from the Sobol Monte Carlo method in comparison to those obtained by Papageorgiou & Traub (2000) with a generalized Faure sequence and in comparison with the quadrature rules of Namee & Stenger (1967), Genz (1982) and Patterson (1968) are listed in the following table. n Faure (P&T) Sobol (s=0) s= s= s= Quadrature (McN&S) G&P f(s T ) = (S T K) +, where K is the strike price. A closed formula for this call was derived by Black & Scholes (1973). The Monte Carlo method to price this option 1. simulate s T,i for i = 1... n from starting point s 0, 2. compute the mean of the discounted payoff 1 n n i=1 e rt (s T,i K) +. With parameters (S 0 = 100, T = 1, r = 5%, K = 60, σ = 20%), we plot the relative error as a function of number of simulation n on figure 5. We test two pseudo-random generators (namely Park Miller and SF-Mersenne Twister) and one quasi-random generator (Torus algorithm). No code will be shown, see the file qmc.r in the package source. But we use a step-by-step simulation for the Brownian motion simulation and the inversion function method for Gaussian distribution simulation (default in R). As showed on figure 5, the convergence of Monte Carlo price for the Torus algorithm is extremely fast. Whereas for SF-Mersenne Twister and Park Miller prices, the convergence is very slow. Table 6: list of errors Pricing of a Vanilla Call In this sub-section, we will present one financial application of QMC methods. We want to price Pricing of a DOC Now, we want to price a barrier option: a down-out call i.e. an Downward knock-out 1 created by Wuertz et al. (2007b).

20 4 DESCRIPTION OF THE RANDOM GENERATION FUNCTIONS 20 relative error Vanilla Call 0e+00 2e+04 4e+04 6e+04 8e+04 1e+05 simulation number SFMT Torus Park Miller zero 3. compute the mean of the discounted payoff 1 n n i=1 e rt (s T,i K) + D i, where n is the simulation number, d the point number for the grid of time and D i the opposite of boolean D i. In the following, we set T = 1, r = 5%, s t0 = 100, H = K = 50, d = 250 and σ = 20%. We test crude Monte Carlo methods with Park Miller and SF-Mersenne Twister generators and a quasi- Monte Carlo method with (multidimensional) Torus algoritm on the figure 6. Figure 5: Error function for Vanilla call Down Out Call Call 1. These kind of options belongs to the pathdependent option family, i.e. we need to simulate whole trajectories of the underlying asset S on [0, T ]. In the same framework of a geometric Brownian motion, there exists a closed formula for DOCs (see Rubinstein & Reiner (1991)). Those options are already implemented in the package fexoticoptions of Rmetrics bundle 2. relative error e+00 2e+04 4e+04 6e+04 8e+04 1e+05 simulation number SFMT Torus Park Miller zero The payoff of a DOC option is f(s T ) = (S T K) + 1 (τh >T ), where K is the strike price, T the maturity, τ H the stopping time associated with the barrier H and S t the underlying asset at time t. As the price is needed on the whole period [0, T ], we produc as follows: 1. start from point s t0, 2. for simulation i = 1... n and time index j = 1... d simulate s tj,i, update disactivation boolean D i 1 DOC is disactived when the underlying asset hits the barrier. 2 created by Wuertz et al. (2007a). Figure 6: Error function for Down Out Call One may wonder why the Torus algorithm is still the best (on this example). We use the d- dimensional Torus sequence. Thus for time t j, the simulated underlying assets (s tj,i) i are computed with the sequence (i{ p j }) i. Thanks to the linear independence of the Torus sequence over the rationals 3, we guarantee a non-correlation of Torus quasi-random numbers. However, these results do not prove the Torus algorithm is always better than traditional Monte Carlo. The results are sensitive to the barrier level H, the strike price X (being in or out the money has a strong impact), the asset volatility σ and the time point number d. 3 i.e. for k j, i, (i{ p j}) i and (i{ p k }) i are linearly independent over Q.

### A note on random number generation

A note on random number generation Christophe Dutang and Diethelm Wuertz September 2009 1 2 OVERVIEW OF RANDOM GENERATION ALGORITMS 2 Nothing in Nature is random... a thing appears random only through

### Quick introduction of randtoolbox

Quick introduction of randtoolbox Christophe Dutang and Petr Savicky September 2009 1 2 Random simulation or Monte-Carlo methods rely on the fact we have access to random numbers. Even if nowadays having

### General Principles in Random Variates Generation

General Principles in Random Variates Generation E. Moulines Ecole Nationale Supérieure des Télécommunications 20 mai 2007 Why use random numbers? Random numbers lie at the heart of many scientific and

### 2WB05 Simulation Lecture 5: Random-number generators

2WB05 Simulation Lecture 5: Random-number generators Marko Boon http://www.win.tue.nl/courses/2wb05 December 6, 2012 Random-number generators It is important to be able to efficiently generate independent

### Monte Carlo Methods in Finance

Author: Yiyang Yang Advisor: Pr. Xiaolin Li, Pr. Zari Rachev Department of Applied Mathematics and Statistics State University of New York at Stony Brook October 2, 2012 Outline Introduction 1 Introduction

### CHAPTER 5. Number Theory. 1. Integers and Division. Discussion

CHAPTER 5 Number Theory 1. Integers and Division 1.1. Divisibility. Definition 1.1.1. Given two integers a and b we say a divides b if there is an integer c such that b = ac. If a divides b, we write a

### Introduction to Monte-Carlo Methods

Introduction to Monte-Carlo Methods Bernard Lapeyre Halmstad January 2007 Monte-Carlo methods are extensively used in financial institutions to compute European options prices to evaluate sensitivities

### LOGNORMAL MODEL FOR STOCK PRICES

LOGNORMAL MODEL FOR STOCK PRICES MICHAEL J. SHARPE MATHEMATICS DEPARTMENT, UCSD 1. INTRODUCTION What follows is a simple but important model that will be the basis for a later study of stock prices as

### 1 Limiting distribution for a Markov chain

Copyright c 2009 by Karl Sigman Limiting distribution for a Markov chain In these Lecture Notes, we shall study the limiting behavior of Markov chains as time n In particular, under suitable easy-to-check

### Continued Fractions and the Euclidean Algorithm

Continued Fractions and the Euclidean Algorithm Lecture notes prepared for MATH 326, Spring 997 Department of Mathematics and Statistics University at Albany William F Hammond Table of Contents Introduction

### 2.1 Complexity Classes

15-859(M): Randomized Algorithms Lecturer: Shuchi Chawla Topic: Complexity classes, Identity checking Date: September 15, 2004 Scribe: Andrew Gilpin 2.1 Complexity Classes In this lecture we will look

### U.C. Berkeley CS276: Cryptography Handout 0.1 Luca Trevisan January, 2009. Notes on Algebra

U.C. Berkeley CS276: Cryptography Handout 0.1 Luca Trevisan January, 2009 Notes on Algebra These notes contain as little theory as possible, and most results are stated without proof. Any introductory

### Information Theory and Coding Prof. S. N. Merchant Department of Electrical Engineering Indian Institute of Technology, Bombay

Information Theory and Coding Prof. S. N. Merchant Department of Electrical Engineering Indian Institute of Technology, Bombay Lecture - 17 Shannon-Fano-Elias Coding and Introduction to Arithmetic Coding

### Notes on Factoring. MA 206 Kurt Bryan

The General Approach Notes on Factoring MA 26 Kurt Bryan Suppose I hand you n, a 2 digit integer and tell you that n is composite, with smallest prime factor around 5 digits. Finding a nontrivial factor

### 1 The Brownian bridge construction

The Brownian bridge construction The Brownian bridge construction is a way to build a Brownian motion path by successively adding finer scale detail. This construction leads to a relatively easy proof

### Integer Factorization using the Quadratic Sieve

Integer Factorization using the Quadratic Sieve Chad Seibert* Division of Science and Mathematics University of Minnesota, Morris Morris, MN 56567 seib0060@morris.umn.edu March 16, 2011 Abstract We give

### Generating Random Numbers Variance Reduction Quasi-Monte Carlo. Simulation Methods. Leonid Kogan. MIT, Sloan. 15.450, Fall 2010

Simulation Methods Leonid Kogan MIT, Sloan 15.450, Fall 2010 c Leonid Kogan ( MIT, Sloan ) Simulation Methods 15.450, Fall 2010 1 / 35 Outline 1 Generating Random Numbers 2 Variance Reduction 3 Quasi-Monte

### Monte Carlo Methods and Models in Finance and Insurance

Chapman & Hall/CRC FINANCIAL MATHEMATICS SERIES Monte Carlo Methods and Models in Finance and Insurance Ralf Korn Elke Korn Gerald Kroisandt f r oc) CRC Press \ V^ J Taylor & Francis Croup ^^"^ Boca Raton

### x if x 0, x if x < 0.

Chapter 3 Sequences In this chapter, we discuss sequences. We say what it means for a sequence to converge, and define the limit of a convergent sequence. We begin with some preliminary results about the

### FACTORING POLYNOMIALS IN THE RING OF FORMAL POWER SERIES OVER Z

FACTORING POLYNOMIALS IN THE RING OF FORMAL POWER SERIES OVER Z DANIEL BIRMAJER, JUAN B GIL, AND MICHAEL WEINER Abstract We consider polynomials with integer coefficients and discuss their factorization

### A simple and fast algorithm for computing exponentials of power series

A simple and fast algorithm for computing exponentials of power series Alin Bostan Algorithms Project, INRIA Paris-Rocquencourt 7815 Le Chesnay Cedex France and Éric Schost ORCCA and Computer Science Department,

### Mathematics Course 111: Algebra I Part IV: Vector Spaces

Mathematics Course 111: Algebra I Part IV: Vector Spaces D. R. Wilkins Academic Year 1996-7 9 Vector Spaces A vector space over some field K is an algebraic structure consisting of a set V on which are

### Improved Long-Period Generators Based on Linear Recurrences Modulo 2

Improved Long-Period Generators Based on Linear Recurrences Modulo 2 FRANCOIS PANNETON and PIERRE L ECUYER Université de Montréal Fast uniform random number generators with extremely long periods have

### Factoring & Primality

Factoring & Primality Lecturer: Dimitris Papadopoulos In this lecture we will discuss the problem of integer factorization and primality testing, two problems that have been the focus of a great amount

### Monte Carlo simulation techniques

Monte Carlo simulation techniques -The development of a general framework Master s Thesis carried out at the Department of Management and Engineering, Linköping Institute of Technology and at Algorithmica

### AN ACCESSIBLE TREATMENT OF MONTE CARLO METHODS, TECHNIQUES, AND APPLICATIONS IN THE FIELD OF FINANCE AND ECONOMICS

Brochure More information from http://www.researchandmarkets.com/reports/2638617/ Handbook in Monte Carlo Simulation. Applications in Financial Engineering, Risk Management, and Economics. Wiley Handbooks

### This unit will lay the groundwork for later units where the students will extend this knowledge to quadratic and exponential functions.

Algebra I Overview View unit yearlong overview here Many of the concepts presented in Algebra I are progressions of concepts that were introduced in grades 6 through 8. The content presented in this course

### Variance Reduction. Pricing American Options. Monte Carlo Option Pricing. Delta and Common Random Numbers

Variance Reduction The statistical efficiency of Monte Carlo simulation can be measured by the variance of its output If this variance can be lowered without changing the expected value, fewer replications

### Mathematics of Cryptography

CHAPTER 2 Mathematics of Cryptography Part I: Modular Arithmetic, Congruence, and Matrices Objectives This chapter is intended to prepare the reader for the next few chapters in cryptography. The chapter

### Theory of Computation Prof. Kamala Krithivasan Department of Computer Science and Engineering Indian Institute of Technology, Madras

Theory of Computation Prof. Kamala Krithivasan Department of Computer Science and Engineering Indian Institute of Technology, Madras Lecture No. # 31 Recursive Sets, Recursively Innumerable Sets, Encoding

### High School Algebra 1 Common Core Standards & Learning Targets

High School Algebra 1 Common Core Standards & Learning Targets Unit 1: Relationships between Quantities and Reasoning with Equations CCS Standards: Quantities N-Q.1. Use units as a way to understand problems

### Algebra Unpacked Content For the new Common Core standards that will be effective in all North Carolina schools in the 2012-13 school year.

This document is designed to help North Carolina educators teach the Common Core (Standard Course of Study). NCDPI staff are continually updating and improving these tools to better serve teachers. Algebra

### 104 6 Validation and Applications. In the Vasicek model the movement of the short-term interest rate is given by

104 6 Validation and Applications 6.1 Interest Rates Derivatives In this section, we consider the pricing of collateralized mortgage obligations and the valuation of zero coupon bonds. Both applications

### 4. Factor polynomials over complex numbers, describe geometrically, and apply to real-world situations. 5. Determine and apply relationships among syn

I The Real and Complex Number Systems 1. Identify subsets of complex numbers, and compare their structural characteristics. 2. Compare and contrast the properties of real numbers with the properties of

### Random-Number Generation

Random-Number Generation Raj Jain Washington University Saint Louis, MO 63130 Jain@cse.wustl.edu Audio/Video recordings of this lecture are available at: http://www.cse.wustl.edu/~jain/cse574-08/ 26-1

### 3. INNER PRODUCT SPACES

. INNER PRODUCT SPACES.. Definition So far we have studied abstract vector spaces. These are a generalisation of the geometric spaces R and R. But these have more structure than just that of a vector space.

### Network Security. Chapter 6 Random Number Generation

Network Security Chapter 6 Random Number Generation 1 Tasks of Key Management (1)! Generation:! It is crucial to security, that keys are generated with a truly random or at least a pseudo-random generation

### CORRELATED TO THE SOUTH CAROLINA COLLEGE AND CAREER-READY FOUNDATIONS IN ALGEBRA

We Can Early Learning Curriculum PreK Grades 8 12 INSIDE ALGEBRA, GRADES 8 12 CORRELATED TO THE SOUTH CAROLINA COLLEGE AND CAREER-READY FOUNDATIONS IN ALGEBRA April 2016 www.voyagersopris.com Mathematical

### Big Ideas in Mathematics

Big Ideas in Mathematics which are important to all mathematics learning. (Adapted from the NCTM Curriculum Focal Points, 2006) The Mathematics Big Ideas are organized using the PA Mathematics Standards

### Prime Numbers. Chapter Primes and Composites

Chapter 2 Prime Numbers The term factoring or factorization refers to the process of expressing an integer as the product of two or more integers in a nontrivial way, e.g., 42 = 6 7. Prime numbers are

### General theory of stochastic processes

CHAPTER 1 General theory of stochastic processes 1.1. Definition of stochastic process First let us recall the definition of a random variable. A random variable is a random number appearing as a result

### Solution of Linear Systems

Chapter 3 Solution of Linear Systems In this chapter we study algorithms for possibly the most commonly occurring problem in scientific computing, the solution of linear systems of equations. We start

### Cryptography and Network Security. Prof. D. Mukhopadhyay. Department of Computer Science and Engineering. Indian Institute of Technology, Kharagpur

Cryptography and Network Security Prof. D. Mukhopadhyay Department of Computer Science and Engineering Indian Institute of Technology, Kharagpur Module No. # 01 Lecture No. # 12 Block Cipher Standards

### (x + a) n = x n + a Z n [x]. Proof. If n is prime then the map

22. A quick primality test Prime numbers are one of the most basic objects in mathematics and one of the most basic questions is to decide which numbers are prime (a clearly related problem is to find

### 6 Scalar, Stochastic, Discrete Dynamic Systems

47 6 Scalar, Stochastic, Discrete Dynamic Systems Consider modeling a population of sand-hill cranes in year n by the first-order, deterministic recurrence equation y(n + 1) = Ry(n) where R = 1 + r = 1

### Lecture 3: Finding integer solutions to systems of linear equations

Lecture 3: Finding integer solutions to systems of linear equations Algorithmic Number Theory (Fall 2014) Rutgers University Swastik Kopparty Scribe: Abhishek Bhrushundi 1 Overview The goal of this lecture

### The Dirichlet Unit Theorem

Chapter 6 The Dirichlet Unit Theorem As usual, we will be working in the ring B of algebraic integers of a number field L. Two factorizations of an element of B are regarded as essentially the same if

### CARDINALITY, COUNTABLE AND UNCOUNTABLE SETS PART ONE

CARDINALITY, COUNTABLE AND UNCOUNTABLE SETS PART ONE With the notion of bijection at hand, it is easy to formalize the idea that two finite sets have the same number of elements: we just need to verify

### CHAPTER 3 Numbers and Numeral Systems

CHAPTER 3 Numbers and Numeral Systems Numbers play an important role in almost all areas of mathematics, not least in calculus. Virtually all calculus books contain a thorough description of the natural,

### Notes 11: List Decoding Folded Reed-Solomon Codes

Introduction to Coding Theory CMU: Spring 2010 Notes 11: List Decoding Folded Reed-Solomon Codes April 2010 Lecturer: Venkatesan Guruswami Scribe: Venkatesan Guruswami At the end of the previous notes,

### CHAPTER SIX IRREDUCIBILITY AND FACTORIZATION 1. BASIC DIVISIBILITY THEORY

January 10, 2010 CHAPTER SIX IRREDUCIBILITY AND FACTORIZATION 1. BASIC DIVISIBILITY THEORY The set of polynomials over a field F is a ring, whose structure shares with the ring of integers many characteristics.

### 9.2 Summation Notation

9. Summation Notation 66 9. Summation Notation In the previous section, we introduced sequences and now we shall present notation and theorems concerning the sum of terms of a sequence. We begin with a

### Current Standard: Mathematical Concepts and Applications Shape, Space, and Measurement- Primary

Shape, Space, and Measurement- Primary A student shall apply concepts of shape, space, and measurement to solve problems involving two- and three-dimensional shapes by demonstrating an understanding of:

### An Introduction to Galois Fields and Reed-Solomon Coding

An Introduction to Galois Fields and Reed-Solomon Coding James Westall James Martin School of Computing Clemson University Clemson, SC 29634-1906 October 4, 2010 1 Fields A field is a set of elements on

### (Quasi-)Newton methods

(Quasi-)Newton methods 1 Introduction 1.1 Newton method Newton method is a method to find the zeros of a differentiable non-linear function g, x such that g(x) = 0, where g : R n R n. Given a starting

### Some Polynomial Theorems. John Kennedy Mathematics Department Santa Monica College 1900 Pico Blvd. Santa Monica, CA 90405 rkennedy@ix.netcom.

Some Polynomial Theorems by John Kennedy Mathematics Department Santa Monica College 1900 Pico Blvd. Santa Monica, CA 90405 rkennedy@ix.netcom.com This paper contains a collection of 31 theorems, lemmas,

### Linear Codes. Chapter 3. 3.1 Basics

Chapter 3 Linear Codes In order to define codes that we can encode and decode efficiently, we add more structure to the codespace. We shall be mainly interested in linear codes. A linear code of length

### Network Security. Chapter 6 Random Number Generation. Prof. Dr.-Ing. Georg Carle

Network Security Chapter 6 Random Number Generation Prof. Dr.-Ing. Georg Carle Chair for Computer Networks & Internet Wilhelm-Schickard-Institute for Computer Science University of Tübingen http://net.informatik.uni-tuebingen.de/

### Lecture 1: Elementary Number Theory

Lecture 1: Elementary Number Theory The integers are the simplest and most fundamental objects in discrete mathematics. All calculations by computers are based on the arithmetical operations with integers

### Lecture 2: Universality

CS 710: Complexity Theory 1/21/2010 Lecture 2: Universality Instructor: Dieter van Melkebeek Scribe: Tyson Williams In this lecture, we introduce the notion of a universal machine, develop efficient universal

### DRAFT. Algebra 1 EOC Item Specifications

DRAFT Algebra 1 EOC Item Specifications The draft Florida Standards Assessment (FSA) Test Item Specifications (Specifications) are based upon the Florida Standards and the Florida Course Descriptions as

### PowerTeaching i3: Algebra I Mathematics

PowerTeaching i3: Algebra I Mathematics Alignment to the Common Core State Standards for Mathematics Standards for Mathematical Practice and Standards for Mathematical Content for Algebra I Key Ideas and

### Raj Boppana, Ph.D. Professor and Interim Chair. University of Texas at San Antonio

Raj Boppana, Ph.D. Professor and Interim Chair Computer Science Department University of Texas at San Antonio Terminology RN: pseudorandom number RN stream: a sequence of RNs Cycle: the maximum number

### NEW YORK STATE TEACHER CERTIFICATION EXAMINATIONS

NEW YORK STATE TEACHER CERTIFICATION EXAMINATIONS TEST DESIGN AND FRAMEWORK September 2014 Authorized for Distribution by the New York State Education Department This test design and framework document

### CHAPTER II THE LIMIT OF A SEQUENCE OF NUMBERS DEFINITION OF THE NUMBER e.

CHAPTER II THE LIMIT OF A SEQUENCE OF NUMBERS DEFINITION OF THE NUMBER e. This chapter contains the beginnings of the most important, and probably the most subtle, notion in mathematical analysis, i.e.,

### ECEN 5682 Theory and Practice of Error Control Codes

ECEN 5682 Theory and Practice of Error Control Codes Convolutional Codes University of Colorado Spring 2007 Linear (n, k) block codes take k data symbols at a time and encode them into n code symbols.

### Chapter 7. Induction and Recursion. Part 1. Mathematical Induction

Chapter 7. Induction and Recursion Part 1. Mathematical Induction The principle of mathematical induction is this: to establish an infinite sequence of propositions P 1, P 2, P 3,..., P n,... (or, simply

### ORDERS OF ELEMENTS IN A GROUP

ORDERS OF ELEMENTS IN A GROUP KEITH CONRAD 1. Introduction Let G be a group and g G. We say g has finite order if g n = e for some positive integer n. For example, 1 and i have finite order in C, since

### Introduction to finite fields

Introduction to finite fields Topics in Finite Fields (Fall 2013) Rutgers University Swastik Kopparty Last modified: Monday 16 th September, 2013 Welcome to the course on finite fields! This is aimed at

### 24. The Branch and Bound Method

24. The Branch and Bound Method It has serious practical consequences if it is known that a combinatorial problem is NP-complete. Then one can conclude according to the present state of science that no

### BANACH AND HILBERT SPACE REVIEW

BANACH AND HILBET SPACE EVIEW CHISTOPHE HEIL These notes will briefly review some basic concepts related to the theory of Banach and Hilbert spaces. We are not trying to give a complete development, but

### PUTNAM TRAINING POLYNOMIALS. Exercises 1. Find a polynomial with integral coefficients whose zeros include 2 + 5.

PUTNAM TRAINING POLYNOMIALS (Last updated: November 17, 2015) Remark. This is a list of exercises on polynomials. Miguel A. Lerma Exercises 1. Find a polynomial with integral coefficients whose zeros include

### Portable Random Number Generators ABSTRACT

Portable Random Number Generators Gerald P. Dwyer, Jr.* a K. B. Williams b a. Research Department, Federal Reserve Bank of Atlanta, 104 Marietta St., N.W., Atlanta GA 30303 USA b. Melbourne Beach, Florida

### N E W S A N D L E T T E R S

N E W S A N D L E T T E R S 73rd Annual William Lowell Putnam Mathematical Competition Editor s Note: Additional solutions will be printed in the Monthly later in the year. PROBLEMS A1. Let d 1, d,...,

### it is easy to see that α = a

21. Polynomial rings Let us now turn out attention to determining the prime elements of a polynomial ring, where the coefficient ring is a field. We already know that such a polynomial ring is a UF. Therefore

### International Journal of Information Technology, Modeling and Computing (IJITMC) Vol.1, No.3,August 2013

FACTORING CRYPTOSYSTEM MODULI WHEN THE CO-FACTORS DIFFERENCE IS BOUNDED Omar Akchiche 1 and Omar Khadir 2 1,2 Laboratory of Mathematics, Cryptography and Mechanics, Fstm, University of Hassan II Mohammedia-Casablanca,

### Advanced Algebra 2. I. Equations and Inequalities

Advanced Algebra 2 I. Equations and Inequalities A. Real Numbers and Number Operations 6.A.5, 6.B.5, 7.C.5 1) Graph numbers on a number line 2) Order real numbers 3) Identify properties of real numbers

### Mathematics Review for MS Finance Students

Mathematics Review for MS Finance Students Anthony M. Marino Department of Finance and Business Economics Marshall School of Business Lecture 1: Introductory Material Sets The Real Number System Functions,

### MTH304: Honors Algebra II

MTH304: Honors Algebra II This course builds upon algebraic concepts covered in Algebra. Students extend their knowledge and understanding by solving open-ended problems and thinking critically. Topics

### Algebra 2 Chapter 1 Vocabulary. identity - A statement that equates two equivalent expressions.

Chapter 1 Vocabulary identity - A statement that equates two equivalent expressions. verbal model- A word equation that represents a real-life problem. algebraic expression - An expression with variables.

### 11 Multivariate Polynomials

CS 487: Intro. to Symbolic Computation Winter 2009: M. Giesbrecht Script 11 Page 1 (These lecture notes were prepared and presented by Dan Roche.) 11 Multivariate Polynomials References: MC: Section 16.6

### MATH 4330/5330, Fourier Analysis Section 11, The Discrete Fourier Transform

MATH 433/533, Fourier Analysis Section 11, The Discrete Fourier Transform Now, instead of considering functions defined on a continuous domain, like the interval [, 1) or the whole real line R, we wish

### NCSS Statistical Software Principal Components Regression. In ordinary least squares, the regression coefficients are estimated using the formula ( )

Chapter 340 Principal Components Regression Introduction is a technique for analyzing multiple regression data that suffer from multicollinearity. When multicollinearity occurs, least squares estimates

### Factorization Methods: Very Quick Overview

Factorization Methods: Very Quick Overview Yuval Filmus October 17, 2012 1 Introduction In this lecture we introduce modern factorization methods. We will assume several facts from analytic number theory.

### 1 if 1 x 0 1 if 0 x 1

Chapter 3 Continuity In this chapter we begin by defining the fundamental notion of continuity for real valued functions of a single real variable. When trying to decide whether a given function is or

### Primality - Factorization

Primality - Factorization Christophe Ritzenthaler November 9, 2009 1 Prime and factorization Definition 1.1. An integer p > 1 is called a prime number (nombre premier) if it has only 1 and p as divisors.

### Lecture 14: Fourier Transform

Machine Learning: Foundations Fall Semester, 2010/2011 Lecture 14: Fourier Transform Lecturer: Yishay Mansour Scribes: Avi Goren & Oron Navon 1 14.1 Introduction In this lecture, we examine the Fourier

### Introduction to time series analysis

Introduction to time series analysis Margherita Gerolimetto November 3, 2010 1 What is a time series? A time series is a collection of observations ordered following a parameter that for us is time. Examples

### Probability and Statistics Prof. Dr. Somesh Kumar Department of Mathematics Indian Institute of Technology, Kharagpur

Probability and Statistics Prof. Dr. Somesh Kumar Department of Mathematics Indian Institute of Technology, Kharagpur Module No. #01 Lecture No. #15 Special Distributions-VI Today, I am going to introduce

### Overview of Math Standards

Algebra 2 Welcome to math curriculum design maps for Manhattan- Ogden USD 383, striving to produce learners who are: Effective Communicators who clearly express ideas and effectively communicate with diverse

### Probability and Statistics

CHAPTER 2: RANDOM VARIABLES AND ASSOCIATED FUNCTIONS 2b - 0 Probability and Statistics Kristel Van Steen, PhD 2 Montefiore Institute - Systems and Modeling GIGA - Bioinformatics ULg kristel.vansteen@ulg.ac.be

### Markov Chains, Stochastic Processes, and Advanced Matrix Decomposition

Markov Chains, Stochastic Processes, and Advanced Matrix Decomposition Jack Gilbert Copyright (c) 2014 Jack Gilbert. Permission is granted to copy, distribute and/or modify this document under the terms

### Vector and Matrix Norms

Chapter 1 Vector and Matrix Norms 11 Vector Spaces Let F be a field (such as the real numbers, R, or complex numbers, C) with elements called scalars A Vector Space, V, over the field F is a non-empty

### Notes on Determinant

ENGG2012B Advanced Engineering Mathematics Notes on Determinant Lecturer: Kenneth Shum Lecture 9-18/02/2013 The determinant of a system of linear equations determines whether the solution is unique, without

### Monte Carlo Simulation technique. S. B. Santra Department of Physics Indian Institute of Technology Guwahati

Monte Carlo Simulation technique S. B. Santra Department of Physics Indian Institute of Technology Guwahati What is Monte Carlo (MC)? Introduction Monte Carlo method is a common name for a wide variety

### minimal polyonomial Example

Minimal Polynomials Definition Let α be an element in GF(p e ). We call the monic polynomial of smallest degree which has coefficients in GF(p) and α as a root, the minimal polyonomial of α. Example: We

### ECE 842 Report Implementation of Elliptic Curve Cryptography

ECE 842 Report Implementation of Elliptic Curve Cryptography Wei-Yang Lin December 15, 2004 Abstract The aim of this report is to illustrate the issues in implementing a practical elliptic curve cryptographic

### Infinite Algebra 1 supports the teaching of the Common Core State Standards listed below.

Infinite Algebra 1 Kuta Software LLC Common Core Alignment Software version 2.05 Last revised July 2015 Infinite Algebra 1 supports the teaching of the Common Core State Standards listed below. High School