[過去ログ]
高校数学の質問スレ Part437 (1002レス)
高校数学の質問スレ Part437 http://rio2016.5ch.net/test/read.cgi/math/1721071007/
上
下
前次
1-
新
通常表示
512バイト分割
レス栞
抽出解除
レス栞
このスレッドは過去ログ倉庫に格納されています。
次スレ検索
歴削→次スレ
栞削→次スレ
過去ログメニュー
198: 132人目の素数さん [sage] 2024/07/22(月) 12:58:18.24 ID:ULPBznRV >>191 Sum[n4=40-n1-n2-n3;Boole[n1>1] Boole[n2>1] Boole[n3>1] Boole[n4>1] Multinomial[n1,n2,n3,n4] (4/10)^n1 (3/10)^n2 (2/10)^n3 (1/10)^n4,{n1,0,40},{n2,0,40-n1},{n3,0,40-n1-n2}] = 17931735688870232246983662877718870163/19531250000000000000000000000000000000 = 0.918104867270156... Booleの積を Boole[Boole[n1>0]+Boole[n2>0]+Boole[n3>0]+Boole[n4>0]==3] に置き換えると>>156に使えるが、牛刀 http://rio2016.5ch.net/test/read.cgi/math/1721071007/198
205: 132人目の素数さん [sage] 2024/07/22(月) 15:13:14.11 ID:hi/KRuYG >>198 Multinomialって関数があるのか、他の人のコードを読むのは勉強になるなぁ。 http://rio2016.5ch.net/test/read.cgi/math/1721071007/205
208: 132人目の素数さん [sage] 2024/07/22(月) 15:24:44.40 ID:hi/KRuYG >>198 想定解に同じ。 Wolfram Language 14.0.0 Engine for Microsoft Windows (64-bit) Copyright 1988-2023 Wolfram Research, Inc. In[1]:= calc[n_,j_]:=( {p1,p2,p3,p4}={1/10,2/10,3/10,4/10}; y=Select[Partition[Flatten@Table[{x1,x2,x3,n-x1-x2-x3},{x1,Range[0,n]},{x2,Range[0,n]},{x3,Range[0,n]}],4],#[[4]]>=0&]; fn[x_] :=( {b1,b2,b3,b4}=x; Binomial[n,b1] p1^b1 Binomial[n-b1,b2] p2^b2 Binomial[n-b1-b2,b3] p3^b3 p4^b4 ); f1[x_]:= AllTrue[x,#>=j&]; Total[fn /@ Select[y,f1]] ) In[2]:= calc[40,2] 17931735688870232246983662877718870163 Out[2]= -------------------------------------- 19531250000000000000000000000000000000 http://rio2016.5ch.net/test/read.cgi/math/1721071007/208
メモ帳
(0/65535文字)
上
下
前次
1-
新
書
関
写
板
覧
索
設
栞
歴
スレ情報
赤レス抽出
画像レス抽出
歴の未読スレ
AAサムネイル
Google検索
Wikipedia
ぬこの手
ぬこTOP
0.178s*