Question
There are 30 coins. While 29 of the coins are fair, the 30th coin flips heads with probability 60%. You flip all 30 coins 100
There are 30 coins. While 29 of the coins are fair, the 30th coin flips heads with probability 60%. You flip all 30 coins 100 times. Use the Monte Carlo method to compute within 0.1% the probability that the 30th coin is in the set of 10 coins that land heads most often. (Basically, count each time the value for the 30th coin in within the 10th position, then divide by the number of simulations.) How to solve: 1. Create a nested loop. First loop does the whole experiment a specified amount of times (try 100000 times). The next parts are within that loop. 2. Flip the 29 fair coins 100 times, put them in a list, and sort. 3. Create an if statement to ask if the average probability of the unfair coin being heads is >= the 10th coin in the fair coin list from Step 2. 4. Count the number of times the unfair coin was in the top 10 and divide by total trials to get the probability. This is what I have so far: n = 100000 for i in range(n): fair = np.random.binomial(100,0.5,29) unfair = np.random.binomial(100,0.6) fair = sorted(fair, reverse=True)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started