Date: 4 6 月 2014

random_1

顯示:編號

顯示:說明

Start

Reset

B = (1.6561720234420232, -0.9805990608678303)
r = 3 (slider from 1 to 10, step 1)
g = 5 (slider from 1 to 10, step 1)
a = 0.71 (slider from 0 to 1, step 0.01)
A = (6.9524243123477385, 1.4950437714942348)
k = 0 (slider from 0 to 2, step 0.01)
c = true
text2 = Text("取出的球依序擺放區", B + (0, 1), true, true)
list3 = Shuffle(a * 0 + Sequence[i, i, 1, g])
list2 = Shuffle(a * 0 + Sequence[i, i, 1, r])
list0 = Join({Sequence[Segment[B + (i, 0), B + (i, -1)], i, 0, r + g], Sequence[Segment[B + (0, -i), B + (r + g, -i)], i, 0, 1], Sequence[Text["" + (i), B + (i - 1, 0.4), true, true], i, 1, r + g], Sequence[Segment[A + (i, 0), A + (i, -2)], i, 0, Max[{r, g}]], Sequence[Segment[A + (0, i), A + (Max[{r, g}], i)], i, 0, -2, -1]})
list1: {Polygon[A, A + (Max[{r, g}], 0), A + (Max[{r, g}], -2), A + (0, -2)]}
list6 = Join({Sequence[A + (Element[list3, i] - 1, -1), i, 1, g], Sequence[A + (Element[list2, i] - 1, 0), i, 1, r]})
list7 = Sequence(B + (i - 1, 0), i, 1, r + g)
list5 = Join({{r + g}, Shuffle[a * 0 + Sequence[i, i, 1, r + g - 1]]})
list8 = Sequence(If[i ≟ 1, If[k < 1, Element[list6, i] + k * (Element[list7, Element[list5, i]] - Element[list6, i]), Element[list7, Element[list5, i]]], If[k ≤ 1, Element[list6, i], If[k ≥ 2, Element[list7, Element[list5, i]], Element[list6, i] + (k - 1) * (Element[list7, Element[list5, i]] - Element[list6, i])]]], i, 1, r + g)
list4 = Join({list3, list2})
poly1 = Polygon(B + (r + g, 0), B + (r + g - 1, 0), 4)
list11 = Sequence(Polygon[B + (i, 0), B + (i - 1, 0), 4], i, 1, r + g - 1)
b = false
list12 = Sequence(Circle[Element[list8, i] + (0.5, -0.5), 0.4], i, 1, g)
list13 = Sequence(Circle[Element[list8, i] + (0.5, -0.5), 0.4], i, g + 1, r + g)
list10 = Sequence(Text[If[i ≤ g, "\textcolor{003300}{" + (Element[list4, i]) + "}", "\textcolor{yellow}{" + (Element[list4, i]) + "}"], Element[list8, i] + (0.25, -0.2), true, true], i, 1, r + g)
text1 = Text("待取的球擺放區", A + (0, 0.6), true, true)
text4: "r個紅球及g個綠球，\;每次取出一球，\;取後不放回，\;紅球先取完問題:
\cr" + (LaTeX[If[c ≟ 1, "★:球有編號(視為相異)時:任意排共有\textcolor{blue}{(r+g)!}種排列方式 \cr設:紅球先拿完的事件R⇒n(R)=\textcolor{blue}{C^{g}_1·(r+g-1)!} \cr ⇒紅球先拿完的機率:P(R)=\textcolor{blue}{\frac{C^{g}_1·(r+g-1)!}{(r+g)!}}=\textcolor{blue}{\frac{g}{r+g}}=\textcolor{red}{1-\left( \frac{r}{r+g}  \right)} ", "★:球無編號(視為相同)時:任意排共有\textcolor{blue}{\frac{(r+g)!}{r!·g!}}種排列方式 \cr 設:紅球先拿完的事件R⇒n(R)=\textcolor{blue}{1·\frac{(r+g-1)!}{r!·(g-1)!}} \cr⇒紅球先拿完的機率:P(R)=\textcolor{blue}{\frac{ \text{   } \frac{(r+g-1)! }{r!·(g-1)!} \text{   }}{ \frac{(r+g)!}{r!·g!}}}=\textcolor{blue}{\frac{g}{r+g}}=\textcolor{red}{1-\left( \frac{r}{r+g}  \right)} "]]) + ""
text3: " " + (LaTeX[r]) + "個紅球, " + (LaTeX[g]) + "個綠球取出排成一列:
\cr" + (LaTeX[If[c ≟ 1, "★(有編號時視為相異物,利用完全相異物的排列)", "★(無編號時視為相同物,利用不盡相異物的排列)"]]) + "⇒任意排共有\underline{\text{  }\textcolor{blue}{" + (LaTeX[If[c ≟ 1, "" + (r + g) + "!", "\frac{" + (r + g) + "!}{" + r + "!·" + g + "!}"]]) + "}\text{  }}種方法
\cr \underline{紅球先拿完(最後一個必為綠球)}狀況:
\cr" + (LaTeX[If[k > 0, "(1).先由綠球中拿一球放在第" + (r + g) + "位置⇒有\underline{\text{  }\textcolor{blue}{" + (If[c ≟ 1, "C^{" + g + "}_{1}", "1"]) + "}\text{  }}種方法", ""]]) + "
\cr" + (LaTeX[If[k > 1, "(2).將剩下的" + (g - 1) + "個綠球及" + r + "個紅球排入前面" + (g + r - 1) + "個位置上⇒有\underline{\text{  }\textcolor{blue}{" + (If[c ≟ 1, "" + (g + r - 1) + "!", "\frac{" + (g + r - 1) + "!}{" + (g - 1) + "!·" + r + "!}"]) + "}\text{  }}種方法", ""]]) + "
\cr" + (LaTeX[If[k ≟ 2, "結論:共有\underline{\text{  }\textcolor{blue}{" + (If[c ≟ 1, "C^{" + g + "}_{1}·" + (g + r - 1) + "!", "1·\frac{" + (g + r - 1) + "!}{" + (g - 1) + "!·" + r + "!}"]) + "}\text{  }}種方法", ""]]) + "
\cr" + (LaTeX[If[k ≟ 2, "\text{    }⇒\underline{紅球先拿完(最後一個必為綠球)}的機率:\textcolor{blue}{\frac{\text{  }" + (If[c ≟ 1, "C^{" + g + "}_{1}·" + (g + r - 1) + "!", "1·\frac{" + (g + r - 1) + "!}{" + (g - 1) + "!·" + r + "!}"]) + "\text{  }}{" + (If[c ≟ 1, "" + (r + g) + "!", "\frac{" + (r + g) + "!}{" + r + "!·" + g + "!}"]) + "}}=\textcolor{red}{\frac{" + g + "}{" + (r + g) + "}}", ""]]) + ""