## Lesson Summary

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

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

## CSP Objectives

Big Idea - Creativity
• EU 1.2 - Computing enables people to use creative development processes to create computational artifacts for creative expression or to solve a problem.
• LO 1.2.1 - Create a computational artifact for creative expression. [P2]
• EK 1.2.1B - Creating computational artifacts requires understanding of and use of software tools and services.
• EK 1.2.1C - Computing tools and techniques are used to create computational artifacts and can include, but are not limited to, programming integrated development environments (IDEs), spreadsheets, three-dimensional (3-D) printers, or text editors.
• LO 1.2.4 - Collaborate in the creation of computational artifacts. [P6]
• EK 1.2.4A - A collaboratively created computational artifact reflects effort by more than one person.
Big Idea - Abstraction
• EU 2.3 - Models and simulations use abstraction to generate new understanding and knowledge.
• LO 2.3.1 - Use models and simulations to represent phenomena. [P3]
• EK 2.3.1A - Models and simulations are simplified representations of more complex objects or phenomena.
• EK 2.3.1B - Models may use different abstractions or levels of abstraction depending on the objects or phenomena being posed.
• EK 2.3.1C - Models often omit unnecessary features of the objects or phenomena that are being modeled.
• EK 2.3.1D - Simulations mimic real-world events without the cost or danger of building and testing the phenomena in the real world.
• LO 2.3.2 - Use models and simulations to formulate, refine, and test hypotheses. [P3]
• EK 2.3.2A - Models and simulations facilitate the formulation and refinement of hypotheses related to the objects or phenomena under consideration.
• EK 2.3.2B - Hypotheses are formulated to explain the objects or phenomena being modeled.
• EK 2.3.2C - Hypotheses are refined by examining the insights that models and simulations provide into the objects or phenomena.
• EK 2.3.2D - The results of simulations may generate new knowledge and new hypotheses related to the phenomena being modeled.
• EK 2.3.2E - Simulations allow hypotheses to be tested without the constraints of the real world.
• EK 2.3.2F - Simulations can facilitate extensive and rapid testing of models.
• EK 2.3.2G - The time required for simulations is impacted by the level of detail and quality of the models and the software and hardware used for the simulation.
• EK 2.3.2H - Rapid and extensive testing allows models to be changed to accurately reflect the objects or phenomena being modeled.
Big Idea - Data
• EU 3.1 - People use computer programs to process information to gain insight and knowledge.
• LO 3.1.2 - Collaborate when processing information to gain insight and knowledge. [P6]
Big Idea - Algorithms
• EU 4.1 - Algorithms are precise sequences of instructions for processes that can be executed by a computer and are implemented using programming languages.
• LO 4.1.1 - Develop an algorithm for implementation in a program. [P2]
• EK 4.1.1A - Sequencing, selection, and iteration are building blocks of algorithms.
• EK 4.1.1B - Sequencing is the application of each step of an algorithm in the order in which the statements are given.
• EK 4.1.1C - Selection uses a Boolean condition to determine which of two parts of an algorithm is used.
• EK 4.1.1D - Iteration is the repetition of part of an algorithm until a condition is met or for a specified number of times.
• EK 4.1.1G - Knowledge of standard algorithms can help in constructing new algorithms.
• EK 4.1.1I - Developing a new algorithm to solve a problem can yield insight into the problem.
• LO 4.1.2 - Express an algorithm in a language. [P5]
• EK 4.1.2A - Languages for algorithms include natural language, pseudocode, and visual and textual programming languages.
• EK 4.1.2B - Natural language and pseudocode describe algorithms so that humans can understand them.
• EK 4.1.2C - Algorithms described in programming languages can be executed on a computer.
Big Idea - Programming
• EU 5.1 - Programs can be developed for creative expression, to satisfy personal curiosity, to create new knowledge, or to solve problems (to help people, organizations, or society).
• LO 5.1.1 - Develop a program for creative expression, to satisfy personal curiosity, or to create new knowledge. [P2]
• EK 5.1.1A - Programs are developed and used in a variety of ways by a wide range of people depending on the goals of the programmer.
• EK 5.1.1B - Programs developed for creative expression, to satisfy personal curiosity, or to create new knowledge may have visual, audible, or tactile inputs and outputs.
• EK 5.1.1E - A computer program or the results of running a program may be rapidly shared with a large number of users and can have widespread impact on individuals, organizations, and society.
• LO 5.1.2 - Develop a correct program to solve problems. [P2]
• EK 5.1.2A - An iterative process of program development helps in developing a correct program to solve problems.
• EK 5.1.2G - Program development includes identifying programmer and user concerns that affect the solution to problems.
• EK 5.1.2I - A programmer's knowledge and skill affects how a program is developed and how it is used to solve a problem.
• EK 5.1.2J - A programmer designs, implements, tests, debugs, and maintains programs when solving problems.
• EU 5.3 - Programming is facilitated by appropriate abstractions.
• LO 5.3.1 - Use abstraction to manage complexity in programs. [P3]
• EK 5.3.1A - Procedures are reusable programming abstractions.
• EK 5.3.1B - A procedure is a named grouping of programming instructions.
• EK 5.3.1C - Procedures reduce the complexity of writing and maintaining programs.
• EK 5.3.1D - Procedures have names and may have parameters and return values.
• EK 5.3.1H - Data abstraction provides a means of separating behavior from implementation.
• EK 5.3.1K - Lists and list operations, such as add, remove, and search, are common in many programs.
• EK 5.3.1L - Using lists and procedures as abstractions in programming can result in programs that are easier to develop and maintain.
• EU 5.5 - Programming uses mathematical and logical concepts.
• LO 5.5.1 - Employ appropriate mathematical and logical concepts in programming. [P1]
• EK 5.5.1A - Numbers and numerical concepts are fundamental to programming.
• EK 5.5.1D - Mathematical expressions using arithmetic operators are part of most programming languages.
• EK 5.5.1E - Logical concepts and Boolean algebra are fundamental to programming.

