###### 两个有趣的概率问题

P(k)=C(k1m1)C(mn)

E(Max)=k=mnP(k)k=k=mnmC(mk)C(mn)

k=mnC(mk)=C(m+1n+1)

E(Max)=mC(m+1n+1)C(mn)=m(n+1)/(m+1)

def simulation_notrepeat(n,m):
tot_average = 0
for i in range(10000):
max = 0
count = 0
is_repeated = set([])
while count < m:
x = random.randint(1,n)
if x not in is_repeated:
count += 1
if x > max:
max = x
tot_average += max
print(tot_average/10000)
def test_notrepeat(n,m):
print(m*(n+1)/(m+1))

P(k)=km(k1)mnm

E(Max)=k=1nP(k)k

import random
def simulation(n,m):
tot_average = 0
for i in range(10000):
max = 0
for j in range(m):
x = random.randint(1,n)
if x > max:
max = x
tot_average += max
print(tot_average/10000)
def test_math(n,m):
average = 0
for k in range(1,n+1):
average += (k**m - ((k-1)**m))*k
print(average/(n**m))
def test_notrepeat(n,m):
print(m*(n+1)/(m+1))
def test(n,m,simulation,test_math):
simulation(n,m)
test_math(n,m)
test(100,35,simulation,test_math)
test(100,35,simulation_notrepeat,test_notrepeat)

#### 概率论问题_生日问题

2017-01-12 02:14:52

#### 辨异 —— 有两人生日在同一天、只有两人生日在同一天

2016-10-25 11:42:02

#### 概率与期望

2016-04-29 20:36:23

#### 概率期望相关

2016-03-27 10:20:31

#### 概率和期望

2017-11-02 14:31:23

#### 概率论之概率dp与期望的极限求解

2016-09-06 09:22:14

#### 一个关于概率的问题的思考

2016-10-19 00:00:46

#### 概率论

2016-10-13 08:52:43

#### ACM 中的期望，概率 问题

2015-01-25 10:33:34

#### 数值概率算法

2015-10-29 20:20:39