Skip to content

Commit 252b20a

Browse files
committed
Poisson Distribution
1 parent 039951a commit 252b20a

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

poisson_distribution_3.py

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#https://www.hackerrank.com/challenges/poisson-distribution-3/problem
2+
# The number of calls coming per minute into a hotels reservation center is Poisson random variable with mean 3.
3+
#
4+
# (a) Find the probability that no calls come in a given 1 minute period.
5+
#
6+
# (b) Assume that the number of calls arriving in two different minutes are independent.
7+
# Find the probability that atleast two calls will arrive in a given two minute period.
8+
9+
import math,scipy.stats
10+
11+
print('%.3f'%scipy.stats.poisson.pmf(0,3))
12+
13+
#print('%.3f'%(1-2*scipy.stats.poisson.pmf(0,3)*scipy.stats.poisson.pmf(1,3)-scipy.stats.poisson.pmf(0,3)**2))
14+
print('%.3f'%(1-scipy.stats.poisson.cdf(1, 3*2)))

poisson_distribution_5.py

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/usr/bin/python
2+
import math,scipy.stats
3+
4+
print('%.3f'%scipy.stats.poisson.pmf(2, 1.2))
5+
print('%.3f'%scipy.stats.poisson.cdf(2, 1.2))
6+
print('%.3f'%scipy.stats.poisson.pmf(5, 1.2*10))
7+
print('%.3f'%(1-scipy.stats.poisson.cdf(2, 1.2*40)))

0 commit comments

Comments
 (0)