Tuesday, October 7, 2014

Random NUmbers and intro to Stats

Thing about taking so much time off from something voluntary, it's really tough to get back in the right rhythm. It's hard to come back to a normal job, but one where I set the time to post, well that's just a new challenge.

Here is how it's going to be this month: Monday (or today, whatever) I'll post a puzzle I have from a book on Monte Carlo problems. A Monte Carlo method (or simulation, or experiment) is a "broad class of computational algorithms that rely on repeated random sampling to obtain numerical results; typically one runs simulations many times over in order to obtain the distribution of an unknown probabilistic entity."[1] This early in the morning I'm having trouble with definitions, but it's steps that a computer (or person, really) takes with random numbers in order to solve problems with random numbers. They are fairly easy to build. There are articles on how to run them in Excel or any similar spreadsheet program. Like I said, if you have the right random number generator, like a standard die or maybe some multi-sided dice, a person could do the simulation with paper and pencil. It just might be tedious.

Okay, so here is the problem, taken from the book "Digital Dice: Computational Solutions to Practical Probability Problems". I left my copy. . . somewhere. . . so this is the easy intro problem:

  1. A clueless student faced a pop quiz: a list of 24 presidents of the 19th century and another list of their terms in office, but scrambled. The object was to match the president with the term. He had to guess every time. On average, how many did he guess correctly?
  2. Imagine this scenario occurs 1000 times. On average, how many matches (of the 24 possible) would a student guess correctly?
This can easily be solved with good old fashioned brain power. What this simulation should do is 2 things, generate a random number a random number between 1 and 24, which is the guess, and count the numbers 1 thru 24 in order, then compare the two. After taking the total number of correct guesses, divide it by 1000 to get the average. Simple. I'll be back on Friday with an answer in Excel, Python, and maybe dice?