Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Heres the full problem. I understand its long but if someone can help me with the set up ( part 1 of the code). Posted
Heres the full problem. I understand its long but if someone can help me with the set up ( part 1 of the code). Posted whole problem from clarification
Problem Setup The birthday problem is a famous problem with an interesting result. It is stated as follows: "in a set of n people with randomly distributed birthdays, what is the probability that some pair of them will have the same birthday?" Consider a group of n people in a room. We denote the birthday of the ith person as bi E {1,..., 365}. We want to measure the probability that in this room of n people at least 2 people have the same birthday. We denote this by the quantity: Ph(d, j 0.5 based on the variable prob_n plot a plot of the computed probabilities Pn vs n user_code.py 1 2 import numpy as np import matplotlib import matplotlib.pyplot as plt manonooo def duplicate_birthdays(n): # Generate 1000 simulations of rooms (with the birthdays of n people in each room # Compute the number of rooms with duplicate birthdays. # Returns the number of rooms with duplicate birthdays return 0 12 # Part 1 13 - for n in range(2, 101): 14 # call function duplicate_birthdays(n) 15 # update the array prob_n 16 17 # Part 2 18 # Estimate perc_50 19 20 # Part 3 # Plot prob_n 22 23 # Save plot for grading 24 plot = plt.gca() Restore original fileStep 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