Sharedmarkov.sagewsOpen in CoCalc
Author: Matt Thomas
Views : 1
%typeset_mode True
P = Matrix([[1,0,0,0,0],[1/2,0,1/2,0,0],[0,1/2,0,1/2,0],[0,0,1/2,0,1/2],[0,0,0,0,1]]); P
(1000012012000120120001201200001)\displaystyle \left(\begin{array}{rrrrr} 1 & 0 & 0 & 0 & 0 \\ \frac{1}{2} & 0 & \frac{1}{2} & 0 & 0 \\ 0 & \frac{1}{2} & 0 & \frac{1}{2} & 0 \\ 0 & 0 & \frac{1}{2} & 0 & \frac{1}{2} \\ 0 & 0 & 0 & 0 & 1 \end{array}\right)
N(P^(50))
(1.000000000000000.0000000000000000.0000000000000000.0000000000000000.0000000000000000.7499999850988391.49011611938477×1080.0000000000000001.49011611938477×1080.2499999850988390.4999999850988390.0000000000000002.98023223876953×1080.0000000000000000.4999999850988390.2499999850988391.49011611938477×1080.0000000000000001.49011611938477×1080.7499999850988390.0000000000000000.0000000000000000.0000000000000000.0000000000000001.00000000000000)\displaystyle \left(\begin{array}{rrrrr} 1.00000000000000 & 0.000000000000000 & 0.000000000000000 & 0.000000000000000 & 0.000000000000000 \\ 0.749999985098839 & 1.49011611938477 \times 10^{-8} & 0.000000000000000 & 1.49011611938477 \times 10^{-8} & 0.249999985098839 \\ 0.499999985098839 & 0.000000000000000 & 2.98023223876953 \times 10^{-8} & 0.000000000000000 & 0.499999985098839 \\ 0.249999985098839 & 1.49011611938477 \times 10^{-8} & 0.000000000000000 & 1.49011611938477 \times 10^{-8} & 0.749999985098839 \\ 0.000000000000000 & 0.000000000000000 & 0.000000000000000 & 0.000000000000000 & 1.00000000000000 \end{array}\right)
N(vector([1/5,1/5,1/5,1/5,1/5])*P^(50))
(0.499999991059303,5.96046447753906×109,5.96046447753906×109,5.96046447753906×109,0.499999991059303)\displaystyle \left(0.499999991059303,\,5.96046447753906 \times 10^{-9},\,5.96046447753906 \times 10^{-9},\,5.96046447753906 \times 10^{-9},\,0.499999991059303\right)
Q = matrix([[0,1/2,0],[1/2,0,1/2],[0,1/2,0]]); Q
(0120120120120)\displaystyle \left(\begin{array}{rrr} 0 & \frac{1}{2} & 0 \\ \frac{1}{2} & 0 & \frac{1}{2} \\ 0 & \frac{1}{2} & 0 \end{array}\right)
R = matrix([[1/2,0],[0,0],[0,1/2]]); R
(12000012)\displaystyle \left(\begin{array}{rr} \frac{1}{2} & 0 \\ 0 & 0 \\ 0 & \frac{1}{2} \end{array}\right)
N = (identity_matrix(3)-Q).inverse(); N
(3211212112132)\displaystyle \left(\begin{array}{rrr} \frac{3}{2} & 1 & \frac{1}{2} \\ 1 & 2 & 1 \\ \frac{1}{2} & 1 & \frac{3}{2} \end{array}\right)
c = vector([1,1,1]); c
(1,1,1)\displaystyle \left(1,\,1,\,1\right)
N*c
(3,4,3)\displaystyle \left(3,\,4,\,3\right)
B = N*R; B
(341412121434)\displaystyle \left(\begin{array}{rr} \frac{3}{4} & \frac{1}{4} \\ \frac{1}{2} & \frac{1}{2} \\ \frac{1}{4} & \frac{3}{4} \end{array}\right)