## Math Common Core Practice:

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

## Common Core Math:

• 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

## Common Core ELA:

• 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

## NGSS Practices:

• 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

## Key Concepts

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.

## Essential Questions

• 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 algorithms implemented and executed on computers and computational devices?
• How are programs developed to help people, organizations or society solve problems?
• How are programs used for creative expression, to satisfy personal curiosity or to create new knowledge?
• How do computer programs implement algorithms?
• How do people develop and test computer programs?
• Which mathematical and logical concepts are fundamental to computer programming?

## Teacher Resources

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

# Getting Started (10 min)

Journal:

• Models and simulations are simplified representations of more complex objects or phenomena.
• What is a complex, everyday phenomena that is studied using models and simulations?
• Models often omit unnecessary features of the objects or phenomena that are being modeled.
• What features might a flight simulator program leave out to make the program easier to use and run faster?
• Simulations mimic real-world events without the cost or danger of building and testing the phenomena in the real world.
• What is something random that could be tested more easily with a computer than by building the real thing?

Have students share their answers with the class.

# Guided Activities (35 min)

## Activity 1 (15 min) - Designing a Simulation (rolling dice)

1. Explain that many simulations include randomized events to simulate reality.
• What unnessecary details can be omitted if you need to create a random outcome?
• [Possible answers: you only need to choose a random number and then use selection to choose which block of code to execute as a result]
2. Arrange the class into small groups (two or three).
3. 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.
4. Have a representative from each group describe their plan for the algorithm. (After the first group, subsequent groups could highlight similarities and differences.)
5. 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.)
6. 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.)

## Activity 2 (20 min) - Using a Simulation to Test a Hypothesis

1. 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.
2. 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.)
3. The students should be paired up and begin writing the code necessary to test the hypothesis.
4. 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.
5. 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).
6. As data is collected, students should determine whether their hypothesis was correct or whether it needs to be modified.
7. 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?)

# Wrap Up (5 min)

Ask the class: What are the advantages/disadvantages of using a program vs. actual dice? How quickly can the computer generate thousands of test cases? Can the computer be used to analyze the test cases as well as to generate the random numbers?

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

## Options for Differentiated Instruction

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.

### Extension #1 - Penny Flipping

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?

### Extension - The Monty Hall Problem

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://www.math.ucsd.edu/~crypto/Monty/monty.html

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

## Formative Assessment

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.

## Summative Assessment

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.