$Random$

正面\;\;\;\;\;\;\;\;反面

(正,正)\;(正,反)\;(反,正)\;(反,反)

第一次\;\;\;\;\;第二次

次\數

兩正面\;\;\;\;一正一反\;\;\;\;兩反面

n = 10 (slider from 10 to 2000, step 1)
k = 0 (slider from 0 to n, step 1)
a = 0.73 (slider from 0 to 1, step 0.01)
list11 = Sequence(Random[0, 1] + (a * 0), i, 1, n)
list12 = Sequence(Element[list11, i], i, 1, Min[k, n])
list13 = Sequence(CountIf[x ≟ i, list12], i, 0, 1)
m_1: floor(Max[list13] / 7) + 1
E = (5.708451400696868, 13.13801375145186)
b_1 = BarChart({5, 15}, list13 / m_1, 4)
s = 4 (slider from 0 to 10, step 1)
text1: "投擲一公正硬幣" + (LaTeX[n]) + "次，\;第" + (LaTeX[k]) + "次出現" + (LaTeX[If[Element[list12, k] ≟ 0, "正", "反"]]) + "面\\
目前共出現" + (LaTeX[Element[list13, 1]]) + "次正面" + (LaTeX[Element[list13, 2]]) + "次反面"
list14 = Sequence(Text["" + (Element[list13, i]), ((10 * i) - 6, Element[list13, i] / m_1 + 1)], i, 1, 2)
list21 = Sequence(Random[0, 3] + (a * 0), i, 1, n)
list22 = Sequence(Element[list21, i], i, 1, Min[k, n])
list23 = Sequence(CountIf[x ≟ i, list22], i, 0, 3)
m_2: floor(Max[list23] / 7) + 1
text3: "
投擲一個公正硬幣兩次，\;並重複上述實驗" + (LaTeX[n]) + "回，\\
觀察其正反面出現的情形"
text7: "實驗" + (LaTeX[n]) + "回\\第" + (LaTeX[k]) + "回實驗"
b_2 = BarChart({5, 12, 19, 26}, list23 / m_2, 4)
c = PolyLine((0, 12), (0, 0), (30, 0))
list24 = Sequence(Text["" + (Element[list23, i]), ((7 * i) - 4, Element[list23, i] / m_2 + 1.3)], i, 1, 4)
list31 = Sequence(Random[0, 1] + (a * 0), i, 1, n)
list32 = Sequence(Random[0, 1] + (a * 0), i, 1, n)
list33 = Sequence(Element[list31, i] + Element[list32, i], i, 1, Min[k, n])
list34 = Sequence(CountIf[x ≟ i, list33], i, 0, 2)
m_3: floor(Max[list34] / 7) + 1
text8: "同時投擲2個公正硬幣" + (LaTeX[n]) + "次，\;第" + (LaTeX[k]) + "次出現" + (LaTeX[If[Element[list33, k] ≟ 0, "兩正面", If[Element[list33, k] ≟ 1, "一正一反", "兩反面"]]]) + ""
b_3 = BarChart({5, 14, 23}, list34 / m_3, 4)
list35 = Sequence(Text["" + (Element[list34, i]), ((9 * i) - 6, Element[list34, i] / m_3 + 1)], i, 1, 3)