Foundation Chap5 - Chapter 5 Randomness 5.1 Safety in...

Info icon This preview shows pages 1–4. Sign up to view the full content.

Chapter 5 Randomness § 5.1 Safety in Numbers Estimating Expected Value and Probability § 5.2 Finding the Edge Random Walks § 5.3 Order From Randomness Polygon Averaging Using the computer to simulate random processes sounds like an impossible task. Computer programs execute with total predictability, which is about as far as you can get from dice rolling, brownian motion, and chance mutation. But these are deep waters: God does not play dice with the universe” - Albert Einstein All nature is but art unknown to thee; All chance, direction which thou canst not see; - Alexander Pope Chance favors the prepared mind - Louis Pasteur The message here is that perhaps there are more connections between the random and nonrandom than meet the (human) eye. This is precisiely the case when we use rand and randn . These functions are capable of generating seemingly random sequences of real numbers. We shall not be concerned with an assessment of their quality. (Statistically speaking—they turn out to be great.) Instead, we focus on how they can be used to simulate random events. In § 5.1 we show how to estimate the expected value of a random variable and how to estimate the probability of a random event. The classic example of random walks is considered in § 5.2. In § 5.3 we present a simulation that starts with a randomized situation proceeds to “establish order” through a repeated averaging process. 1
Image of page 1

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

Example 5.1 Estimating Probability and Expected Value % Script Eg5_1 % Estimates the expected value of Gap(N) and the % probability that Gap(N) <= 4N. close all clear % Check N-values 1,2,...,maxN and base estimates on M games... maxN = 10; M = 1000; for N = 1:maxN E(N) = EVGap(N,M); P(N) = P4NGap(N,M); end plot(E) title(’Expected Value of Gap(N)’,’Fontsize’,14) xlabel(’N’,’Fontsize’,14) set(gca,’xTick’,linspace(1,maxN,maxN),’xTickLabel’,linspace(1,maxN,maxN)) ylabel(’Expected Value’,’Fontsize’,14) axis([1 maxN 0 inf]); grid on figure plot(P) title(’Probability that Gap(N) <= 4*N’,’Fontsize’,14) xlabel(’N’,’Fontsize’,14) set(gca,’xTick’,linspace(1,maxN,maxN),’xTickLabel’,linspace(1,maxN,maxN)) ylabel(’Probability’,’Fontsize’,14) set(gca,’yTick’,linspace(0,1,11),’yTickLabel’,linspace(0,1,11)) axis([1 maxN 0 1]); grid on Sample Output 1 2 3 4 5 6 7 8 9 10 0 10 20 30 40 50 60 70 80 90 Expected Value of Gap(N) N Expected Value 1 2 3 4 5 6 7 8 9 10 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 Probability that Gap(N) <= 4*N N Probability 2
Image of page 2
5.1. Safety in Numbers 3 5.1 Safety in Numbers Problem Let N be a positive integer. In a game of “Gap N ”, a fair coin is repeatedly tossed until the di ff erence between the number of heads and the number of tails is N . The “score” is the number of required tosses. Thus if N = 3 and HTTHTHTTHTT is the sequence of coin tosses, then the score is 11. Notice that | #tosses #heads | < 3 until the 11th toss. For a given N , what is the expected value (i.e., the average value) of the score? What is the probability that the game is over on or before the 4 N th toss? Give approximate answers to these questions based upon the simulation of a large number of games.
Image of page 3

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

Image of page 4
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern