如何優雅地求和?

FSYo發表於2020-10-04

給定 m , n , p , f ( 1 ) , … , f ( m ) m,n,p,f(1),\dots,f(m) m,n,p,f(1),,f(m),求出
∑ i = 0 n f ( i ) ( n i ) p i ( 1 − p ) n − i \sum_{i=0}^nf(i)\binom{n}{i}p^i(1-p)^{n-i} i=0nf(i)(in)pi(1p)ni
G F \mathcal{GF} GF 告訴我們一種很優雅的方式:
∑ c t [ z t ] ( p e z + 1 − p ) n \sum c_t[z^t](pe^z+1-p)^n ct[zt](pez+1p)n
是很優美,但是給點值很不友好
注意到後面一坨就是二項分佈
考慮其母函式
g X ( z ) = ∑ k ≥ 0 Pr [ X = k ] z k g_X(z)=\sum_{k\ge 0}\text{Pr}[X=k]z^k gX(z)=k0Pr[X=k]zk
在這裡
g X ( z ) = ∑ k ≥ 0 ( n k ) p i ( 1 − p ) n − i z i = ( p z + 1 − p ) n g_X(z)=\sum_{k\ge 0}\binom{n}{k}p^i(1-p)^{n-i}z^i=(pz+1-p)^n gX(z)=k0(kn)pi(1p)nizi=(pz+1p)n
我們知道
g ( k ) ( 1 ) = E [ X k ‾ ] g^{(k)}(1)=\text{E}[X^{\underline k}] g(k)(1)=E[Xk]
所以說
∑ i = 0 n i t ‾ ( n i ) p i ( 1 − p ) n − i = E [ X t ‾ ] = ( p z + 1 − p ) n − k n k ‾ p k ∣ z = 1 = n k ‾ p k \sum_{i=0}^ni^{\underline t}\binom{n}{i}p^i(1-p)^{n-i}=\text{E}[X^{\underline t}]=(pz+1-p)^{n-k}n^{\underline k}p^k\Big|_{z=1}=n^{\underline k}p^k i=0nit(in)pi(1p)ni=E[Xt]=(pz+1p)nknkpkz=1=nkpk
當然也可以直接推
∑ i i t ‾ ( n i ) p i ( 1 − p ) n − i = ∑ i ≥ t n t ‾ ( n − t i − t ) p i ( 1 − p ) n − i = n t ‾ p t \sum _ii^{\underline t}\binom{n}{i}p^i(1-p)^{n-i}\\=\sum_{i\ge t}n^{\underline t}\binom{n-t}{i-t}p^i(1-p)^{n-i}=n^{\underline t}p^t iit(in)pi(1p)ni=itnt(itnt)pi(1p)ni=ntpt
不過題目希望你優雅地求和

相關文章