CS1512 www.csd.abdn.ac.uk/~jhunter/teaching/CS1512/lectures/ 1 CS1512 Foundations of Computing Science 2 Lecture 22 Digital Simulations Probability and.

Slides:



Advertisements
Similar presentations
Unit 3: Probability 3.1: Introduction to Probability
Advertisements

Fundamentals of Probability
Probability of Independent Events
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Slide
BUS 220: ELEMENTARY STATISTICS
Probability 1: the idea of probability
Experimental Probability Vs. Theoretical Probability
Probability I Introduction to Probability
CS CS1512 Foundations of Computing Science 2 Lecture 23 Probability and statistics (4) © J.
CS1512 Foundations of Computing Science 2 Week 3 (CSD week 32) Probability © J R W Hunter, 2006, K van Deemter 2007.
Who Wants To Be A Millionaire? Mrs Mances Edition.
Probability How likely is an event to occur?
Beginning Probability
1 Econ 240A Power Three. 2 Summary: Week One Descriptive Statistics –measures of central tendency –measures of dispersion Distributions of observation.
Lecture 18 Dr. MUMTAZ AHMED MTH 161: Introduction To Statistics.
MAT 103 Probability In this chapter, we will study the topic of probability which is used in many different areas including insurance, science, marketing,
6.1 Simulation Probability is the branch of math that describes the pattern of chance outcomes It is an idealization based on imagining what would happen.
Chapter 2.3 Counting Sample Points Combination In many problems we are interested in the number of ways of selecting r objects from n without regard to.
40S Applied Math Mr. Knight – Killarney School Slide 1 Unit: Probability Lesson: PR-L1 Intro To Probability Intro to Probability Learning Outcome B-4 PR-L1.
Probability Ch 14 IB standard Level.
Copyright © 2010, 2007, 2004 Pearson Education, Inc. Chapter 14 From Randomness to Probability.
Copyright © 2006 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Slide
1. Probability of an Outcome 2. Experimental Probability 3. Fundamental Properties of Probabilities 4. Addition Principle 5. Inclusion-Exclusion Principle.
What is Probability Learning Intention Success Criteria
Chapter 17 STA 200 Summer I Flipping Coins If you toss a coin repeatedly, you expect it to come up heads half the time. Suppose you toss a coin.
Copyright © 2006 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Slide
Probability Seeing structure and order within chaotic, chance events. Defining the boundaries between what is mere chance and what probably is not. Asymptotic.
How likely something is to happen.
From Randomness to Probability
MAT 103 Probability In this chapter, we will study the topic of probability which is used in many different areas including insurance, science, marketing,
Probability By Laura Farrington 8GT. What is Probability? Probability is about the chance of something happening. When we talk about how probable something.
Learning Objectives for Section 8.1 Probability
Section 1 Sample Spaces, Events, and Probability
We like to think that we have control over our lives. But in reality there are many things that are outside our control. Everyday we are confronted by.
Probability.
Chapter 7 Probability. Definition of Probability What is probability? There seems to be no agreement on the answer. There are two broad schools of thought:
Section The Idea of Probability Statistics.
Copyright © 2010, 2007, 2004 Pearson Education, Inc. Chapter 14 From Randomness to Probability.
1-1 Copyright © 2015, 2010, 2007 Pearson Education, Inc. Chapter 13, Slide 1 Chapter 13 From Randomness to Probability.
“PROBABILITY” Some important terms Event: An event is one or more of the possible outcomes of an activity. When we toss a coin there are two possibilities,
Simple Mathematical Facts for Lecture 1. Conditional Probabilities Given an event has occurred, the conditional probability that another event occurs.
1.3 Simulations and Experimental Probability (Textbook Section 4.1)
Copyright © 2010 Pearson Education, Inc. Chapter 14 From Randomness to Probability.
Probability Introduction Examples Key words Practice questions Venn diagrams.
TOSS a Coin Toss a coin 50 times and record your results in a tally chart ht.
Chapter 6. Probability What is it? -the likelihood of a specific outcome occurring Why use it? -rather than constantly repeating experiments to make sure.
Copyright © 2010 Pearson Education, Inc. Unit 4 Chapter 14 From Randomness to Probability.
From Randomness to Probability Chapter 14. Dealing with Random Phenomena A random phenomenon is a situation in which we know what outcomes could happen,
+ The Practice of Statistics, 4 th edition – For AP* STARNES, YATES, MOORE Chapter 5: Probability: What are the Chances? Section 5.1 Randomness, Probability,
Probability.
Measuring chance Probabilities FETP India. Competency to be gained from this lecture Apply probabilities to field epidemiology.
Warm up Decide if the following represent permutations or combinations. Then calculate the desired results. 1. How many different four digit numbers can.
Probability Quiz. Question 1 If I throw a fair dice 30 times, how many FIVES would I expect to get?
Section The Idea of Probability AP Statistics
Copyright © 2010 Pearson Education, Inc. Chapter 14 From Randomness to Probability.
Chapter 8 Probability Section 1 Sample Spaces, Events, and Probability.
AP Statistics From Randomness to Probability Chapter 14.
What is Probability Learning Intention Success Criteria
From Randomness to Probability
Dealing with Random Phenomena
Chapter 6 6.1/6.2 Probability Probability is the branch of mathematics that describes the pattern of chance outcomes.
What is Probability Learning Intention Success Criteria
Probability.
From Randomness to Probability
From Randomness to Probability
From Randomness to Probability
From Randomness to Probability
Probability Probability underlies statistical inference - the drawing of conclusions from a sample of data. If samples are drawn at random, their characteristics.
From Randomness to Probability
From Randomness to Probability
Presentation transcript:

