From e66709beeb36ee6f0967a0e309e41f52af29935f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20M=C3=BCller?= Date: Sat, 30 Jan 2021 21:46:50 +0100 Subject: =?UTF-8?q?parrondo=20vollst=C3=A4ndig?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../80-wahrscheinlichkeit/rechnungen/btilde.maxima | 107 ++++++++++++++++----- 1 file changed, 82 insertions(+), 25 deletions(-) (limited to 'buch/chapters/80-wahrscheinlichkeit/rechnungen/btilde.maxima') 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); -- cgit v1.2.1