Intro CS – Probability and Random Numbers

Slides:



Advertisements
Similar presentations
Summer Computing Workshop. Introduction to Variables Variables are used in every aspect of programming. They are used to store data the programmer needs.
Advertisements

Copyright © 2006 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Slide
Probability What are your Chances?
Mathematics in Today's World
Describing Probability
Programming with Alice Computing Institute for K-12 Teachers Summer 2011 Workshop.
AP Statistics Section 6.2 A Probability Models
Lesson  In this investigation you will explore the predictability of random outcomes. You will use a familiar random process, the flip of a coin.
Lesson 12 – Do Now Do now Expectations: No talking for any reason, please. 1)Solve for the equation: 2)If a $40 shirt is discounted 30%, what is the sale.
Chapter 11 – Understanding Randomness 1. What is a random event? Nobody can guess the outcome before it happens. Let’s try an experiment. On the next page.
Notes on PROBABILITY What is Probability? Probability is a number from 0 to 1 that tells you how likely something is to happen. Probability can be either.
AP STATISTICS Objective: Understanding Randomness Do Now: Take out any completed contracts, personal profiles, as well as your written design study. HW:
Loops Wrap Up 10/21/13. Topics *Sentinel Loops *Nested Loops *Random Numbers.
Copyright © 2006 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Slide
POSC 202A: Lecture 4 Probability. We begin with the basics of probability and then move on to expected value. Understanding probability is important because.
Intro CS – Screens and Variables Lesson Plan 9. Goals  Using sprites as full screens (Start screen, Game over)  Using layering to control ordering of.
Introduction to Computer Programming - Project 2 Intro to Digital Technology.
IST 210: PHP LOGIC IST 210: Organization of Data IST210 1.
5-Minute Check on Chapter 5 Click the mouse button or press the Space Bar to display the answers. 1.What can help detect “cause-and-effect” relationships?
Probability What are your Chances? Warm Up Write each fraction in simplest form
Intro CS – Costumes and Variables Lesson Plan 6. Goals  Understanding Costumes, Ordering, Naming  Switching Costumes with Switch and Next  Using Variables.
Statistics 11 Understanding Randomness. Example If you had a coin from someone, that they said ended up heads more often than tails, how would you test.
Intro CS – Broadcasting Messages Lesson Plan 8. Goals  Using broadcasting to track events across sprites and act on them.
Intro CS – Logic & Operators Lesson Plan 5. Goals  Students can explain basic logical operators  AND, OR, NOT  Students can create truth tables for.
1 Copyright © 2014, 2012, 2009 Pearson Education, Inc. Chapter 9 Understanding Randomness.
Intro CS – Probability and Random Numbers Lesson Plan 6a.
Intro CS – Loops, making animations & films Lesson Plan 3.
Objective of the lesson Use Blockly to make a dice for Snakes and Ladders All of you will: – Make an image which displays when you press a button Most.
Lesson 6 – 2a Probability Models. Knowledge Objectives Explain what is meant by random phenomenon. Explain what it means to say that the idea of probability.
13 Lesson 1 Let Me Count the Ways Fundamental Counting Principle, Permutations & Combinations CP Probability and Statistics FA 2014 S-ID.1S-CP.3S-CP.5.
DAY 4. MAKING SOMETHING ‘JUMP’ Simple! Move it a certain amount ‘up’ Glide back to your original spot.
Slope (b) = Correlation (r) = Slope (b) = Correlation (r) = WARM UP 1.Perform a Linear Regression on the following points and.
Intro CS – Keyboard and mouse input Lesson Plan 7.
Intro CS – Costumes and Variables
Experiments, Simulations Confidence Intervals
Intro CS – Screens and Variables
CHAPTER 5 Probability: What Are the Chances?
Intro CS – Loops, making animations & films
Intro CS – Loops & Creating Shapes
Chapter 6 6.1/6.2 Probability Probability is the branch of mathematics that describes the pattern of chance outcomes.
Bring a penny to class tomorrow
Intro CS – Keyboard and mouse input
Sequences, Series, and Probability
PROBABILITY.
Probability of simple events
Basic Skills Jada will use a random number generator 1,200 times. Each result will be a digit from 1 to 6. Which statement best predicts how many times.
AND.
Friday, October 7, 2016 Write a random number between 1 and 10 on a post- it note on your desk Warm-up Discuss with your group & make a list What games.
Monday, October 10, 2016 Warm-up Random Numbers Simulations
Chapter 3.1 Probability Students will learn several ways to model situations involving probability, such as tree diagrams and area models. They will.
Chapter 3.1 Probability Students will learn several ways to model situations involving probability, such as tree diagrams and area models. They will.
Probability Rules!!! … and yea… Rules About Probability
Probability.
Understanding Randomness
The Nature of Probability
Probability What are your Chances?
Module 5 Lesson 3 Extreme Scratch Cards
Click the mouse button or press the Space Bar to display the answers.
Probability How to calculate simple probabilities D. Smith 02/12/2018.
Click the mouse button or press the Space Bar to display the answers.
And and or…and RANDOMNESS
WARM UP: Solve the equation for height for an age of 25.
Decimals, Percentages and Fractions
5-8 Probability and Chance
Essential Statistics Introducing Probability
Statistics and Probability-Part 5
Addition and Subtraction Partitioning and column addition
Addition and Subtraction
Primary School Computing
Presentation transcript:

