白努利試驗
Author: 藍邦偉  老師

$ 白努利試驗 $

$ 如果隨機試驗的結果只有兩種，成功與失敗.\;若成功的機率為\;p\;，\;失敗的機率為\;q=1-p\;,且隨機變數X表$
$試驗成功的次數，\;則定義：\;\left\lbrace \begin{array}{cc} P(X= 1)=p\  P(X=0)=q \ \end{array}  \right.\ $

$ E(X)=1\cdot p+0\cdot q=p $

$ V(X)= \sum_{i=1}^{n}{p_i(x_i-E(X))² }$

$ =(1-p)²\cdot p+(0-p)²\cdot q $

$ =q²p+p²q $

$ =pq(p+q) $

$ =pq $

$ V(X)=\sum_{i=1}^{n}{p_ix_i^2 }-[E(X)]² $

$ =(p\cdot 1^2+q\cdot 0^2)-p^2 $

$ =p(1-p) $

$ =pq $

$ 1 $

$ 機$
$率 $

$ X $

$ p $

$ q $

$ 失敗 $

$ 成功 $

n = 0 (slider from 0 to 9, step 1)
a = Segment((0, 0), (25, 0))
b = Segment((0, 0), (0, 15))
c_1 = Segment((5, 0), (5, 15))
c_2 = Segment((10, 0), (10, 15))
c_3 = Segment((15, 0), (15, 15))
c_4 = Segment((20, 0), (20, 15))
p = 7.4 (slider from 0 to 10, step 0.1)
d: 10 - p
P_1: (5, p)
P_2: (10, p)
P_3: (15, d)
P_4: (20, d)
poly1, p_2, p_1, e, f = Polygon(P_2, P_1, (5, 0), (10, 0))
poly2, p_4, p_3, g, h = Polygon(P_4, P_3, (15, 0), (20, 0))
i = Segment((0, 10), (25, 10))
j = Segment((0, y(P_1)), (10, y(P_1)))
k = Segment((0, y(P_4)), (20, y(P_4)))