高校数学の質問スレ(医者・東大卒専用) Part438 (991レス)
1-

487: 2024/12/30(月)03:17 ID:DAgtZ3Zg(2/5) AAS
(* 遷移行列の定義 *)
P = {
{0, 0.5, 0.5, 0, 0}, (* S0: 初戦 A vs B *)
{0, 0, 0, 0.5, 0.5}, (* S1: A vs C *)
{0, 0, 0, 0.5, 0.5}, (* S2: B vs C *)
{0.5, 0, 0, 0, 0.5}, (* S3: 再試合 A vs B *)
{0.5, 0, 0, 0.5, 0} (* S4: 再試合 B vs A *)
};

(* 遷移行列の転置 *)
PT = Transpose[P];

(* 固有値と固有ベクトルの計算 *)
{eigValues, eigVectors} = Eigensystem[PT];

(* 固有値1に対応する固有ベクトル *)
stationaryVector = Select[eigVectors,
Norm[PT.# - #] & /@ eigValues == 1
][[1]];

(* 正規化(確率の総和を1にする) *)
stationaryVector = stationaryVector/Total[stationaryVector];

(* 各プレイヤーの勝率を計算 *)
AWin = stationaryVector[[2]] + stationaryVector[[4]];
BWin = stationaryVector[[3]] + stationaryVector[[5]];
CWin = stationaryVector[[1]];

(* 結果表示 *)
{stationaryVector, AWin, BWin, CWin}
1-
あと 504 レスあります
スレ情報 赤レス抽出 画像レス抽出 歴の未読スレ AAサムネイル

ぬこの手 ぬこTOP 0.010s