二階馬可夫鍊
Author: 藍邦偉　老師

Markov\; Chain

設X=\left [ \begin{array}{cc} a  \ 1-a \ \end{array}  \right ]⇒AX=X 

a_{11}=

a_{12}=

x_{11}=

a11

x_{11}

a12

4

平衡狀態

$第$%v$次轉移$

$第$%v$步$

a = 0.2
b = 0.4
c = 0.3333333333333333
t_A: "A=\left [  \begin{array}{cc} " + (LaTeX[FractionText[a]]) + " & " + (LaTeX[FractionText[b]]) + " \\ " + (LaTeX[FractionText[1 - a]]) + " & " + (LaTeX[FractionText[1 - b]]) + " \\ \end{array} \right ] "
t_{p0}: "P^{(0)}=\left [\begin{array}{cc} " + (LaTeX[FractionText[c]]) + " \\ " + (LaTeX[FractionText[1 - c]]) + "  \end{array}   \right ] "
t_{P1}: "P^{(1)}=AP^{(0)}=\left [\begin{array}{cc} " + (LaTeX[FractionText[a]]) + " & " + (LaTeX[FractionText[b]]) + " \\ " + (LaTeX[FractionText[1 - a]]) + " & " + (LaTeX[FractionText[1 - b]]) + " \\ \end{array}   \right ] \left [ \begin{array}{cc} " + (LaTeX[FractionText[c]]) + " \\ " + (LaTeX[FractionText[1 - c]]) + "  \end{array}  \right ] =\left [ \begin{array}{cc} " + (LaTeX[FractionText[a * c + b * (1 - c)]]) + "  \\ " + (LaTeX[FractionText[(1 - a) * c + (1 - b) * (1 - c)]]) + "  \\ \end{array}  \right ] "
d: a * c + b * (1 - c)
e: a * d + b * (1 - d)
t_{P_2}: "P^{(2)}=AP^{(1)}=\left [\begin{array}{cc} " + (LaTeX[FractionText[a]]) + " & " + (LaTeX[FractionText[b]]) + " \\ " + (LaTeX[FractionText[1 - a]]) + " & " + (LaTeX[FractionText[1 - b]]) + " \\ \end{array}   \right ] \left [ \begin{array}{cc} " + (LaTeX[FractionText[d]]) + "\\ " + (LaTeX[FractionText[1 - d]]) + " \\ \end{array}  \right ] =\left [  \begin{array}{cc} " + (LaTeX[FractionText[e]]) + "  \\ " + (LaTeX[FractionText[1 - e]]) + " \\ \end{array} \right ] "
f: a * e + b * (1 - e)
t_{P3}: "P^{(3)}=AP^{(2)}=\left [ \begin{array}{cc} " + (LaTeX[FractionText[a]]) + " & " + (LaTeX[FractionText[b]]) + " \\ " + (LaTeX[FractionText[1 - a]]) + " & " + (LaTeX[FractionText[1 - b]]) + " \\ \end{array}  \right ] \left [ \begin{array}{cc} " + (LaTeX[FractionText[e]]) + "  \\ " + (LaTeX[FractionText[1 - e]]) + "  \\ \end{array}  \right ] =\left [ \begin{array}{cc} " + (LaTeX[FractionText[f]]) + "  \\ " + (LaTeX[FractionText[1 - f]]) + "  \\ \end{array}  \right ] "
g: b / (1 - a + b)
inputBox1 = Textfield(a)
inputBox3 = Textfield(c)
inputBox2 = Textfield(b)
k = false
n = 0 (slider from 0 to 3, step 1)
i = false
h = false
j = false
s = 0 (slider from 0 to 6, step 1)
T_2: "$ \left [  \begin{array}{cc} " + (LaTeX[a]) + " &" + (LaTeX[b]) + " \\ " + (LaTeX[1 - a]) + " & " + (LaTeX[1 - b]) + " \\ \end{array} \right ]  \left [  \begin{array}{cc} a  \\ 1-a  \\ \end{array} \right ] $"
T_4: "$  =\left [ \begin{array}{cc}  " + (LaTeX[a - b]) + "a+" + (LaTeX[b]) + "  \\ " + (LaTeX[b - a]) + " a+" + (LaTeX[1 - b]) + "  \\ \end{array}  \right ] $"
T_5: "$ ⇒a=" + (LaTeX[FractionText[g]]) + " $"
T_6: "$ ⇒X=\left [  \begin{array}{cc}  " + (LaTeX[FractionText[g]]) + " \\  " + (LaTeX[FractionText[1 - g]]) + " \\ \end{array} \right ]  $"
T_3: "$ = \left [\begin{array}{cc} " + (LaTeX[a]) + "a+" + (LaTeX[b]) + "(1-a)  \\ " + (LaTeX[1 - a]) + " a+" + (LaTeX[1 - b]) + " (1-a)\\ \end{array}   \right ] $"