Skip to content

Commit eaaf601

Browse files
committed
added quick simulation to BanachMatchbox.ipynb
1 parent 453fbb3 commit eaaf601

File tree

1 file changed

+30
-1
lines changed

1 file changed

+30
-1
lines changed

BanachMatchbox.ipynb

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -424,7 +424,36 @@
424424
"\n",
425425
"Finally, for $P_7$, we have the following:\n",
426426
"\n",
427-
"$$ P_7 = p_7 (1-P_4)(1-p_5)(1-p_6) = 1\\frac{7}{8}\\frac{5}{7}\\frac{1}{2} =\\frac{5}{16}$$\n"
427+
"$$ P_7 = p_7 (1-P_4)(1-p_5)(1-p_6) = 1\\frac{7}{8}\\frac{5}{7}\\frac{1}{2} =\\frac{5}{16}$$\n",
428+
"\n",
429+
"Note that\n",
430+
"\n",
431+
"$$ P_4+P_5+P_6+P_7 = 1 $$\n",
432+
"\n",
433+
"A quick simulation can bear this out. "
434+
]
435+
},
436+
{
437+
"cell_type": "code",
438+
"execution_count": 53,
439+
"metadata": {
440+
"collapsed": false
441+
},
442+
"outputs": [
443+
{
444+
"data": {
445+
"text/plain": [
446+
"Counter({4: 130, 5: 276, 6: 288, 7: 306})"
447+
]
448+
},
449+
"execution_count": 53,
450+
"metadata": {},
451+
"output_type": "execute_result"
452+
}
453+
],
454+
"source": [
455+
"from collections import Counter\n",
456+
"Counter([len(tuple(step())) for i in range(1000)])"
428457
]
429458
},
430459
{

0 commit comments

Comments
 (0)