An Introduction to Monte Carlo

Size: px
Start display at page:

Download "An Introduction to Monte Carlo"

Transcription

1 1/28 An Introduction to Monte Carlo Joshua Lande Stanford February 23, 2011

2 Monte Carlo - Only SASS Topic to Win an Academy Award? 2/28 As part of the 73rd Scientific and Technical Academy Awards ceremony presentation on March 3, 2001, The Academy of Motion Picture Arts and Sciences Board of Governors honored Ed Catmull, Loren Carpenter, and Rob Cook, with an Academy Award of Merit (Oscar) for significant advancements to the field of motion picture rendering as exemplified in Pixars RenderMan. This was the first Oscar awarded to a software package for its outstanding contributions to the field.

3 3/28 Motivation for Monte Carlo Example, What is the expected distance between two points distributed randomly on a rectangle There is a simple integral to determine this d = 1 (dx1 (ab) 2 dx 2 ) 2 + (dy 1 dy 2 ) 2 )dx 1 dy 1 dx 2 dy 2 There is acutally an analytic solution: d = 1 15 [ ) a 3 (3 b 2 + b3 a 2 + d a2 b 2 b2 a ( b 2 2 a log a + b d Where d = a 2 + b 2 + a2 b log b + d )] a

4 4/28 Average Distance Between Points If a = b = 1, then d = With Monte Carlo, can calculate with 3 lines of code: >>> from pylab import >>> x1, x2, y1, y2=rand (4,1 e6 ) >>> average ( s q r t ( ( x2 x1 ) 2+(y2 y1 ) 2 ) ) Impressively, we can calculate a 1σ error: >>> std ( s q r t ( ( x2 x1 ) 2+(y2 y1 ) 2 ) ) / s q r t (1 e6 ) My value is off by 0.5σ.

5 5/28 Monte Carlo Benefits The analytic solution is fragile to symmetries that don t exist in the real world What if there is a hole somewhere in the box... In real life, there is always measurement error and model error which is probably larger than any introduced statistical error. The Monte Carlo solution is dead simple to calculate and generalize.

6 6/28 Another Cute Example Want to estimate π a fraction π/4 will fall within a circle enscribed in the box. Formally, we want to solve the integral π = ( ) δ x2 + y 2 < 1 dxdy Monte-Carlo_method_pi.svg Analytic solution to the integral won t give you a number easy to solve with Monte Carlo >>> x, y=rand (2,1 e6 ) >>> 4 sum( s q r t ( x 2+y 2 <1))/1 e

7 7/28 Lots of Monte Carlo Applications Learn about a system by random sampling from it The Laws of physics are probabilistic, physics models inherently requires Monte Carlo sampling. Real life simulations are always high dimensional A particle detector s performance might be a function of energy, incident angle, incident momentum, conversion location,... Trying to calculate something like an expectation value using a straightforward integral over all all the dimensions of a model would be hopeless Testing out analysis code for bugs and errors Blind analysis Test applicability of statistical theorems

8 8/28 Primary Uses of Monte Carlo Numerically integrating functions b a f(x)dx 1 n n f(x i ) As with all experimental data, convergence goes as O(1/ n) There are better one dimensional integration algorithms, but they all grow exponentially slower as the dimesnions of the integral grow On the other hand, the O(1/ n) behavior is independent of dimensions! As d, Monte Carlo will always be the best integration method A central limit theorem can be used to estimate errors on integral i=1

9 9/28 Random vs. PseudoRandom One could imagine all sorts of methods to generate truly random numbers Flip a coin Counts from radioactive decay Measure spin True random numbers are almost never used Measuring devices can introduce correlations into random measurements Random numbers are incompressible slow to generate hard to store

10 10/28 Aside

11 Amazon reviews are funny The bulk of each page seems random enough. However at the lower left and lower right of alternate pages, the number is found to increment directly. I took a class in statistics in college. I used this book to help me select random phone numbers for a poll I was conducting for my class project... One of those phone calls was answered by the woman who is now my wife. We ve been happily married for ten years! Thank you, RAND. Sure, you think you can just open up your spreadsheet and generate random numbers at will. But did you know that those are only pseudo-random numbers?... While that may be good enough for everyday use, on those special occasions when only the real thing will do, this is the book you need. Truly random digits, and in copious quantities. This is the mother load of true randomness on earth. I wrote a report on this book last semester. My roommate failed to tell me he had the Cliffs! Can you believe that? Thanks, Brad! 11/28

12 12/28 Generating PseudoRandom Numbers Typically use computer algorithms which approximate generating random numbers Easy to store Results completely reproducible Require only an input seed One of the most famous PRNG is X n+1 = (ax n + b) mod m As far as I can tell, simpler PRNGs can have issues with repeated patters, correlations, and measures of randomness...

13 Mersenne Twister Most modern languages (python, matlab, R) use the Mersenn Twister From Wikipedia 1 It has a very long period of While a long period is not a guarantee of quality in a random number generator, short periods (such as the 232 common in many software packages) can be problematic It is k-distributed to 32-bit accuracy for every 1 k 623 It passes numerous tests for statistical randomness, including the Diehard tests. It passes most, but not all, of the even more stringent TestU01 Crush randomness tests When doing a Monte Carlo, floating point rounding errors should probably be a bigger concern than RNG errors /28

14 14/28 Inverse Transform Sampling Can sample from U(0 x 1) Want to sample from any arbitrary probability distribution f(x) Try Inverse Transform Sampling Let F be the CDF F (x) = x F (y)dy Then y = F 1 (u) F Proof: P r(y x) = P r(f 1 (u) x) = P r(u F (x)) = F (x) Since P r(y x) = F (x), y is distributed as f

