deivsjay / Bar-Project

USC CSCI 455 PA 1 Fall 2016

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

1. 
What is the probability of each of the three outcomes in a trial: 
two heads, one head and one tail, and two tails? 
Why is one of them different than the other two?

Given there are two coins:
Two heads: 25%
One head and one tail: 50%
Two tails: 25%

When two coins are flipped, there are 4 possible outcomes: HH, HT, TH, TT. 
Since HT and TH are both classified as one head and one tail outcome, it makes up 50% of the possibilities, which is why this outcome
is different than the other two outcomes, which each compromise 25% of the probability in a trial. 

2. 
Roughly how many trials do you need to do before you mostly get results within 1% of these probabilities? 
Do several simulations using your program to determine an answer to this. 
You just need a general order of magnitude, not an exact answer.

At roughly 1000 trials, the probabilities should be around 1% of the estimated probabilities.  

3.
Roughly how many trials can you do before it crashes with an overflow error? 
(you do not need an exact answer, just an order of magnitude)
State the largest value you tried where it still worked correctly, and one where it overflowed.
You can get an idea of what general values to try by looking at the limits on Java integers (see Section 4.1.1 of the text).
. Play around with your program to verify that it actually works for very large values that are within the limits.
Warning: For very large values you may have to wait a fair amount of time before you get the results 
(probably slower on aludra than on you own machine).

It crashes with an overflow error around 2147483647 trials (the maximum limit of an integer).
It worked at 2147483600 trials. It stopped working after I tried 2147483747. 

About

USC CSCI 455 PA 1 Fall 2016


Languages

Language:Java 100.0%