Intro CS – Probability and Random Numbers Lesson Plan 6a

Goals Students can explain random numbers and how computers can generate them Students can generate random numbers Students can use the computer to simulate random number experiments to observe probability statistics Students can predict probability statistics for a given problem Students can express probability as ratios, decimals, and percentages Students can write code to generate probability statistics as ratios, decimals, and percentages

Objectives Students are introduced to random number generation by computers and how they can be used to simulate chance Students are given real probability problems to code and solve Results are demonstrated through predications, demos of running code, and displayed results

Pre Requisites Knowledge of IF blocks, Loops (to simulate mutiple trials), variables (to capture results) Basic Understanding of BYOB

Materials Slides with examples (or present on whiteboard) PCs with Chrome browser to access Snap web site

Lesson Description Students learn about random number generation in computers, and how it can be used simulate probability experiments Students practice and extend examples Students solve probability problems using code and the computer Students analyze their and others’ solutions, and collaborate towards shared solutions

Lesson Procedure Warm-up: Define/research what probability is, with an example. Research an example of how random numbers are used with computers to simulate chance Quick review of IF block, Variables, and Loops Introduce PICK RANDOM through student investigation and observation of sample work Give exercises for in class practice Walk the room answering questions, looking over the shoulder, asking questions, etc. Check off solutions for completeness and accuracy Review

Closure/Conclusion Summary Random numbers are a powerful way to simulate real world problems and introduce random behaviors into normally predictable code Future thinking: Discuss Monte Carlo simulations as they relate to Finance, Airplane Boarding Optimization, Sporting Event Results Ask questions on what is confusing or needs more time/practice

Random Numbers Lesson 5

Warm-up Research/define probability, with a real-life example Research another example of how computers are used to simulate chance

Review: IF blocks What are IF Blocks? IF blocks are used to help make decisions and branch your code. When the IF Block statement is true, whatever is contained inside the decision block is done Other blocks that use logic: IF/ELSE, Repeat Until, Wait Until Can anyone tell me what they think an IF block will do? What do you think this sequence will do? Note: Here a double inquiry about “if on edge” happens. The block used can be applied even without the decision-block. But for gaining understanding of the concept decision this way works better.

Review: Variables Variables are places we can store results/values Variables can be changed any time Variables can be incremented by one to count things

Review: Loops Used to repeat things a few to many, many times Can repeat: Forever (FOREVER block) A specific number of times (REPEAT 10 block) Until a test is True (REPEAT UNTIL <test> block)

Generating Random Numbers Usually, computers are very predictable 3+5 will also equal 8 for a computer Spell checking, etc. Sometimes we want computers to simulate life by being less predictable We can use Random Numbers to: Simulate chance (rolling dice, unpredictable events, etc.) Track results in variables Run thousands/millions of simulations very fast We use the Pick Random block (on the green tab)

Investigation Pair up. If you get stuck, ask another pair. Simulate the following by having a sprite Say: the result of rolling one six-sided die the result of rolling two, three, four, or five six-sided dice the result of rolling one ten-sided die the result of picking a random card from a deck sprite must say "Ace of Clubs", "6 of Hearts", etc. Hint: use Join block on green tab to put words/numbers together, and IF blocks

When to use Pick random When you want to simulate chance: 50/50 99/1 When you want to wait a random amount of time Wait (pick random 6 to 10) When you want to pick a random thing from a list of things Picking a word in Hangman (future project in class) When you want to make game behavior unpredictable Sometimes go left, sometimes right, etc.

Coding problem Write the following programs: Computer rolls 2 dice, calculate the probability of each roll (2-12) Use the computer to roll 5 dice to play Yahtzee Roll dice, pick all/some/none to keep, repeat 3 times Mark (on paper, or write code), to track which scores to take after 3 roles Repeat until you can't play, or all categories filled

Review You’ve just learned the basics of random numbers and using computers to measure probability Simulate chance Experiment to calculate results Future thinking: Monte Carlo calculations Finance: predict retirement outcomes Sports: predict team scores Airplane boarding optimization: predict and test models