CS CS1512 Foundations of Computing Science 2 Lecture 22 Digital Simulations Probability and statistics (3) © J R W Hunter, 2006

CS Simulations Programs regularly used to simulate real-world activities. city traffic the weather nuclear processes stock market fluctuations environmental changes shipping movements in the Straits of Dover!

CS Simulations Simulations are normally only partial and involve simplification. Greater detail has the potential to provide greater accuracy. Greater detail typically requires more resource: Processing power. Simulation time.

CS Benefits of simulations Support useful prediction. e.g. the weather Allow experimentation. Safer, cheaper, quicker. Example: How will the wildlife be affected if we cut a highway through the middle of this national park?

CS Basic Algorithm set up a number of objects to represent the world that you are trying to model add the objects to a collection maintained by the simulation set the simulation time to zero while the simulation time isnt up for each object call the method that executes the behaviour of the object during the simulation time step do any necessary output increment the simulation time by the time increment wait for an amount of real time corresponding to the time increment

CS ChanSim: Main simulation loop public void simulate(int timeStep, int speedUp) { while (time < totalSimulationTime) { for (int i = vessels.size()-1; i >= 0; i--){ Vessel vessel = (Vessel) vessels.get(i); if (vessel.onChart()) vessel.erase(chart); vessel.move(timeStep); if (vessel.onChart()) vessel.draw(chart); } chart.update(); time = time + timeStep; wait(timeStep*60*1000/speedUp); //*60*1000 to convert minutes to msec }

CS Vessel: move /** * Determine where the vessel will be after timeStep */ public void move (int timeStep) { // distance travelled in km per time step (in minutes) double delta = speed*timeStep/60; location = new Location(location.getx()+ Math.sin(bearing)*delta, location.gety()- Math.cos(bearing)*delta); }

CS Probability

CS Initial thoughts A person tosses a coin five times. Each time it comes down heads. What is the probability that it will come down heads on the sixth toss? ½ or 1 chance in 2 or 50% assumed that the coin is fair ignored empirical evidence of the first five tosses less than ½ or... assumed that the coin is fair thought about law of averages – in the long run, half heads, half tails possibly confused about the question - which was not What is the probability that there will be six heads in a row? more than ½ or... cynical – assumed two headed (or biased) coin

CS Definition Probability: the extent to which an event is likely to occur, measured by the ratio of the number of favourable outcomes to the total number of possible outcomes. 10 balls in a bag 7 white; 3 red close eyes shake bag put in hand and pick a ball 10 possible balls (outcomes) Can you think of any reason why any one ball should be picked rather than any other? If not, then all outcomes are equally likely.

CS Definitions Probability of picking a red ball favourable outcome = red ball number of favourable outcomes = 3 number of outcomes = 10 probability = 3/10 (i.e. 0.3) Note: probability of picking a white ball is 7/10 (0.7) probabilities lie between 0.0 and 1.0 we have two mutually exclusive outcomes (cant be both red and white) outcomes are exhaustive (no other colour there) in this case the probabilities add to 1.0 ( ) a probability is a prediction

CS More definitions Trial action which results in one of several possible outcomes; e.g. picking a ball from the bag Experiment a series of trials (or perhaps just one) e.g. picking a ball from the bag twenty times Event a set of outcomes with something in common e.g. a red ball

CS Probability derived a priori Suppose each trial in an experiment can result in one (and only one) of n equally likely (as judged by thinking about it) outcomes, r of which correspond to an event E. The probability of event E is: r P(E) = n a priori means without investigation or sensory experience

CS More complex a priori probabilities Probability of throwing 8 with two dice: 5 outcomes correspond to event throwing 8 with two dice 36 possible outcomes probability = 5/

CS Probability derived from experiment Toss a drawing pin in the air - two possible outcomes: point up point down Can we say a priori what the relative likelihoods are? (c.f. fair coin) If not, then experiment. Probability based on relative frequencies (from experimental data) If, in a large number of trials ( n), r of these result in an event E, the probability of event E is: r P(E) = n

CS Probability as a relative frequency number of trials must be large (how large?) trials must be independent - the outcome of any one toss must not depend on any previous toss no guarantee that the value of r/n will settle down compare with the relative frequencies for existing data if we have enough experiments then we believe that the relative frequency contains a general truth about the system we are observing.