Date: 10 6 月 2014

random

顯示:編號

start

Reset

A = (6, 3)
g = 3 (slider from 1 to 10, step 1)
r = 7 (slider from 1 to 10, step 1)
a = 0.88 (slider from 0 to 1, step 0.01)
list2 = Sequence(i, i, 1, r + g)
list4 = Join({Sequence[A + (i - 1, 0), i, 1, r], Sequence[A + (i - 1, -1), i, 1, g]})
list3 = Shuffle(list2 + a * 0)
B = (1, -2)
k = 0 (slider from 0 to r + g, step 0.01)
c = true
text2 = Text("取出的球依序擺放區", B + (0, 1), true, true)
list1: {Polygon[A, A + (Max[{r, g}], 0), A + (Max[{r, g}], -2), A + (0, -2)]}
text3: "" + (LaTeX[r]) + " 個紅色球," + (LaTeX[g]) + " 個綠色球, 排成一列:
\cr" + (LaTeX[If[c ≟ 1, "***(有編號時視為相異物)***", "***(無編號時視為相同物)***"]]) + "
\cr" + (LaTeX[If[c ≟ 1, "***(利用完全相異物的排列)***", "***(利用不盡相異物的排列)***"]]) + "
\cr⇒所有不同排列方式:" + (LaTeX[If[c ≟ 1, "" + (r + g) + "!", "\frac{" + (r + g) + "!}{" + r + "!·" + g + "!}"]]) + "種"
list5 = Sequence(B + (i - 1, 0), i, 1, r + g)
list6 = Sequence(If[i ≤ floor(k), Element[list5, i], If[i > floor(k) + 1, Element[list4, Element[list3, i]], Element[list4, Element[list3, i]] + (k - floor(k)) * (Element[list5, i] - Element[list4, Element[list3, i]])]], i, 1, r + g)
list9 = RemoveUndefined(Sequence[If[Element[list3, i] ≤ r, Circle[Element[list6, i] + (0.5, -0.5), 0.4]], i, 1, r + g])
list10 = RemoveUndefined(Sequence[If[Element[list3, i] > r, Circle[Element[list6, i] + (0.5, -0.5), 0.4]], i, 1, r + g])
list7 = Sequence(Text[If[Element[list3, i] ≤ r, "\textcolor{yellow}{" + (Element[list3, i]) + "}", "\textcolor{003300}{" + (Element[list3, i] - r) + "}"], Element[list6, i] + (0.25, -0.2), true, true], i, 1, r + g)
text1 = Text("待取的球擺放區", A + (0, 0.6), true, true)
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[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], Sequence[Text["" + (i), B + (i - 1, 0.5), true, true], i, 1, r + g]})