[CSC 125] Program 2
Andrew J. Pounds
pounds_aj at mercer.edu
Thu Jul 5 09:04:07 EDT 2012
On 07/04/2012 10:25 PM, wrote:
> Professor Pounds,
>
> Happy 4th of July!!! I am a little confused on the assignment Program 2. Are we looking for the number of rolls it would take for the person to get the number 7 10 times or the number that every time I enter it seven is the number that is rolled the most frequently?? Sorry I may be over thinking the assignment completely.
>
Good question. Let me see if I can help you out here.
We are ultimately looking at probabilities in this little exercise and
the limit of large numbers. I have heard this problem phrased "If I
roll the two dice a gazillion times, what number comes up the most."
You have a variable in your program called max_rolls that determines how
many times the dice get rolled. I think in the code I put out there for
you it is set to roll the dice 10 times. When you roll the two six
sided die 10 times you might get something like this...
Roll Number of Occurrences
------- ---------------------
1 0
2 1
3 1
4 0
5 0
6 3
7 2
8 0
9 1
10 1
11 1
12 0
The number that was rolled most frequently was 6
I could roll again and again and the roll that comes up the most would
change because I don't have enough samples in my set to represent a good
probability distribution for the problem at hand. If, however, I change
max_rolls to 1000 I might get something like...
Roll Number of Occurrences
------- ---------------------
1 0
2 28
3 54
4 89
5 115
6 112
7 162
8 141
9 123
10 84
11 61
12 31
The number that was rolled most frequently was 7
In fact, I can rerun this version of the program (with max_rolls at
1000) and get this same result over and over again. We know that 7 is
"supposed" to come up, we also know that it takes 1000 rolls to get that
result consistently. I wonder if you can find a smaller number for
max_rolls.
Now, for the next two systems (the three six sided dice and the platonic
solids) you don't even know which number SHOULD come up the most. By
experimenting with the value of max_rolls, you should be able figure out
pretty quickly what the number is that comes up the most. Hint: pick a
big number (like a billion) and let your computer run for a minute or
so. We'll call this the limiting case. Once you isolate the number
from your limiting case, start decreasing the value of max_rolls. Once
you find a smaller value of max_rolls that gives you the same result as
your limiting case, see if you can use that value to get the limiting
case consistently (ten times in a row).
So, here is another way to read the questions.
1. To what value (10,100,500,1000,20000,etc,) do you have to set the
variable max_rolls so that produces the roll of 7 (the value of the
limiting case) consistently. By consistent we mean that we can run
the program ten times and get the same result.
2. For the three six sided dice, what should be the value of the
limiting case? Hint: It will be a number beteen 3 and 18. :)
3. For the three six sided dice, to what value do you have to set
max_rolls to get the value of the limiting case consistently. Hint:
It should be greater than the value you found for the two six sided
dice.
4. For the five platonic solids dice, what should be the most probable
rolss resulting from the limiting case. Basically the same question
as 2 -- but now using the five platonic solids.
5. Same question as 1 and 3, but now using the case of the five
platonic solids.
Hope that helps... but let me know if you still have questions...
--
Andrew J. Pounds, Ph.D. (pounds at theochem.mercer.edu)
Associate Professor of Chemistry and Computer Science
Mercer University, Macon, GA 31207 (478) 301-5627
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://theochem.mercer.edu/pipermail/csc125/attachments/20120705/3442aabf/attachment.html>
More information about the csc125
mailing list