(probablity): given 3 groups of people: first group with 20
people, second group with 30 people, third group with 45
people.
a)for each group: calculate the probability that at least 2 people
will have a birthday in the same day
b)write a program that generates random dates and run it on each group. how are the results obtained from running the program in comparison to the probabilities calculated for each group?
The probability for two people in a group to have the same birthday - formula 1-(365!/{(365-no. of people in the group)! * 365^no. of people in the group})
Group of 20 - 0.411 i.e approximately 41.1%
Group of 30 - 0.704 i.e approximately 70.4%
Group of 45 - 0.941 i.e approximately 94.1%
Program to generate random numbers for each member of the group (the numbers indicate the days out of 365 days)
import random
def Rand(start, end, num):
res = []
for j in range(num):
res.append(random.randint(start,
end))
return res
num = 45 #indicates number of members in the group(change this
accordingly)
start =1 #start day of an year
end = 365 #end day of an year
print(Rand(start, end, num))

Here, we can see that 4 pairs of people i.e 8 members shared their birthday with someone else.

Here, we can see that for a group of 20 only 1 pair that is 2 people out of 20 share their birthdays with someone else.

Here, we can see that 2 pairs share their birthday that is 4 people among 30 share their birthdays with someone else
As the probability increased from a group of 20 to a group of 30 to a group of 45, the number of members sharing their birthdays with someone else has increased from a group of 20 to a group of 30 to a group of 45.
Observation :
| PROBABILITY | PROGRAM |
| 41.1 % | 2 PEOPLE OUT OF 20 |
| 70.4 % | 4 PEOPLE OUT OF 30 |
| 94.1 % | 8 PEOPLE OUT OF 45 |
(probablity): given 3 groups of people: first group with 20 people, second group with 30 people,...
The birthday problem is as follows: given a group of n people in a room, what is the probability that two or more of them have the same birthday? It is possible to determine the answer to this question via simulation. Using the starting template provided to you, complete the function called calc birthday probability that takes as input n and returns the probability that two or more of the n people will have the same birthday. To do this,...
As you should recal in this class, there were several phases of groups throughout the semester. At times, two people in the class would end up in a group with a person who was in their group in the previous phase! In this problem, you should implement a function that could be used to help check that that doesn't happen. Write a program namesfind valid groups. This is a function that should take three parameter variables. The first parameter is...
1) Two groups of second grade students were given a counting task. Group A was given objects and pictures to work with to help them count. Group B was just given picture representations, and took longer overall to complete the task. Each of the histograms below show the distribution of completion times, in minutes, for one of the two groups. Histogram Histogram II 12 Frequency Frequency 35 45 55 65 75 85 95 105115 35 45 55 65 75 85...
1. The birthday of six random people has been checked. Find the probability that (a) At least one of them is born in September. (b) All five are born in the Spring. Spring here means one of the month March, April, or May. (c) At least two of them are born in the same month. In this problem you can assume that a year is 365 days. 2.A fair die is rolled three times. We say that a match has...
4. Suppose a random number generator generates 20 numbers per second, where each number is drawn uniformly from the interval 9,10), independently of all other numbers. We are interested in the event that one of the drawn numbers is very close to Usain Bolt's 100m sprint world record, that is, that this number belongs to the interval (9.575, 9.585). (a) Suppose that the random number generator runs for 10 seconds. Use the Poisson approximation to estimate the probability that it...
Three friends, Xena, Yvonne, and Zelda, decide to run the Boston marathon. For each of them the time required to complete the marathon is a continuous random variable uniformly distributed between 4 hours and 6 hours. The running times of all contestants are independent. After the marathon, a one hour long TV show interviews the three friends, with 1/2 of the time devoted to the winner, and 1/3 and 1/6 to the second and third, respectively. You are at home,...
4) A marketing executive is creating a commercial for a new drug that treats insomnia. Using the same voiceover script, he wants to know which one of three images people prefer to see: 1) a person who cannot sleep at night, 2) a person who is sleeping soundly at night, or 3) a person who is very sleepy during the day. He made four focus groups (comprised of individuals with difficulty sleeping) and showed them all three of the commercials....
Please help me ONLY for the second method : public
static int[] runningGroups(String[] inputFileNames) throws
IOException.
The second method has an "array of files as a parameter". and
return int [ ]. Each element of the return array is the number of
group that can get from the first method.
I got an error Exception in thread "main"
java.lang.NullPointerException
Here my code:
import java.io.*;
import java.util.ArrayList;
import java.util.Scanner;
public class RunningGroups {
public static void main(String[] args) throws IOException...
In a football or soccer game, you have 22 players, from both teams, in the field. What is the probability of having any two players with the same birthday? (just assume 365 days a year and don’t have to do the exact calendar month and day, use the day number from 1 to 365) Please use two approaches to solve the problem. One, find the closed form mathematical solution by probability theory. Show your derivation/proof. Two, write a program to...
3. In this question we simulate the rolling of a die. To do this we use the func- tion runif (1),which returns a randomnumber in the range (0,1). To get a random integer in the range (1,2,3,4,5,6), we use ceiling(6 runif (1)) or if you prefer, sarple(1:6,size-1) will do the same job. (a). Suppose that you are playing the gambling game of the Chevalier de Méré. That is, you are betting that you get at least one six in 4...