lecturenotes01

lecturenotes01 - MS&E 223 Simulation Peter J. Haas Lecture...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
MS&E 223 Lecture Notes #1 Simulation Introduction to Simulation Peter J. Haas Spring Quarter 2009-10 Introduction to Simulation 1. What Is Simulation? (Law: Sections 1.1, 1.2, 1.9) Example : Consider a gambling game in which a fair coin is repeatedly flipped until |#heads - #tails| = 3. The player receives $8.99 at the end of the game but must pay $1 for each coin flip. (No quitting in the middle of the game.) Is this game a good bet over the long run? That is, what is the expected reward? This is a simple example of decision-making under uncertainty (to play or not to play). There are three ways to proceed: 1. Try to compute the answer analytically (not easy). 2. Experiment by playing the game a number of times. Use the average reward over all of the games as an estimate of the expected reward (rather time-consuming). 3. Use the power of the computer to experiment, and use the average reward as an estimate of the expected reward. AKA - Simulation! How do we mimic this game on a computer? Most computer languages permit generation of a sequence of “random” numbers U 1 , U 2 , … , each distributed uniformly between 0 and 1; e.g., the commands U = (float)rand()/MAX_RAND in C or U = Math.random() in Java. (Although for serious work you might want to use a different random number generator such as the one on the class website we’ll get back to this topic later.) For the i th coin toss, generate U i and say that the coin toss is “heads” if 0 U i 0.5 and “tails” if 0.5 < U i 1. Simulation must be performed carefully , however. For example, I simulated 1000 plays of the game, using the program on the web site, and found that the average return was $0.26---sounds good! But, using techniques that will be discussed later, I computed a 95% confidence interval of [-$0.16, $0.67]. In other words, there’s no way to tell whether this game is a good bet or not! To get the real answer, more simulations are needed. Indeed, using techniques that we will discuss, I estimated that between 7-8 million replications are needed to get an accuracy of within +/- $.005. I ran 7,000,000 replications, and got an average return of –$0.01 and a confidence interval of [-$0.0123, -$0.0021]. It turns out (using the theory of “gambler’s ruin”) that -$0.01 is the true answer, but that the returns are extremely variable. Definition(s): Simulation can be broadly defined as a technique for studying real-world dynamical systems by imitating their behavior using a mathematical model of the system implemented on a digital computer . Page 1 of 9
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
MS&E 223 Lecture Notes #1 Simulation Introduction to Simulation Peter J. Haas Spring Quarter 2009-10 In this course, we will focus on dynamical systems in which uncertainty is present (as in our example). We are then dealing with stochastic simulation , which may be defined as a controlled statistical sampling technique that can be used to study complex stochastic systems when analytical or numerical techniques do not suffice . (Q: can you give an example of a nonstochastic simulation?) Simulation can also be viewed as a numerical technique for solving complicated probability models ,
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 05/06/2010 for the course MSE 223 taught by Professor Unknown during the Spring '09 term at Stanford.

Page1 / 9

lecturenotes01 - MS&E 223 Simulation Peter J. Haas Lecture...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online