aboutsummaryrefslogtreecommitdiffstats
path: root/buch/chapters/80-wahrscheinlichkeit/rechnungen
diff options
context:
space:
mode:
authorAndreas Müller <andreas.mueller@ost.ch>2021-01-30 21:46:50 +0100
committerAndreas Müller <andreas.mueller@ost.ch>2021-01-30 21:46:50 +0100
commite66709beeb36ee6f0967a0e309e41f52af29935f (patch)
treeaec1aa328fab3b7628374ab1226e5e8f14a2b18c /buch/chapters/80-wahrscheinlichkeit/rechnungen
parentadd more algebra stuff (diff)
downloadSeminarMatrizen-e66709beeb36ee6f0967a0e309e41f52af29935f.tar.gz
SeminarMatrizen-e66709beeb36ee6f0967a0e309e41f52af29935f.zip
parrondo vollständig
Diffstat (limited to '')
-rw-r--r--buch/chapters/80-wahrscheinlichkeit/rechnungen/btilde.maxima107
1 files changed, 82 insertions, 25 deletions
diff --git a/buch/chapters/80-wahrscheinlichkeit/rechnungen/btilde.maxima b/buch/chapters/80-wahrscheinlichkeit/rechnungen/btilde.maxima
index 16be152..6ba2ee6 100644
--- a/buch/chapters/80-wahrscheinlichkeit/rechnungen/btilde.maxima
+++ b/buch/chapters/80-wahrscheinlichkeit/rechnungen/btilde.maxima
@@ -1,46 +1,103 @@
-Btilde: matrix(
- [ -1 , 1/4 + epsilon, 3/4 - epsilon ],
- [ 1/10 - epsilon, -1 , 1/4 + epsilon ],
- [ 9/10 + epsilon, 3/4 - epsilon, -1 ]
+B: matrix(
+ [ 0 , 1/4, 3/4 ],
+ [ 1/10, 0 , 1/4 ],
+ [ 9/10, 3/4, 0 ]
);
+F: matrix(
+ [ 0, -1, 1 ],
+ [ 1, 0, -1 ],
+ [ -1, 1, 0 ]
+);
+G: matrix(
+ [ 0, -1, 1 ],
+ [ 1, 0, -1 ],
+ [ -1, 1, 0 ]
+);
+U: matrix([1], [1], [1]);
+p: (1/3) * U;
+
+ratsimp(expand((B * G) . p));
+ratsimp(expand(transpose(U) . (B * G) . p));
+
+/* find the eigenvector */
+/* find the eigenvector */
+B0: B - identfor(B);
-r: expand(Btilde[1] / Btilde[1,1]);
-Btilde[1]: r;
-Btilde[2]: Btilde[2] - Btilde[2,1] * r;
-Btilde[3]: Btilde[3] - Btilde[3,1] * r;
+r: expand(B0[1] / B0[1,1]);
+B0[1]: r;
+B0[2]: B0[2] - B0[2,1] * r;
+B0[3]: B0[3] - B0[3,1] * r;
-Btilde: expand(Btilde);
+B0: expand(B0);
-r: Btilde[2] / Btilde[2,2];
-Btilde[2]: r;
-Btilde[3]: Btilde[3] - Btilde[3,2] * r;
+r: B0[2] / B0[2,2];
+B0[2]: r;
+B0[3]: B0[3] - B0[3,2] * r;
-Btilde: ratsimp(expand(Btilde));
+B0: ratsimp(expand(B0));
-Btilde[1]: Btilde[1] - Btilde[1,2] * Btilde[2];
+B0[1]: B0[1] - B0[1,2] * B0[2];
-Btilde: ratsimp(expand(Btilde));
+B0: ratsimp(expand(B0));
l: 78 + 12 * epsilon + 80 * epsilon^2;
-D: ratsimp(expand(l*Btilde));
+D: ratsimp(expand(l*B0));
n: ratsimp(expand(l -D[1,3] -D[2,3]));
p: (1/n) * matrix(
-[ -Btilde[1,3]*l ],
-[ -Btilde[2,3]*l ],
+[ -B0[1,3]*l ],
+[ -B0[2,3]*l ],
[ l ]
);
p: ratsimp(expand(p));
-taylor(p, epsilon, 0, 3);
+/* compute the expected gain */
+G*B;
+ratsimp(expand(transpose(U). (G*B) . p));
-G: matrix(
- [ 0, 1, -1 ],
- [ -1, 0, 1 ],
- [ 1, -1, 0 ]
+/* modified game */
+Btilde: B - epsilon * F;
+ratsimp(expand((Btilde * G) . p));
+gain: ratsimp(expand(transpose(U) . (Btilde * G) . p));
+
+/* find the eigenvector */
+B0: Btilde - identfor(Btilde);
+
+r: expand(B0[1] / B0[1,1]);
+B0[1]: r;
+B0[2]: B0[2] - B0[2,1] * r;
+B0[3]: B0[3] - B0[3,1] * r;
+
+B0: expand(B0);
+
+r: B0[2] / B0[2,2];
+B0[2]: r;
+B0[3]: B0[3] - B0[3,2] * r;
+
+B0: ratsimp(expand(B0));
+
+B0[1]: B0[1] - B0[1,2] * B0[2];
+
+B0: ratsimp(expand(B0));
+
+l: 78 + 12 * epsilon + 80 * epsilon^2;
+
+D: ratsimp(expand(l*B0));
+n: ratsimp(expand(l -D[1,3] -D[2,3]));
+
+pepsilon: (1/n) * matrix(
+[ -B0[1,3]*l ],
+[ -B0[2,3]*l ],
+[ l ]
);
+pepsilon: ratsimp(expand(pepsilon));
+
+/* taylor series expansion of the eigenvector */
+taylor(pepsilon, epsilon, 0, 3);
-e: matrix([1,1,1]);
+/* expectation */
-ratsimp(expand(e. (G*Btilde) . p));
+G*Btilde;
+gainepsilon: ratsimp(expand(transpose(U). (G*Btilde) . pepsilon));
+taylor(gainepsilon, epsilon, 0, 5);