模擬投10枚硬幣
Author: 藍邦偉　老師

投擲10枚硬幣

Element[list3, k] ≟ 0

Element[list3, k] ≟ 1

  $ 10$
$正面 $

$ 9正$
$1反 $

$8正$
$2 反$

$7正 $
$3 反$

$ 6正$
$4反 $

$ 5正$
$5 反$

$ 4正$
$6 反$

$ 3正$
$7反 $

$ 2正$
$8反 $

$ 1正$
$9反 $

  $ 10 $
$反面$

$次 $
$ 數$

Reset

C = (2.32123, 0)
k = 0 (slider from 0 to n, step 1)
a = 0.68 (slider from 0 to 1, step 0.01)
n = 526 (slider from 1 to 1500, step 1)
list_{10} = Sequence(Random[0, 1] + a * 0, i, 1, n)
list9 = Sequence(Random[0, 1] + a * 0, i, 1, n)
list8 = Sequence(Random[0, 1] + a * 0, i, 1, n)
list7 = Sequence(Random[0, 1] + a * 0, i, 1, n)
list6 = Sequence(Random[0, 1] + a * 0, i, 1, n)
list5 = Sequence(Random[0, 1] + a * 0, i, 1, n)
list4 = Sequence(Random[0, 1] + a * 0, i, 1, n)
list3 = Sequence(Random[0, 1] + a * 0, i, 1, n)
list2 = Sequence(Random[0, 1] + a * 0, i, 1, n)
list1 = Sequence(Random[0, 1] + a * 0, i, 1, n)
listA = Sequence(Element[list1, i] + Element[list2, i] + Element[list3, i] + Element[list4, i] + Element[list5, i] + Element[list6, i] + Element[list7, i] + Element[list8, i] + Element[list9, i] + Element[list_{10}, i], i, 1, Min[k, n])
listB = Sequence(CountIf[x ≟ i, listA], i, 0, 10)
m: floor(Max[listB] / 22) + 1
A: (x(C), 25)
D: C + (57, 0)
e = Segment(C, D)
A_2: A + (5.5, 0)
A_3: A_2 + (5.5, 0)
A_4: A_3 + (5.5, 0)
A_5: A_4 + (5.5, 0)
A_6: A_5 + (5.5, 0)
A_7: A_6 + (5.5, 0)
A_8: A_7 + (5.5, 0)
A_9: A_8 + (5.5, 0)
A_{10}: A_9 + (5.5, 0)
C_1: A_2 - (1, 0)
C_2: A_3 - (1, 0)
C_3: A_4 - (1, 0)
C_4: A_5 - (1, 0)
C_5: A_6 - (1, 0)
C_6: A_7 - (1, 0)
C_7: A_8 - (1, 0)
C_8: A_9 - (1, 0)
C_9: A_{10} - (1, 0)
d = Segment(C, A - (0, 2))
b = BarChart({5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55}, listB / m, 4)
listC = Sequence(Text["" + (Element[listB, i]), (5 * i - 1.1, Element[listB, i] / m + 1)], i, 1, 11)
α: Element[list1, k] + Element[list2, k] + Element[list3, k] + Element[list4, k] + Element[list5, k] + Element[list6, k] + Element[list7, k] + Element[list8, k] + Element[list9, k] + Element[list_{10}, k]
text13: "$ 共投擲" + (LaTeX[n]) + "次 $
$第" + (LaTeX[k]) + "次投擲$
$出現" + (LaTeX[10 - α]) + "個正面$
$" + (LaTeX[α]) + "個反面$"
c = 9 (slider from 0 to 10, step 1)
q = Binomial(10, c)
text14: "$若隨機變數X表出現$
$正面的次數$
$出現" + (LaTeX[c]) + "個正面的機率為：$
$P(X=" + (LaTeX[c]) + ")=\frac{C^{10}_{" + (LaTeX[c]) + "}}{2^{10}} $
      $=\frac{" + (LaTeX[q]) + "}{1024}=" + (LaTeX[FractionText[q / 1024]]) + "$"