Bootstrap

概率生成函数

概率生成函数

随机变量 X X X 的概率生成函数为:
F ( z ) = ∑ i = 0 ∞ P ( X = i ) z i F(z)=\sum_{i=0}^\infty P(X=i)z^i F(z)=i=0P(X=i)zi

均值与方差

E ( X ) = F ′ ( 1 ) E(X)=F'(1) E(X)=F(1)

V ( X ) = E ( X 2 ) − E ( X ) 2 = F ′ ′ ( 1 ) + F ′ ( 1 ) − F ′ ( 1 ) 2 V(X)=E(X^2)-E(X)^2 =F''(1)+F'(1)-F'(1)^2 V(X)=E(X2)E(X)2=F(1)+F(1)F(1)2
Proof:
E ( X 2 ) = ∑ i = 0 ∞ P ( X = i ) i 2 = ∑ i = 0 ∞ P ( X = i ) i ( i − 1 ) z i − 2 + i z i − 1 = F ′ ′ ( 1 ) + F ′ ( 1 ) E(X^2)=\sum_{i=0}^\infty P(X=i)i^2=\sum_{i=0}^\infty P(X=i)i(i-1)z^{i-2}+iz^{i-1}=F''(1)+F'(1) E(X2)=i=0P(X=i)i2=i=0P(X=i)i(i1)zi2+izi1=F(1)+F(1)

然后就可以做题了…


1

十连测:http://zhengruioi.com/contest/269/problem/637

期望是一个无穷级数的形式,所以考虑概率生成函数。设第 i 号桶中年份的概率生成函数为 F i ( z ) = ∑ i = 0 ∞ P ( X = i ) z i F_i(z)=\sum_{i=0}^\infty P(X=i)z^i Fi(z)=i=0P(X=i)zi。我们想要求方差,由于 V ( X ) = E ( X 2 ) − E ( X ) 2 V(X)=E(X^2)-E(X)^2 V(X)=E(X2)E(X)2,并且根据题意年份为 i 的酒价值为 i·z^i,因此 E ( X ) E(X) E(X) 就等于 F ′ ( z ) ⋅ z F'(z)·z F(z)z (z 是常数),并且 E ( X 2 ) = ∑ i = 0 ∞ P ( X = i ) i 2 z 2 i = ∑ i = 0 ∞ P ( X = i ) i ( i − 1 ) z 2 i + i z 2 i = F ′ ′ ( z 2 ) z 4 ⋅ F ′ ( z 2 ) ⋅ z 2 E(X^2)=\sum_{i=0}^\infty P(X=i)i^2z^{2i}=\sum_{i=0}^\infty P(X=i)i(i-1)z^{2i}+iz^{2i}=F''(z^2)z^4·F'(z^2)·z^2 E(X2)=i=0P(X=i)i2z2i=i=0P(X=i)i(i1)z2i+iz2i=F(z2)z4F(z2)z2

那么我们就要求出 F F F。记每一年流出第 i 个桶的酒量为 g,那么有 F i = F i ( 1 − g ) z + ∑ k &lt; i F k ⋅ c k , i ⋅ z F_i=F_i(1-g)z+\sum_{k&lt;i}F_k·c_{k,i}·z Fi=Fi(1g)z+k<iFkck,iz。注意到 1 号桶的生成函数是可以直接求出封闭形式的,那么就可以推到第二个桶,以此类推。而且,我们只需要知道 F n ′ ( z ) , F n ′ ( z 2 ) , F n ′ ′ ( z 2 ) F_n&#x27;(z),F_n&#x27;(z^2),F_n&#x27;&#x27;(z^2) Fn(z),Fn(z2),Fn(z2),因此可以一开始就把 z 带入递推,时刻维护这些值即可。


附一些求导法则:
( u ( x ) v ( x ) ) ′ = u ′ ( x ) v ( x ) + u ( x ) v ′ ( x )   ( u ( x ) v ( x ) ) ′ = u ′ ( x ) v ( x ) − u ( x ) v ′ ( x ) v 2 ( x )   u ( v ( x ) ) ′ = v ( x ) ′ u ′ ( v ( x ) ) (u(x)v(x))&#x27;=u&#x27;(x)v(x)+u(x)v&#x27;(x)\\ ~\\ \left(\frac {u(x)}{v(x)}\right)&#x27;=\frac{u&#x27;(x)v(x)-u(x)v&#x27;(x)}{v^2(x)}\\ ~\\ u(v(x))&#x27;=v(x)&#x27;u&#x27;(v(x)) (u(x)v(x))=u(x)v(x)+u(x)v(x) (v(x)u(x))=v2(x)u(x)v(x)u(x)v(x) u(v(x))=v(x)u(v(x))

;