4.3a Simulating Experiments Target Goal: I can use simulation to represent an experiment. In class...

Post on 21-Jan-2016

218 views 0 download

Transcript of 4.3a Simulating Experiments Target Goal: I can use simulation to represent an experiment. In class...

4.3a4.3aSimulating Experiments Simulating Experiments

Target Goal: I can use simulation to Target Goal: I can use simulation to represent an experiment. represent an experiment.

In class FRIn class FR

QuestionQuestion:: In a class of 23 unrelated students (no twins!), In a class of 23 unrelated students (no twins!),

what is the chance that at least two students what is the chance that at least two students have the same birthday?have the same birthday?

In a room of 41 people?In a room of 41 people? In a room of 50 people?In a room of 50 people?

To determine the chance of this To determine the chance of this event, we can:event, we can:

1.1. Conduct an experiment and measure the Conduct an experiment and measure the outcomes.outcomes.

ProblemProblem: : we have to find many classes we have to find many classes of the correct size; a lot of time & effort.of the correct size; a lot of time & effort.

REPLICATION

2.2. Calculate the theoretical probability Calculate the theoretical probability using the mathematical laws of using the mathematical laws of probability.probability.

ProblemProblem:: the formulas can be the formulas can be complicated or involve higher complicated or involve higher mathematics.mathematics.

SimulationSimulation

3.3. SimulateSimulate an experiment using a model that an experiment using a model that is similar to this real life event.is similar to this real life event.

An An that that uses uses event is calledevent is called

simulationsimulation..

A well-designed model will yield accurate A well-designed model will yield accurate results for a large number of trials.results for a large number of trials.

imitation of chance behaviorimitation of chance behaviora model to imitate a real lifea model to imitate a real life

Independence Is Important!Independence Is Important!

TThe result of one toss of a coin, for example, he result of one toss of a coin, for example, has no effect on the next toss.has no effect on the next toss.

Steps Involved in SimulationSteps Involved in Simulation

1.1. State the problem or describe the State the problem or describe the experiment.experiment.

2.2. State the assumptions.State the assumptions.

3.3. Assign a digit to each outcome.Assign a digit to each outcome.

4.4. Simulate many repetitions.Simulate many repetitions.

5.5. State your conclusions.State your conclusions.

ExampleExample: Birthday : Birthday

1.1. In a class of 23 unrelated students, what is In a class of 23 unrelated students, what is the chance that at least two students have the the chance that at least two students have the same birthday?same birthday?

2.2. We assume all possible birthdays are equally We assume all possible birthdays are equally likely, and that one student’s birthday is likely, and that one student’s birthday is independent of the other students’ birthdays.independent of the other students’ birthdays.

3.3. Assign numbers 1-365 to each day of the Assign numbers 1-365 to each day of the year.year.

4.4. Randomly choose 23 numbers and look to Randomly choose 23 numbers and look to see if any are duplicated.see if any are duplicated. Record the results Record the results in a table.in a table.

randInt (1, 365, 23) randInt (1, 365, 23) L1 L1Repeat until you have completed Repeat until you have completed many (10)many (10) trials. Fill in following tabletrials. Fill in following table . (20 or more would be . (20 or more would be better. Do 10 for time sake.)better. Do 10 for time sake.)

Sort data and repeat for 10 trials.Record in table.

5.5. In a class of 23 unrelated students, the chance In a class of 23 unrelated students, the chance that at least two students have the same that at least two students have the same birthday is approximately _______.birthday is approximately _______.

Number of Number of students with the students with the same birthday same birthday

Tally Tally Relative Relative Frequency Frequency

None None

At least 2 At least 2

Total # of TrialsTotal # of Trials

Example 5.21Example 5.21A Girl in the FamilyA Girl in the Family

A couple wants A couple wants a girl or 4 children,a girl or 4 children, whichever comes first. What are the chances whichever comes first. What are the chances they will have a girl among their children?they will have a girl among their children?

1.1. Wants girl or 4 children at most.Wants girl or 4 children at most.

2.2. Assume numbers in Table B equally likely Assume numbers in Table B equally likely and independent.and independent.

3.3. Table D: Table D: 0, 1, 2, 3, 4: girl0, 1, 2, 3, 4: girl

5, 6, 7, 8, 9: boy5, 6, 7, 8, 9: boy

4.4. Read digits from Table D until couple has Read digits from Table D until couple has either either a girl or 4 children. Use line 130 of a girl or 4 children. Use line 130 of Table B. (+ girl born, - no girl born): 25 trailsTable B. (+ girl born, - no girl born): 25 trails

690690//51 64817 09517 84534 06489 8720151 64817 09517 84534 06489 87201BBG/BGBBG/BG

+ ++ +

Our estimate of the probability that this Our estimate of the probability that this strategy will produce a girl is in these 25 trails:strategy will produce a girl is in these 25 trails:

# that produced a girl # that produced a girl = _____ == _____ =

# trials # trials 2524 .960

Ways to Assign DigitsWays to Assign Digits

a) Tablea) Table

b) Calculatorb) Calculator

c) Computer softwarec) Computer software

Assigning Digits with Table BAssigning Digits with Table B

Example:Example: Choose person at random from Choose person at random from group which 70% are employed:group which 70% are employed:

Table: Table: one digit represents 1 personone digit represents 1 person

Label: Label: 0, 1, 2, 3, 4, 5, 6 = employed0, 1, 2, 3, 4, 5, 6 = employed

7, 8, 9 = not employed7, 8, 9 = not employed

Example: Example: Choose person at random from Choose person at random from group which 73% employed:group which 73% employed:

Table: Table: two digits represent 1 persontwo digits represent 1 person

Label: Label: 00, 01, 02, …, 72 = employed00, 01, 02, …, 72 = employed

73, 74, …, 99 = not employed 73, 74, …, 99 = not employed

““Randint” examplesRandint” examples

Randint (0,9,5):Randint (0,9,5): generates 5 random generates 5 random integers between 0 and 9.integers between 0 and 9.

Could serve as a block of 5 vs. table.Could serve as a block of 5 vs. table. Randint (1,6,7):Randint (1,6,7):

Could simulate rolling die 7 timesCould simulate rolling die 7 times..

Exercise (with shoulder partner)Exercise (with shoulder partner)Establishing a Correspondence Establishing a Correspondence State how you would use the following aids to State how you would use the following aids to establish a correspondence in a simulation that establish a correspondence in a simulation that involves a involves a 75% chance75% chance..A coin:A coin:If youIf you flip a coin twice, how many possible flip a coin twice, how many possible outcomes?outcomes?44

Let HH mean failure.Let HH mean failure. Let the other three outcomesLet the other three outcomes

HT, TH, TT be success.HT, TH, TT be success.

75% chance75% chance

A six-sided die: A six-sided die: Let 1, 2, 3 be success.Let 1, 2, 3 be success. Let 4 mean failure.Let 4 mean failure.

If you roll a 5 or 6 ignore then and roll If you roll a 5 or 6 ignore then and roll again.again.

75% chance75% chance

A random digit table (Table B): A random digit table (Table B): Peel off two digit numbers from the table.Peel off two digit numbers from the table. Let 01 through 75 mean success.Let 01 through 75 mean success. Let 76 through 99 and 00 mean failure.Let 76 through 99 and 00 mean failure.

75% chance75% chance

A standard deck of playing cards: A standard deck of playing cards:

Let Let hearts, diamondshearts, diamonds, and , and spadespade be be success.success.

Let Let club be failure.club be failure.