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

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

View Full Document Right Arrow Icon
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; -A lexanderPope Chance favors the prepared mind -Lou isPasteur 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 focusonhowtheycanbeusedtos imu laterandomevents .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
Background image of page 1

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

View Full DocumentRight Arrow Icon
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
Background 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 f erence between the number of heads and the number of tails is N .T h e“ s c o r e ”i s the number of required tosses. Thus if N =3and HTTHTHTTHTT is the sequence of coin tosses, then the score is 11. Notice that |
Background image of page 3

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

View Full DocumentRight Arrow Icon
Image of page 4
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 19

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

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

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