[過去ログ]
高校数学の質問スレ Part437 (1002レス)
高校数学の質問スレ Part437 http://rio2016.5ch.net/test/read.cgi/math/1721071007/
上
下
前次
1-
新
通常表示
512バイト分割
レス栞
抽出解除
必死チェッカー(本家)
(べ)
自ID
レス栞
あぼーん
このスレッドは過去ログ倉庫に格納されています。
次スレ検索
歴削→次スレ
栞削→次スレ
過去ログメニュー
293: 132人目の素数さん [sage] 2024/07/24(水) 09:16:09.68 ID:0Mo5cQDr Pythonでのシミュレーション import numpy as np # 血液型の頻度比 probabilities = [0.4, 0.3, 0.2, 0.1] # シミュレーション回数 num_simulations = 100000 # 全ての血液型が2人以上集まるまでの採血人数を記録するリスト sampling_counts = [] # シミュレーション for _ in range(num_simulations): counts = np.zeros(4) # 各血液型のカウント total_samples = 0 while not all(counts >= 2): blood_type = np.random.choice(4, p=probabilities) counts[blood_type] += 1 total_samples += 1 sampling_counts.append(total_samples) # 平均を計算 average_samples = np.mean(sampling_counts) print(average_samples) http://rio2016.5ch.net/test/read.cgi/math/1721071007/293
メモ帳
(0/65535文字)
上
下
前次
1-
新
書
関
写
板
覧
索
設
栞
歴
スレ情報
赤レス抽出
画像レス抽出
歴の未読スレ
AAサムネイル
Google検索
Wikipedia
ぬこの手
ぬこTOP
1.613s*