15 Inverse Transform Sampling Qualitativly, when f(x) is large, CDF increases rapidly. A bigger range of u which will be mapped to a given x More likely to pick that x sampling_method/ 15/28

16 Examples: Uniform and Exponential Sample Uniformly between a and b { f(x) = 1 1 a x b b a 0 x < a or x > b 0 x a x a F (x) = b a a x b 1 x b F 1 (p) = a + (b a)p for 0 p 1 So if u U(0, 1), then x = a + (b a)u U(a, b) To sample from an exponential distribution: f(x) = λe λx F (x) = 1 e λx F 1 (x) = ln(1 x)/λ So x = ln(1 u)/λ or x = ln u/λ will have an exponential distribution 16/28

17 17/28 Important Reference in the Field There is a great book with lots of standard distributions The book can be viewed free online rnbookindex.html Preface to the Web Edition... I have asked Springer to print more copies, but they flatly refused, unless I was willing to publish a second edition with them in the near future. Burnt once, why would I trust them with a second edition? Also, I figured that since Springer had gross income about 500,000 US dollars from my books with them, that they would be more generous with their royalties and more responsive to demands for second printings. The contrary is true in fact: royalties are decreasing (they stand now at 7.5% per book)

18 18/28 One More: Gaussian Distribution How to sample from a Gaussian distribution N(0, 1) f(x) = 1 2π e t2 /2 dt F (x) = 1 x e t2 /2 dt = 1 2π 2 F 1 (x) probit(p) = 2erf 1 (2p 1) [ 1 + erf(x/ ] (2)) Although erf 1 can t be written in terms of simpler functions, it has a well defined taylor expansion erf 1 (z) = 1 π (z + π ) 2 12 z3 + 7π2 480 z π z π z Which is good enough for a computer

19 19/28 Box-Muller Transform For special distributions, there are faster algorithms A pair of indepnedent Gaussian varaibles z 1 and z 2 can be generated using the Box-Muller transform z 1 = r cos θ = 2 ln u 1 cos(2πu 2 ) (1) z 2 = r sin θ = 2 ln u 1 sin(2πu 2 ) (2) Motivation: In a Two-dimensional Cartesian system with x and y described by two independent and normally distributed random variables, r 2 = x 2 + y 2 and θ are also independent r 2 has a chi squared distribution with two degrees of freedom which is an exponential distribution θ is just uniform between 0 and 2π So we can generate r 2 = 2 ln u 1 and θ = 2πu 2

20 20/28 Box-Muller (cont) >>> u1, u2=rand (2,1 e6 ) >>> data=append ( s q r t ( 2 l o g ( u1 ) ) cos (2 pi u2 ), s q r t ( 2 l o g ( u1 ) ) s i n (2 pi u2 ) )... >>> h i s t ( data, normed=true, bins =100, h i s t t y p e = step ) >>> s a v e f i g ( p l o t. pdf )

21 21/28 Acceptance Rejection Sampling Suppose we want to sample from a distribution f(x). Suppose that we have a distribution g(x) such that f(x) ag(x). Acceptance rejection samples from f(x) by sampling some point x f(x) (3) A second uniform data point u U(0, 1) is generated and the data point x is kept only if u < f(x)/ag(x) (4) the probability of a point being accepted is P r(accept) = 1/a. Nice if g(x) is easy to sample from. Only have to evaluate f(x)

22 Graphically Acceptance Rejection sampling is sampling points from the top curve and keeping them only if they are below the lower curve. Try to pick a function g(x) which squeezes f(x) tightly. If f(x) is very costly to evaluate, can modify algorithm with a lower bounding function h(x) so that f(x) is evaluated only if u > h(x)/ag(x) 22/28

23 23/28 Sampling from a Multidimensional Distribution Sampling a scaler from a probability distribution is basically a solved problem Sampling from a multidimensional distribution is still generally unsolved and an active field of research Of course, if the variables are independent, then it is easy. But hard to get the correlations Curse of Dimensionality

24 Multivariate Inverse Transform Sampling We can generally write out the CDF conditionally F X1,X 2,...,X d (x 1, x 2,..., x d ) = F X1 (x 1 )F X2 X 1 (x 2 x 1 )... F Xd X 1X 2...X d 1 (x d x 1, x 2,..., x d 1) And then given d random uniform variables u 1, u 2,..., u d x 1 = F 1 X 1 (u 1 ) x 2 = F 1 X 2 X 1 (u 2 ) x d = F 1 X d X 1X 2...X d 1 (u d) Doable in simple situations, calculating the conditional inverse CDF can be horrible Curse of Dimensionality! 24/28

25 25/28 Acceptance Rejection in Multiple Dimensions Acceptance Rejection generalizes readily to many dimensions Exceptionally hard to find a function which cover s your function tightly in higher dimensional Most data points end up being rejected Curse of Dimensionality!

26 26/28 Special Case: Multivariate Gaussian Distribution Want to sample from a Multivariate Gaussian Distribution with mean µ and covariance Σ: f(x) = 1 (2π) k/2 Σ exp ( 1 1/2 2 (x µ)t Σ 1 (x µ) ) one can simulate a vector using the eigenvalue decomposition of the covariance matrix Σ = DΛD T If y N p (0, 1) (p independent normal variables), then X = Dλ 1/2 y + µ N(µ, Σ) has the desired Multivariate Gaussian Distribution

27 27/28 Markov Chain Monte Carlo (MCMC) Want to sample from a high dimensional probability distribution P (x) Sometimes Multivariate Inverse Transform Sampling doesn t work Acceptance Rejection doesn t really work MCMC is an attempt to solve this problem. Fundamental insight is to generate data points which are not independent. Use a Markov Process to generate one point from the previous Markov chain that has the desired distribution as its equilibrium distribution State of the chain after many steps is used to sample the distribution

28 MetropolisHastings Algorithm Want to sample from P (x ) Need rule to move from x t to x t+1 Given a proposal density Q(x ; x t ) Pick a place to go x with probability Q(x ; x t ). Pick α U(0, 1). If then x t+1 = x Otherwise, x t+1 = x t α < P (x )Q(x t ; x ) P (x t )Q(x ; x t ) Overal normalization of P (x) not needed Generally hard to pick Q Hard to know when you have well sampeled probability space I think MCMC is a huge field of research 28/28

Uniform Random Number Generators

Uniform Random Number Generators JHU 553.633/433: Monte Carlo Methods J. C. Spall 25 September 2017 CHAPTER 2 RANDOM NUMBER GENERATION Motivation and criteria for generators Linear generators (e.g., linear congruential generators) Multiple

More information

Generating the Sample

Generating the Sample STAT 80: Mathematical Statistics Monte Carlo Suppose you are given random variables X,..., X n whose joint density f (or distribution) is specified and a statistic T (X,..., X n ) whose distribution you

More information

Monte Carlo. Lecture 15 4/9/18. Harvard SEAS AP 275 Atomistic Modeling of Materials Boris Kozinsky

Monte Carlo. Lecture 15 4/9/18. Harvard SEAS AP 275 Atomistic Modeling of Materials Boris Kozinsky Monte Carlo Lecture 15 4/9/18 1 Sampling with dynamics In Molecular Dynamics we simulate evolution of a system over time according to Newton s equations, conserving energy Averages (thermodynamic properties)

More information

Intelligent Systems I

Intelligent Systems I 1, Intelligent Systems I 12 SAMPLING METHODS THE LAST THING YOU SHOULD EVER TRY Philipp Hennig & Stefan Harmeling Max Planck Institute for Intelligent Systems 23. January 2014 Dptmt. of Empirical Inference

More information

2 Random Variable Generation

2 Random Variable Generation 2 Random Variable Generation Most Monte Carlo computations require, as a starting point, a sequence of i.i.d. random variables with given marginal distribution. We describe here some of the basic methods

More information

Random Number Generation. CS1538: Introduction to simulations

Random Number Generation. CS1538: Introduction to simulations Random Number Generation CS1538: Introduction to simulations Random Numbers Stochastic simulations require random data True random data cannot come from an algorithm We must obtain it from some process

More information

1 Maintaining a Dictionary

1 Maintaining a Dictionary 15-451/651: Design & Analysis of Algorithms February 1, 2016 Lecture #7: Hashing last changed: January 29, 2016 Hashing is a great practical tool, with an interesting and subtle theory too. In addition

More information

Cheng Soon Ong & Christian Walder. Canberra February June 2018

Cheng Soon Ong & Christian Walder. Canberra February June 2018 Cheng Soon Ong & Christian Walder Research Group and College of Engineering and Computer Science Canberra February June 2018 Outlines Overview Introduction Linear Algebra Probability Linear Regression

More information

Stat 451 Lecture Notes Simulating Random Variables

Stat 451 Lecture Notes Simulating Random Variables Stat 451 Lecture Notes 05 12 Simulating Random Variables Ryan Martin UIC www.math.uic.edu/~rgmartin 1 Based on Chapter 6 in Givens & Hoeting, Chapter 22 in Lange, and Chapter 2 in Robert & Casella 2 Updated:

More information

Simulation. Where real stuff starts

Simulation. Where real stuff starts 1 Simulation Where real stuff starts ToC 1. What is a simulation? 2. Accuracy of output 3. Random Number Generators 4. How to sample 5. Monte Carlo 6. Bootstrap 2 1. What is a simulation? 3 What is a simulation?

More information

Random Number Generation. Stephen Booth David Henty

Random Number Generation. Stephen Booth David Henty Random Number Generation Stephen Booth David Henty Introduction Random numbers are frequently used in many types of computer simulation Frequently as part of a sampling process: Generate a representative

More information

Simulation. Where real stuff starts

Simulation. Where real stuff starts Simulation Where real stuff starts March 2019 1 ToC 1. What is a simulation? 2. Accuracy of output 3. Random Number Generators 4. How to sample 5. Monte Carlo 6. Bootstrap 2 1. What is a simulation? 3

More information

Chapter 4: Monte Carlo Methods. Paisan Nakmahachalasint

Chapter 4: Monte Carlo Methods. Paisan Nakmahachalasint Chapter 4: Monte Carlo Methods Paisan Nakmahachalasint Introduction Monte Carlo Methods are a class of computational algorithms that rely on repeated random sampling to compute their results. Monte Carlo

More information

Random Number Generators

Random Number Generators 1/18 Random Number Generators Professor Karl Sigman Columbia University Department of IEOR New York City USA 2/18 Introduction Your computer generates" numbers U 1, U 2, U 3,... that are considered independent

More information

So we will instead use the Jacobian method for inferring the PDF of functionally related random variables; see Bertsekas & Tsitsiklis Sec. 4.1.

So we will instead use the Jacobian method for inferring the PDF of functionally related random variables; see Bertsekas & Tsitsiklis Sec. 4.1. 2011 Page 1 Simulating Gaussian Random Variables Monday, February 14, 2011 2:00 PM Readings: Kloeden and Platen Sec. 1.3 Why does the Box Muller method work? How was it derived? The basic idea involves

More information

Random processes and probability distributions. Phys 420/580 Lecture 20

Random processes and probability distributions. Phys 420/580 Lecture 20 Random processes and probability distributions Phys 420/580 Lecture 20 Random processes Many physical processes are random in character: e.g., nuclear decay (Poisson distributed event count) P (k, τ) =

More information

MTH739U/P: Topics in Scientific Computing Autumn 2016 Week 6

MTH739U/P: Topics in Scientific Computing Autumn 2016 Week 6 MTH739U/P: Topics in Scientific Computing Autumn 16 Week 6 4.5 Generic algorithms for non-uniform variates We have seen that sampling from a uniform distribution in [, 1] is a relatively straightforward

More information

CSC 446 Notes: Lecture 13

CSC 446 Notes: Lecture 13 CSC 446 Notes: Lecture 3 The Problem We have already studied how to calculate the probability of a variable or variables using the message passing method. However, there are some times when the structure

More information

Random Variables and Their Distributions

Random Variables and Their Distributions Chapter 3 Random Variables and Their Distributions A random variable (r.v.) is a function that assigns one and only one numerical value to each simple event in an experiment. We will denote r.vs by capital

More information

Numerical Methods I Monte Carlo Methods

Numerical Methods I Monte Carlo Methods Numerical Methods I Monte Carlo Methods Aleksandar Donev Courant Institute, NYU 1 donev@courant.nyu.edu 1 Course G63.2010.001 / G22.2420-001, Fall 2010 Dec. 9th, 2010 A. Donev (Courant Institute) Lecture

More information

6.080 / Great Ideas in Theoretical Computer Science Spring 2008

6.080 / Great Ideas in Theoretical Computer Science Spring 2008 MIT OpenCourseWare http://ocw.mit.edu 6.080 / 6.089 Great Ideas in Theoretical Computer Science Spring 2008 For information about citing these materials or our Terms of Use, visit: http://ocw.mit.edu/terms.

More information

Markov Chain Monte Carlo The Metropolis-Hastings Algorithm

Markov Chain Monte Carlo The Metropolis-Hastings Algorithm Markov Chain Monte Carlo The Metropolis-Hastings Algorithm Anthony Trubiano April 11th, 2018 1 Introduction Markov Chain Monte Carlo (MCMC) methods are a class of algorithms for sampling from a probability

More information

STAT2201. Analysis of Engineering & Scientific Data. Unit 3

STAT2201. Analysis of Engineering & Scientific Data. Unit 3 STAT2201 Analysis of Engineering & Scientific Data Unit 3 Slava Vaisman The University of Queensland School of Mathematics and Physics What we learned in Unit 2 (1) We defined a sample space of a random

More information

Data Analysis I. Dr Martin Hendry, Dept of Physics and Astronomy University of Glasgow, UK. 10 lectures, beginning October 2006

Data Analysis I. Dr Martin Hendry, Dept of Physics and Astronomy University of Glasgow, UK. 10 lectures, beginning October 2006 Astronomical p( y x, I) p( x, I) p ( x y, I) = p( y, I) Data Analysis I Dr Martin Hendry, Dept of Physics and Astronomy University of Glasgow, UK 10 lectures, beginning October 2006 4. Monte Carlo Methods

More information

Hands-on Generating Random

Hands-on Generating Random CVIP Laboratory Hands-on Generating Random Variables Shireen Elhabian Aly Farag October 2007 The heart of Monte Carlo simulation for statistical inference. Generate synthetic data to test our algorithms,

More information

Lecture 20. Randomness and Monte Carlo. J. Chaudhry. Department of Mathematics and Statistics University of New Mexico

Lecture 20. Randomness and Monte Carlo. J. Chaudhry. Department of Mathematics and Statistics University of New Mexico Lecture 20 Randomness and Monte Carlo J. Chaudhry Department of Mathematics and Statistics University of New Mexico J. Chaudhry (UNM) CS 357 1 / 40 What we ll do: Random number generators Monte-Carlo integration

More information

Calculus II. Calculus II tends to be a very difficult course for many students. There are many reasons for this.

Calculus II. Calculus II tends to be a very difficult course for many students. There are many reasons for this. Preface Here are my online notes for my Calculus II course that I teach here at Lamar University. Despite the fact that these are my class notes they should be accessible to anyone wanting to learn Calculus

More information

IEOR 4703: Homework 2 Solutions

IEOR 4703: Homework 2 Solutions IEOR 4703: Homework 2 Solutions Exercises for which no programming is required Let U be uniformly distributed on the interval (0, 1); P (U x) = x, x (0, 1). We assume that your computer can sequentially

More information

Hochdimensionale Integration

Hochdimensionale Integration Oliver Ernst Institut für Numerische Mathematik und Optimierung Hochdimensionale Integration 14-tägige Vorlesung im Wintersemester 2010/11 im Rahmen des Moduls Ausgewählte Kapitel der Numerik Contents

More information

Sources of randomness

Sources of randomness Random Number Generator Chapter 7 In simulations, we generate random values for variables with a specified distribution Ex., model service times using the exponential distribution Generation of random

More information

From Random Numbers to Monte Carlo. Random Numbers, Random Walks, Diffusion, Monte Carlo integration, and all that

From Random Numbers to Monte Carlo. Random Numbers, Random Walks, Diffusion, Monte Carlo integration, and all that From Random Numbers to Monte Carlo Random Numbers, Random Walks, Diffusion, Monte Carlo integration, and all that Random Walk Through Life Random Walk Through Life If you flip the coin 5 times you will

More information

Monte Carlo and cold gases. Lode Pollet.

Monte Carlo and cold gases. Lode Pollet. Monte Carlo and cold gases Lode Pollet lpollet@physics.harvard.edu 1 Outline Classical Monte Carlo The Monte Carlo trick Markov chains Metropolis algorithm Ising model critical slowing down Quantum Monte

More information

εx 2 + x 1 = 0. (2) Suppose we try a regular perturbation expansion on it. Setting ε = 0 gives x 1 = 0,

εx 2 + x 1 = 0. (2) Suppose we try a regular perturbation expansion on it. Setting ε = 0 gives x 1 = 0, 4 Rescaling In this section we ll look at one of the reasons that our ε = 0 system might not have enough solutions, and introduce a tool that is fundamental to all perturbation systems. We ll start with

More information

Preface. Here are a couple of warnings to my students who may be here to get a copy of what happened on a day that you missed.

Preface. Here are a couple of warnings to my students who may be here to get a copy of what happened on a day that you missed. alculus III Preface Here are my online notes for my alculus III course that I teach here at Lamar University. espite the fact that these are my class notes, they should be accessible to anyone wanting

More information

Introduction to Algorithms / Algorithms I Lecturer: Michael Dinitz Topic: Intro to Learning Theory Date: 12/8/16

Introduction to Algorithms / Algorithms I Lecturer: Michael Dinitz Topic: Intro to Learning Theory Date: 12/8/16 600.463 Introduction to Algorithms / Algorithms I Lecturer: Michael Dinitz Topic: Intro to Learning Theory Date: 12/8/16 25.1 Introduction Today we re going to talk about machine learning, but from an

More information

Lecture 5: Random numbers and Monte Carlo (Numerical Recipes, Chapter 7) Motivations for generating random numbers

Lecture 5: Random numbers and Monte Carlo (Numerical Recipes, Chapter 7) Motivations for generating random numbers Lecture 5: Random numbers and Monte Carlo (Numerical Recipes, Chapter 7) Motivations for generating random numbers To sample a function in a statistically controlled manner (i.e. for Monte Carlo integration)

More information

Scientific Computing: Monte Carlo

Scientific Computing: Monte Carlo Scientific Computing: Monte Carlo Aleksandar Donev Courant Institute, NYU 1 donev@courant.nyu.edu 1 Course MATH-GA.2043 or CSCI-GA.2112, Spring 2012 April 5th and 12th, 2012 A. Donev (Courant Institute)

More information

Applied Statistics. Monte Carlo Simulations. Troels C. Petersen (NBI) Statistics is merely a quantisation of common sense

Applied Statistics. Monte Carlo Simulations. Troels C. Petersen (NBI) Statistics is merely a quantisation of common sense Applied Statistics Monte Carlo Simulations Troels C. Petersen (NBI) Statistics is merely a quantisation of common sense 1 Random numbers Any one who considers arithmetical methods of producing random digits

More information

27 : Distributed Monte Carlo Markov Chain. 1 Recap of MCMC and Naive Parallel Gibbs Sampling

27 : Distributed Monte Carlo Markov Chain. 1 Recap of MCMC and Naive Parallel Gibbs Sampling 10-708: Probabilistic Graphical Models 10-708, Spring 2014 27 : Distributed Monte Carlo Markov Chain Lecturer: Eric P. Xing Scribes: Pengtao Xie, Khoa Luu In this scribe, we are going to review the Parallel

More information

DIFFERENTIAL EQUATIONS

DIFFERENTIAL EQUATIONS DIFFERENTIAL EQUATIONS Basic Concepts Paul Dawkins Table of Contents Preface... Basic Concepts... 1 Introduction... 1 Definitions... Direction Fields... 8 Final Thoughts...19 007 Paul Dawkins i http://tutorial.math.lamar.edu/terms.aspx

More information

STAT2201 Slava Vaisman

STAT2201 Slava Vaisman STAT2201 Slava Vaisman This course is for engineering (civil, mechanical, software ) Electronic Course Profile http://www.courses.uq.edu.au/student_section_loader.php?section=1&profileid=9 2234 If you

More information

Math Stochastic Processes & Simulation. Davar Khoshnevisan University of Utah

Math Stochastic Processes & Simulation. Davar Khoshnevisan University of Utah Math 5040 1 Stochastic Processes & Simulation Davar Khoshnevisan University of Utah Module 1 Generation of Discrete Random Variables Just about every programming language and environment has a randomnumber

More information

MATH5835 Statistical Computing. Jochen Voss

MATH5835 Statistical Computing. Jochen Voss MATH5835 Statistical Computing Jochen Voss September 27, 2011 Copyright c 2011 Jochen Voss J.Voss@leeds.ac.uk This text is work in progress and may still contain typographical and factual mistakes. Reports

More information

Treatment of Error in Experimental Measurements

Treatment of Error in Experimental Measurements in Experimental Measurements All measurements contain error. An experiment is truly incomplete without an evaluation of the amount of error in the results. In this course, you will learn to use some common

More information

( x) ( ) F ( ) ( ) ( ) Prob( ) ( ) ( ) X x F x f s ds

( x) ( ) F ( ) ( ) ( ) Prob( ) ( ) ( ) X x F x f s ds Applied Numerical Analysis Pseudo Random Number Generator Lecturer: Emad Fatemizadeh What is random number: A sequence in which each term is unpredictable 29, 95, 11, 60, 22 Application: Monte Carlo Simulations

More information

Review of Statistical Terminology

Review of Statistical Terminology Review of Statistical Terminology An experiment is a process whose outcome is not known with certainty. The experiment s sample space S is the set of all possible outcomes. A random variable is a function

More information

( ) ( ) Monte Carlo Methods Interested in. E f X = f x d x. Examples:

( ) ( ) Monte Carlo Methods Interested in. E f X = f x d x. Examples: Monte Carlo Methods Interested in Examples: µ E f X = f x d x Type I error rate of a hypothesis test Mean width of a confidence interval procedure Evaluating a likelihood Finding posterior mean and variance

More information

19 : Slice Sampling and HMC

19 : Slice Sampling and HMC 10-708: Probabilistic Graphical Models 10-708, Spring 2018 19 : Slice Sampling and HMC Lecturer: Kayhan Batmanghelich Scribes: Boxiang Lyu 1 MCMC (Auxiliary Variables Methods) In inference, we are often

More information

Uncertainty Quantification in Computational Science

Uncertainty Quantification in Computational Science DTU 2010 - Lecture I Uncertainty Quantification in Computational Science Jan S Hesthaven Brown University Jan.Hesthaven@Brown.edu Objective of lectures The main objective of these lectures are To offer

More information

1 Probabilities. 1.1 Basics 1 PROBABILITIES

1 Probabilities. 1.1 Basics 1 PROBABILITIES 1 PROBABILITIES 1 Probabilities Probability is a tricky word usually meaning the likelyhood of something occuring or how frequent something is. Obviously, if something happens frequently, then its probability

More information

NATIONAL UNIVERSITY OF SINGAPORE PC5215 NUMERICAL RECIPES WITH APPLICATIONS. (Semester I: AY ) Time Allowed: 2 Hours

NATIONAL UNIVERSITY OF SINGAPORE PC5215 NUMERICAL RECIPES WITH APPLICATIONS. (Semester I: AY ) Time Allowed: 2 Hours NATIONAL UNIVERSITY OF SINGAPORE PC5215 NUMERICAL RECIPES WITH APPLICATIONS (Semester I: AY 2014-15) Time Allowed: 2 Hours INSTRUCTIONS TO CANDIDATES 1. Please write your student number only. 2. This examination

More information

Major Ideas in Calc 3 / Exam Review Topics

Major Ideas in Calc 3 / Exam Review Topics Major Ideas in Calc 3 / Exam Review Topics Here are some highlights of the things you should know to succeed in this class. I can not guarantee that this list is exhaustive!!!! Please be sure you are able

More information

Coordinate systems and vectors in three spatial dimensions

Coordinate systems and vectors in three spatial dimensions PHYS2796 Introduction to Modern Physics (Spring 2015) Notes on Mathematics Prerequisites Jim Napolitano, Department of Physics, Temple University January 7, 2015 This is a brief summary of material on

More information

Physics 403 Monte Carlo Techniques

Physics 403 Monte Carlo Techniques Physics 403 Monte Carlo Techniques Segev BenZvi Department of Physics and Astronomy University of Rochester Table of Contents 1 Simulation and Random Number Generation Simulation of Physical Systems Creating

More information

Lecture 10: Powers of Matrices, Difference Equations

Lecture 10: Powers of Matrices, Difference Equations Lecture 10: Powers of Matrices, Difference Equations Difference Equations A difference equation, also sometimes called a recurrence equation is an equation that defines a sequence recursively, i.e. each

More information

Taylor series. Chapter Introduction From geometric series to Taylor polynomials

Taylor series. Chapter Introduction From geometric series to Taylor polynomials Chapter 2 Taylor series 2. Introduction The topic of this chapter is find approximations of functions in terms of power series, also called Taylor series. Such series can be described informally as infinite

More information

MITOCW ocw f99-lec01_300k

MITOCW ocw f99-lec01_300k MITOCW ocw-18.06-f99-lec01_300k Hi. This is the first lecture in MIT's course 18.06, linear algebra, and I'm Gilbert Strang. The text for the course is this book, Introduction to Linear Algebra. And the

More information

Topics in Computer Mathematics

Topics in Computer Mathematics Random Number Generation (Uniform random numbers) Introduction We frequently need some way to generate numbers that are random (by some criteria), especially in computer science. Simulations of natural

More information

Main topics for the First Midterm Exam

Main topics for the First Midterm Exam Main topics for the First Midterm Exam The final will cover Sections.-.0, 2.-2.5, and 4.. This is roughly the material from first three homeworks and three quizzes, in addition to the lecture on Monday,

More information

Qualifying Exam CS 661: System Simulation Summer 2013 Prof. Marvin K. Nakayama

Qualifying Exam CS 661: System Simulation Summer 2013 Prof. Marvin K. Nakayama Qualifying Exam CS 661: System Simulation Summer 2013 Prof. Marvin K. Nakayama Instructions This exam has 7 pages in total, numbered 1 to 7. Make sure your exam has all the pages. This exam will be 2 hours

More information

Review of Probability Theory

Review of Probability Theory Review of Probability Theory Arian Maleki and Tom Do Stanford University Probability theory is the study of uncertainty Through this class, we will be relying on concepts from probability theory for deriving

More information

Monte Carlo Methods. PHY 688: Numerical Methods for (Astro)Physics

Monte Carlo Methods. PHY 688: Numerical Methods for (Astro)Physics Monte Carlo Methods Random Numbers How random is random? From Pang: we want Long period before sequence repeats Little correlation between numbers (plot ri+1 vs ri should fill the plane) Fast Typical random

More information

Monte Carlo Integration. Computer Graphics CMU /15-662, Fall 2016

Monte Carlo Integration. Computer Graphics CMU /15-662, Fall 2016 Monte Carlo Integration Computer Graphics CMU 15-462/15-662, Fall 2016 Talk Announcement Jovan Popovic, Senior Principal Scientist at Adobe Research will be giving a seminar on Character Animator -- Monday

More information

Lecture 1: Random number generation, permutation test, and the bootstrap. August 25, 2016

Lecture 1: Random number generation, permutation test, and the bootstrap. August 25, 2016 Lecture 1: Random number generation, permutation test, and the bootstrap August 25, 2016 Statistical simulation 1/21 Statistical simulation (Monte Carlo) is an important part of statistical method research.

More information

Uncertainty. Michael Peters December 27, 2013

Uncertainty. Michael Peters December 27, 2013 Uncertainty Michael Peters December 27, 20 Lotteries In many problems in economics, people are forced to make decisions without knowing exactly what the consequences will be. For example, when you buy

More information

Numerical methods for lattice field theory

Numerical methods for lattice field theory Numerical methods for lattice field theory Mike Peardon Trinity College Dublin August 9, 2007 Mike Peardon (Trinity College Dublin) Numerical methods for lattice field theory August 9, 2007 1 / 37 Numerical

More information

Hypothesis testing I. - In particular, we are talking about statistical hypotheses. [get everyone s finger length!] n =

Hypothesis testing I. - In particular, we are talking about statistical hypotheses. [get everyone s finger length!] n = Hypothesis testing I I. What is hypothesis testing? [Note we re temporarily bouncing around in the book a lot! Things will settle down again in a week or so] - Exactly what it says. We develop a hypothesis,

More information

Today: Fundamentals of Monte Carlo

Today: Fundamentals of Monte Carlo Today: Fundamentals of Monte Carlo What is Monte Carlo? Named at Los Alamos in 940 s after the casino. Any method which uses (pseudo)random numbers as an essential part of the algorithm. Stochastic - not

More information

Parametric Equations, Function Composition and the Chain Rule: A Worksheet

Parametric Equations, Function Composition and the Chain Rule: A Worksheet Parametric Equations, Function Composition and the Chain Rule: A Worksheet Prof.Rebecca Goldin Oct. 8, 003 1 Parametric Equations We have seen that the graph of a function f(x) of one variable consists

More information

Q You mentioned that in complex analysis we study analytic functions, or, in another name, holomorphic functions. Pray tell me, what are they?

Q You mentioned that in complex analysis we study analytic functions, or, in another name, holomorphic functions. Pray tell me, what are they? COMPLEX ANALYSIS PART 2: ANALYTIC FUNCTIONS Q You mentioned that in complex analysis we study analytic functions, or, in another name, holomorphic functions. Pray tell me, what are they? A There are many

More information

Random variables. DS GA 1002 Probability and Statistics for Data Science.

Random variables. DS GA 1002 Probability and Statistics for Data Science. Random variables DS GA 1002 Probability and Statistics for Data Science http://www.cims.nyu.edu/~cfgranda/pages/dsga1002_fall17 Carlos Fernandez-Granda Motivation Random variables model numerical quantities

More information

Introducing the Normal Distribution

Introducing the Normal Distribution Department of Mathematics Ma 3/13 KC Border Introduction to Probability and Statistics Winter 219 Lecture 1: Introducing the Normal Distribution Relevant textbook passages: Pitman [5]: Sections 1.2, 2.2,

More information

Please bring the task to your first physics lesson and hand it to the teacher.

Please bring the task to your first physics lesson and hand it to the teacher. Pre-enrolment task for 2014 entry Physics Why do I need to complete a pre-enrolment task? This bridging pack serves a number of purposes. It gives you practice in some of the important skills you will

More information

Differential Equations

Differential Equations This document was written and copyrighted by Paul Dawkins. Use of this document and its online version is governed by the Terms and Conditions of Use located at. The online version of this document is

More information

Random Variate Generation

Random Variate Generation CPSC 405 Random Variate Generation 2007W T1 Handout These notes present techniques to generate samples of desired probability distributions, and some fundamental results and techiques. Some of this material

More information

Properties of Arithmetic

Properties of Arithmetic Excerpt from "Prealgebra" 205 AoPS Inc. 4 6 7 4 5 8 22 23 5 7 0 Arithmetic is being able to count up to twenty without taking o your shoes. Mickey Mouse CHAPTER Properties of Arithmetic. Why Start with

More information

Quantum Monte Carlo. Matthias Troyer, ETH Zürich

Quantum Monte Carlo. Matthias Troyer, ETH Zürich Quantum Monte Carlo Matthias Troyer, ETH Zürich 1 1. Monte Carlo Integration 2 Integrating a function Convert the integral to a discrete sum b! f (x)dx = b " a N a N ' i =1 # f a + i b " a % $ N & + O(1/N)

More information

Today: Fundamentals of Monte Carlo

Today: Fundamentals of Monte Carlo Today: Fundamentals of Monte Carlo What is Monte Carlo? Named at Los Alamos in 1940 s after the casino. Any method which uses (pseudo)random numbers as an essential part of the algorithm. Stochastic -

More information

Math (P)Review Part I:

Math (P)Review Part I: Lecture 1: Math (P)Review Part I: Linear Algebra Computer Graphics CMU 15-462/15-662, Fall 2017 Homework 0.0 (Due Monday!) Exercises will be a bit harder / more rigorous than what you will do for the rest

More information

General Principles in Random Variates Generation

General Principles in Random Variates Generation General Principles in Random Variates Generation E. Moulines and G. Fort Telecom ParisTech June 2015 Bibliography : Luc Devroye, Non-Uniform Random Variate Generator, Springer-Verlag (1986) available on

More information

2008 Winton. Review of Statistical Terminology

2008 Winton. Review of Statistical Terminology 1 Review of Statistical Terminology 2 Formal Terminology An experiment is a process whose outcome is not known with certainty The experiment s sample space S is the set of all possible outcomes. A random

More information

Monte Carlo integration (naive Monte Carlo)

Monte Carlo integration (naive Monte Carlo) Monte Carlo integration (naive Monte Carlo) Example: Calculate π by MC integration [xpi] 1/21 INTEGER n total # of points INTEGER i INTEGER nu # of points in a circle REAL x,y coordinates of a point in

More information

Physics 403. Segev BenZvi. Monte Carlo Techniques. Department of Physics and Astronomy University of Rochester

Physics 403. Segev BenZvi. Monte Carlo Techniques. Department of Physics and Astronomy University of Rochester Physics 403 Monte Carlo Techniques Segev BenZvi Department of Physics and Astronomy University of Rochester Table of Contents 1 Simulation and Random Number Generation Simulation of Physical Systems Creating

More information

Statistics 100A Homework 5 Solutions

Statistics 100A Homework 5 Solutions Chapter 5 Statistics 1A Homework 5 Solutions Ryan Rosario 1. Let X be a random variable with probability density function a What is the value of c? fx { c1 x 1 < x < 1 otherwise We know that for fx to

More information

8.3 Partial Fraction Decomposition

8.3 Partial Fraction Decomposition 8.3 partial fraction decomposition 575 8.3 Partial Fraction Decomposition Rational functions (polynomials divided by polynomials) and their integrals play important roles in mathematics and applications,

More information

ter. on Can we get a still better result? Yes, by making the rectangles still smaller. As we make the rectangles smaller and smaller, the

ter. on Can we get a still better result? Yes, by making the rectangles still smaller. As we make the rectangles smaller and smaller, the Area and Tangent Problem Calculus is motivated by two main problems. The first is the area problem. It is a well known result that the area of a rectangle with length l and width w is given by A = wl.

More information

16 : Approximate Inference: Markov Chain Monte Carlo

16 : Approximate Inference: Markov Chain Monte Carlo 10-708: Probabilistic Graphical Models 10-708, Spring 2017 16 : Approximate Inference: Markov Chain Monte Carlo Lecturer: Eric P. Xing Scribes: Yuan Yang, Chao-Ming Yen 1 Introduction As the target distribution

More information

DUBLIN CITY UNIVERSITY

DUBLIN CITY UNIVERSITY DUBLIN CITY UNIVERSITY SAMPLE EXAMINATIONS 2017/2018 MODULE: QUALIFICATIONS: Simulation for Finance MS455 B.Sc. Actuarial Mathematics ACM B.Sc. Financial Mathematics FIM YEAR OF STUDY: 4 EXAMINERS: Mr

More information

Project 6 - Calculating π and using building models for data

Project 6 - Calculating π and using building models for data Project 6 - Calculating π and using building models for data MTH337 - Fall 2018 Due date: November 29, 2018 Instructor - Rahul Kashyap Part 1 - Calculating the value of π The mathematical constant π is

More information

Monte Carlo Lecture Notes II, Jonathan Goodman. Courant Institute of Mathematical Sciences, NYU. January 29, 1997

Monte Carlo Lecture Notes II, Jonathan Goodman. Courant Institute of Mathematical Sciences, NYU. January 29, 1997 Monte Carlo Lecture Notes II, Jonathan Goodman Courant Institute of Mathematical Sciences, NYU January 29, 1997 1 Introduction to Direct Sampling We think of the computer \random number generator" as an

More information

Chapter 3 sections. SKIP: 3.10 Markov Chains. SKIP: pages Chapter 3 - continued

Chapter 3 sections. SKIP: 3.10 Markov Chains. SKIP: pages Chapter 3 - continued Chapter 3 sections Chapter 3 - continued 3.1 Random Variables and Discrete Distributions 3.2 Continuous Distributions 3.3 The Cumulative Distribution Function 3.4 Bivariate Distributions 3.5 Marginal Distributions

More information

Recursive Estimation

Recursive Estimation Recursive Estimation Raffaello D Andrea Spring 08 Problem Set : Bayes Theorem and Bayesian Tracking Last updated: March, 08 Notes: Notation: Unless otherwise noted, x, y, and z denote random variables,

More information

Chapter 8: An Introduction to Probability and Statistics

Chapter 8: An Introduction to Probability and Statistics Course S3, 200 07 Chapter 8: An Introduction to Probability and Statistics This material is covered in the book: Erwin Kreyszig, Advanced Engineering Mathematics (9th edition) Chapter 24 (not including

More information

[Disclaimer: This is not a complete list of everything you need to know, just some of the topics that gave people difficulty.]

[Disclaimer: This is not a complete list of everything you need to know, just some of the topics that gave people difficulty.] Math 43 Review Notes [Disclaimer: This is not a complete list of everything you need to know, just some of the topics that gave people difficulty Dot Product If v (v, v, v 3 and w (w, w, w 3, then the

More information

MATH 230 CALCULUS II OVERVIEW

MATH 230 CALCULUS II OVERVIEW MATH 230 CALCULUS II OVERVIEW This overview is designed to give you a brief look into some of the major topics covered in Calculus II. This short introduction is just a glimpse, and by no means the whole

More information

Math 5a Reading Assignments for Sections

Math 5a Reading Assignments for Sections Math 5a Reading Assignments for Sections 4.1 4.5 Due Dates for Reading Assignments Note: There will be a very short online reading quiz (WebWork) on each reading assignment due one hour before class on

More information

Independent Events. Two events are independent if knowing that one occurs does not change the probability of the other occurring

Independent Events. Two events are independent if knowing that one occurs does not change the probability of the other occurring Independent Events Two events are independent if knowing that one occurs does not change the probability of the other occurring Conditional probability is denoted P(A B), which is defined to be: P(A and

More information

September Math Course: First Order Derivative

September Math Course: First Order Derivative September Math Course: First Order Derivative Arina Nikandrova Functions Function y = f (x), where x is either be a scalar or a vector of several variables (x,..., x n ), can be thought of as a rule which

More information

Midterm Exam 1 (Solutions)

Midterm Exam 1 (Solutions) EECS 6 Probability and Random Processes University of California, Berkeley: Spring 07 Kannan Ramchandran February 3, 07 Midterm Exam (Solutions) Last name First name SID Name of student on your left: Name

More information

Solution to Assignment 3

Solution to Assignment 3 The Chinese University of Hong Kong ENGG3D: Probability and Statistics for Engineers 5-6 Term Solution to Assignment 3 Hongyang Li, Francis Due: 3:pm, March Release Date: March 8, 6 Dear students, The

More information