4 - 3
# Using Data and Simulations

**Revision Date:** Sep 21, 2015
(Version 1.2)

**Duration:** 1 50-minute session

0b100 - 0b11

Unit 4. Data Acquisition

**Summary**

Students will formulate a hypothesis, run simulations, and analyze the results to determine what needs to be modified in their hypothesis and/or the simulation itself.

**Outcomes**

- Students will identify and create real-world examples of models and simulations.
- Students will use models and simulations to generate new knowledge and to formulate, refine, and test hypotheses.
- Students will use simulations to test hypotheses without the constraints of the real world.

**Overview**

- Getting Started (10 min)
- Guided Activities (35 min)
- Activity 1 - Rolling Dice Simulation, materials - large paper and markers or other method to share group work [15 minutes]
- Activity 2 - Using a Simulation to Test a Hypothesis [20 minutes]

- Wrap Up (5 min)

**Source**

The coin flipping extension is based on a CS10K lesson: https://sites.google.com/site/mobilecsp/lesson-plans/lp-coinflip-miniprojects

- MP2: Reason abstractly and quantitatively.
- MP3: Construct viable arguments and critique the reasoning of others.

- F-BF.1-2: Build a function that models a relationship between two quantities
- S-ID.1-4: Summarize, represent, and interpret data on a single count or measurement variable

- RST 12.7 - Integrate and evaluate multiple sources of information presented in diverse formats and media
- RST 12.8 - Evaluate the hypotheses, data, analysis, and conclusions in a science or technical text
- RST 12.9 - Synthesize information from a range of sources

- 3. Planning and carrying out investigations
- 4. Analyzing and interpreting data
- 5. Using mathematics and computational thinking
- 6. Constructing explanations (for science) and designing solutions (engineering)
- 8. Obtaining, evaluation, and communicating information

Students will be able to:

- identify and create real-world examples of models and simulations.
- use models and simulations to generate new knowledge and to formulate, refine, and test hypotheses.
- use simulations to test hypotheses without the constraints of the real world.

- How can computational models and simulations help generate new understanding and knowledge?
- How can computation be employed to help people process data and information to gain insight and knowledge?
- How are programs developed to help people, organizations or society solve problems?

Student computer usage for this lesson is: **required**

The PowerPoint "Using Data and Simulations" can be found in the Lesson Resources folder.

Penny Bias article to go with lesson extension: http://mathtourist.blogspot.com/2011/02/penny-bias.html

For the Monty Hall Problem extension:

Online simulation of the problem: http://math.ucsd.edu/~crypto/cgi-bin/MontyKnows/monty2?1+17427

There are several videos on YouTube demonstrating and explaining the Monty Hall Problem.

An animated video: https://www.youtube.com/watch?v=mhlc7peGlGg length is 5:48

Live action video: https://www.youtube.com/watch?v=4Lb-6rxZxx0 length is 5:30

There is sample code for the die Python program in the Lesson Resources Folder called 4-3 Sample Code.py

**Journal:**

- Describe a situation that can be modeled by rolling one die.
- Describe a situation that can be modeled by rolling two dice.
- (Consider possible outcomes and the likelihood of each outcome.)

Have students share their answers with the class.

- Arrange the class into small groups (two or three).
- The groups are to develop an algorithm and write a program to simulate rolling a standard six-sided die.
- The program should ask for the number of rolls and display the results (number of each possible outcome that was rolled).
**Note: The students will need to use the randint function to write this code.**`import random`

at the top of the code`random.randint(min,max)`

returns a 'random' integer between the min and max values (inclusive).

- Remind students to use functions where appropriate.
- Students are encouraged to write their plan (flow chart or pseudocode) on large paper or some other method to enable later sharing with the class.

- Have a representative from each group describe their plan for the algorithm. (After the first group, subsequent groups could highlight similarities and differences.)
- Next, have each group discuss and implement changes to their algorithm and programs to simulate rolling two dice. (When providing directions, ask the class how using functions in the previous exercise would make this change easier to implement.)
- As a class, discuss how many times the program should "roll" the dice. (Be sure students note that every possible value should be displayed, especially upper and lower bounds.)

- Each group should develop a hypothesis to answer the question: Can a twelve-sided die be used in place of rolling two six-sided dice? Each group should agree on a hypothesis and write it down.
- The groups already have a design for rolling two six-sided dice. They should now design an algorithm for rolling a twelve-sided die. (This process can involve creating a new function or modifying the current function's parameters to accept the number of sides.)
- The students should be paired up and begin writing the code necessary to test the hypothesis.
- Once they finish the code, students should run both simulations to compare results.
**Note: Students need to save their code. They will be using it in the next lesson's homework.** - As students complete their simulations, if possible, have each pair share their data with the class (in a spreadsheet displayed by the teacher's computer, or on the white board, or large paper).
- As data is collected, students should determine whether their hypothesis was correct or whether it needs to be modified.
- Analyze with the class if the simulations themselves were implemented correctly. (Does the data represent the expected theoretical outcomes? How can you modify the program to correct any errors?)

Ask the class: Does your program represent a sufficient simulation for rolling dice? What are the advantages/disadvantages of using a program vs. actual dice?

**Journal:** Summarize how a program can be used as a simulation to test a hypothesis.

Students can be provided with the code for a function to simulate rolling one die and use it to develop the rest of the program.

After the first group activity, the teacher can swap a student from each group to allow different input into the next group activity.

This extension is based on advanced mini project # 4, which can be found here: https://docs.google.com/a/smcps.org/document/d/1AKHpiQ87bE4W1YzHlAFh2uNAHuEtdMOCQVV6HfxfDzc/edit

Students read an article about the 'randomness' of flipping a penny: http://mathtourist.blogspot.com/2011/02/penny-bias.html

Next, students should hypothesize the results of lining up 10 pennies on edge and knocking them over (as described in the article). Students need to determine how many times to run the experiment, collect data, and analyze the results.

Students should work in pairs to write a computer simulation for the penny experiment. (Note: this is a program based on experimental data, not theoretical.)

Discuss as a class the validity of the simulation written. Can this simulation be used for other coins?

In the game show "Let's Make a Deal", the original host was Monty Hall. Onvery show, Monty would present a player with three doors or curtains to choose from. The contestant was asked to choose a door in search of a prize. After making a selection, Monty Hall would open one of the doors not selected by the contestant to reveal a non-prize (perhaps a goat). Then Monty would ask if the contestant wanted to change their choice.

After explaining the show to the class ask, "Should the contestant change?" Students should propose a hypothesis.

Have the students design a simulation to test their hypothesis (discuss what is the data collected and the number of times the simulation should run to collect data). After running the simulation, students should evaluate their hypothesis and determine whether it needs to be modified or whether the simulation needs to be modified.

If Monty Hall had four doors, what should the contestant do?

What should the contestant do if they know that Monty does not know what is behind each door?

Online simulation of the problem: http://math.ucsd.edu/~crypto/cgi-bin/MontyKnows/monty2?1+17427

There are several videos on YouTube demonstrating and explaining the Monty Hall Problem.

An animated video: https://www.youtube.com/watch?v=mhlc7peGlGg length is 5:48

Live action video: https://www.youtube.com/watch?v=4Lb-6rxZxx0 length is 5:30

Review student journal entries and class discussions to determine students' understanding of simulations, a hypothesis, and the ability to determine a method to test a hypothesis.

Describe an algorithm to simulate drawing an ace of any suit from a standard deck of cards.

Make a hypothesis about drawing cards from a standard deck of cards and determine how to collect data to answer your hypothesis.