Question
The Birthday Problem. If there are a group of n people in a room, what is the probability that two or more of them have
The Birthday Problem. If there are a group of n people in a room, what is the probability that two or more of them have the same birthday [month and day only, ignore the year]. It is possible to determine the answer to this question by simulation. Write a function that calculates the probability that two or more of n people will have the same birthday, where n is the calling argument.
[HINT: To do this, the function should create an array of size n and generate n birthdays in the range 1 to 365 randomly. It should then check to see if any of the n birthdays are identical. The function should perform this experiment at least 5000 times and calculate the fraction of those times in which two or more people had the same birthday.]
Then, write a test program [calling program] that calculates and prints out [using a user defined function] the probability that 2 or more of n people witll have the same birthday for n = 2, 3, 4, 40.
LastName_FirstName_P6_xxxxx
Notes: the xxxx can be whatever you want.
USE MATLAB FOR THIS.
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