This lecture starts with some examples of how to use pylab's plotting mechanisms. It then returns to the topic of using probability and statistics to derive information from samples. |

## About this Video

Topics covered: Plotting, randomness, probability, Pascal's algorithm, Monte Carlo simulation, inferential statistics, gambler's fallacy, law of large numbers.

## Resources

Can probabilities be added?

› *View/hide answer*

In general, one cannot add probabilities.

What is a Monte Carlo simulation?

› *View/hide answer*

A simulation which arrives at an approximation of a probability by running many, many trials.

What is the guiding principle of inferential statistics?

› *View/hide answer*

A random sample tends to exhibit the same properties as the population from which it is drawn.

What is the law of large numbers (a.k.a. Bernoulli's Law)?

› *View/hide answer*

The law of large numbers basically says that using more test cases in a simulation involving randomness will increase our confidence in its results.

What is the gambler's fallacy?

› *View/hide answer*

The belief that random numbers will even out constantly (e.g. that after a string of heads, it's “time for” the coin to come up tails.)

In this problem set you will practice designing a simulation and implementing a program that uses classes.

- Instructions (PDF)
- Code Files (ZIP) (This ZIP file contains: 3 .py files.)
- Solutions (ZIP) (This ZIP file contains: 1 .py file.)

Problem set 7 is assigned in this session. The instructions and solutions can be found on the session page when it is due, Lecture 16 Using Randomness to Solve Non-random Problems.

These optional resources are provided for students that wish to explore this topic more fully.

- Monte Carlo method. Wikipedia.