[表示 : 全て 最新50 1-99 101- 201- 301- 401- 501- 601- 701- 801- 901- 1001- 2chのread.cgiへ]
Update time : 12/19 02:05 / Filesize : 264 KB / Number-of Response : 1002
[このスレッドの書き込みを削除する]
[+板 最近立ったスレ&熱いスレ一覧 : +板 最近立ったスレ/記者別一覧] [類似スレッド一覧]


↑キャッシュ検索、類似スレ動作を修正しました、ご迷惑をお掛けしました

〓Mathematica〓



924 名前:132人目の素数さん mailto:sage [04/01/21 19:00]
>>922
実験のフレームワークと1番目の解答まで書いてみよう。

(* GetBall : get a ball from the vase given as the args. *)
GetBall[Vase[nTotal_Integer, nRed_Integer]] :=
  If[Random[Integer, {1, nTotal}] <= nRed, Red, Black]

(* Onestep : {n, n-th vase} -> {n+1, (n+1)-th vase} *)
OneStep[{nth_Integer, v : Vase[nTotal_, nRed_]}] := {nth +
      1, (#[v] &) /@ Table[GetBall, {i, nTotal}] //
      Vase[nTotal, Count[#, Red]] &}

(* Trial returns {iFix, fixColor} *)
Trial[nTotal_, nRed0_] :=
  NestWhile[OneStep, {1, Vase[nTotal, nRed0]},
      #[[2, 2]] != 0 && #[[2, 2]] != nTotal &] /. {Vase[nTotal, 0] -> Black,
      Vase[nTotal, nTotal] -> Red}

(* pRed *)
pRed[trys_][nTotal_, nRed0_] :=
  Count[Table[Trial[nTotal, nRed0], {trys}], {_, Red}] / trys // N






[ 続きを読む ] / [ 携帯版 ]

全部読む 前100 次100 最新50 [ このスレをブックマーク! 携帯に送る ] 2chのread.cgiへ
[+板 最近立ったスレ&熱いスレ一覧 : +板 最近立ったスレ/記者別一覧]( ´∀`)<264KB

read.cgi ver5.27 [feat.BBS2 +1.6] / e.0.2 (02/09/03) / eucaly.net products.
担当:undef