<?xml version="1.0" encoding="UTF-8"?>
<rss  xmlns:atom="http://www.w3.org/2005/Atom" 
      xmlns:media="http://search.yahoo.com/mrss/" 
      xmlns:content="http://purl.org/rss/1.0/modules/content/" 
      xmlns:dc="http://purl.org/dc/elements/1.1/" 
      version="2.0">
<channel>
<title>Jonathan Whitmore</title>
<link>https://jonathanwhitmore.com/blog.html</link>
<atom:link href="https://jonathanwhitmore.com/blog.xml" rel="self" type="application/rss+xml"/>
<description>Personal website and blog</description>
<generator>quarto-1.9.37</generator>
<lastBuildDate>Sun, 08 Feb 2026 00:00:00 GMT</lastBuildDate>
<item>
  <title>A 3-Year Self-Directed Reading Program in Military Strategy and War</title>
  <dc:creator>Jonathan Whitmore</dc:creator>
  <link>https://jonathanwhitmore.com/posts/2026-02-08-military-strategy-reading-program/</link>
  <description><![CDATA[ 





<div class="quarto-figure quarto-figure-center">
<figure class="figure">
<p><img src="https://jonathanwhitmore.com/posts/2026-02-08-military-strategy-reading-program/uccello-san-romano.jpg" class="img-fluid figure-img"></p>
<figcaption>Paolo Uccello, <em>The Battle of San Romano</em> (c.&nbsp;1435–1440)</figcaption>
</figure>
</div>
<p>I created this reading program with the help of Claude, ChatGPT, and Gemini working together. It’s a 3-year, 48-book reading program covering military theory, grand strategy, operational art, and the human dimensions of warfare. Books are sequenced so that foundational ideas appear before their descendants, and each is mapped to the <strong>DIME framework</strong> (Diplomatic, Informational, Military, Economic instruments of national power).</p>
<section id="year-1-foundations-classical-roots-12-books" class="level2">
<h2 class="anchored" data-anchor-id="year-1-foundations-classical-roots-12-books">Year 1: Foundations &amp; Classical Roots (12 books)</h2>
<table class="caption-top table">
<colgroup>
<col style="width: 9%">
<col style="width: 22%">
<col style="width: 22%">
<col style="width: 25%">
<col style="width: 19%">
</colgroup>
<thead>
<tr class="header">
<th>#</th>
<th>Track</th>
<th>Title</th>
<th>Author</th>
<th>DIME</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td>1</td>
<td>Methodology</td>
<td><em>The Evolution of Strategy</em></td>
<td>Beatrice Heuser</td>
<td>I</td>
</tr>
<tr class="even">
<td>2</td>
<td>Classical</td>
<td><em>History of the Peloponnesian War</em></td>
<td>Thucydides</td>
<td>M/D</td>
</tr>
<tr class="odd">
<td>3</td>
<td>Classical</td>
<td><em>The Outbreak of the Peloponnesian War</em></td>
<td>Donald Kagan</td>
<td>D/M</td>
</tr>
<tr class="even">
<td>4</td>
<td>Classical</td>
<td><em>The Art of War</em></td>
<td>Sun Tzu</td>
<td>M/I</td>
</tr>
<tr class="odd">
<td>5</td>
<td>Theory</td>
<td><em>Strategy: The Logic of War and Peace</em></td>
<td>Edward Luttwak</td>
<td>M/D</td>
</tr>
<tr class="even">
<td>6</td>
<td>Theory</td>
<td><em>The Prince</em></td>
<td>Niccolo Machiavelli</td>
<td>D</td>
</tr>
<tr class="odd">
<td>7</td>
<td>Theory</td>
<td><em>On War</em> (Book 1)</td>
<td>Carl von Clausewitz</td>
<td>M/D</td>
</tr>
<tr class="even">
<td>8</td>
<td>Diplomacy</td>
<td><em>Diplomacy</em></td>
<td>Henry Kissinger</td>
<td>D</td>
</tr>
<tr class="odd">
<td>9</td>
<td>Diplomacy</td>
<td><em>American Diplomacy / Long Telegram</em></td>
<td>George Kennan</td>
<td>D/I</td>
</tr>
<tr class="even">
<td>10</td>
<td>Case Study</td>
<td><em>The Defeat of the Spanish Armada</em></td>
<td>Garrett Mattingly</td>
<td>D/M/I</td>
</tr>
<tr class="odd">
<td>11</td>
<td>Literature</td>
<td><em>The Iliad</em></td>
<td>Homer</td>
<td>Human</td>
</tr>
<tr class="even">
<td>12</td>
<td>Literature</td>
<td><em>Storm of Steel</em></td>
<td>Ernst Junger</td>
<td>Human</td>
</tr>
</tbody>
</table>
</section>
<section id="year-2-grand-strategy-operational-art-frameworks-19-books" class="level2">
<h2 class="anchored" data-anchor-id="year-2-grand-strategy-operational-art-frameworks-19-books">Year 2: Grand Strategy, Operational Art &amp; Frameworks (19 books)</h2>
<table class="caption-top table">
<colgroup>
<col style="width: 9%">
<col style="width: 22%">
<col style="width: 22%">
<col style="width: 25%">
<col style="width: 19%">
</colgroup>
<thead>
<tr class="header">
<th>#</th>
<th>Track</th>
<th>Title</th>
<th>Author</th>
<th>DIME</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td>13</td>
<td>Core Theory</td>
<td><em>On War</em> (Books 2–8)</td>
<td>Carl von Clausewitz</td>
<td>M/D</td>
</tr>
<tr class="even">
<td>14</td>
<td>Framework</td>
<td><em>The Strategy Bridge</em></td>
<td>Colin Gray</td>
<td>M/D</td>
</tr>
<tr class="odd">
<td>15</td>
<td>Core Theory</td>
<td><em>Arms and Influence</em></td>
<td>Thomas Schelling</td>
<td>M/I</td>
</tr>
<tr class="even">
<td>16</td>
<td>Implementation</td>
<td><em>Essence of Decision</em></td>
<td>Graham Allison &amp; Philip Zelikow</td>
<td>D/M/I</td>
</tr>
<tr class="odd">
<td>17</td>
<td>Grand Strategy</td>
<td><em>The Rise and Fall of the Great Powers</em></td>
<td>Paul Kennedy</td>
<td>E/M</td>
</tr>
<tr class="even">
<td>18</td>
<td>Grand Strategy</td>
<td><em>Why Nations Fail</em></td>
<td>Daron Acemoglu &amp; James Robinson</td>
<td>E/D</td>
</tr>
<tr class="odd">
<td>19</td>
<td>Grand Strategy</td>
<td><em>The Twenty Years’ Crisis</em></td>
<td>E.H. Carr</td>
<td>D</td>
</tr>
<tr class="even">
<td>20</td>
<td>Grand Strategy</td>
<td><em>The Struggle for Mastery in Europe</em></td>
<td>A.J.P. Taylor</td>
<td>D/M</td>
</tr>
<tr class="odd">
<td>21</td>
<td>Grand Strategy</td>
<td><em>On Grand Strategy</em></td>
<td>John Lewis Gaddis</td>
<td>D/M</td>
</tr>
<tr class="even">
<td>22</td>
<td>Anthology</td>
<td><em>Makers of Modern Strategy</em></td>
<td>Peter Paret (ed.)</td>
<td>M/D/I</td>
</tr>
<tr class="odd">
<td>23</td>
<td>Nuclear</td>
<td><em>The Evolution of Nuclear Strategy</em></td>
<td>Lawrence Freedman</td>
<td>M/I</td>
</tr>
<tr class="even">
<td>24</td>
<td>Operational</td>
<td><em>Soviet Military Operational Art</em></td>
<td>David Glantz</td>
<td>M</td>
</tr>
<tr class="odd">
<td>25</td>
<td>Operational</td>
<td><em>The Influence of Sea Power Upon History</em></td>
<td>Alfred Thayer Mahan</td>
<td>M/E</td>
</tr>
<tr class="even">
<td>26</td>
<td>Operational</td>
<td><em>Some Principles of Maritime Strategy</em></td>
<td>Julian Corbett</td>
<td>M/D</td>
</tr>
<tr class="odd">
<td>27</td>
<td>Operational</td>
<td><em>Foundations of the Science of War</em></td>
<td>J.F.C. Fuller</td>
<td>M</td>
</tr>
<tr class="even">
<td>28</td>
<td>Operational</td>
<td><em>The Air Campaign</em></td>
<td>John Warden</td>
<td>M</td>
</tr>
<tr class="odd">
<td>29</td>
<td>Innovation</td>
<td><em>Military Innovation in the Interwar Period</em></td>
<td>Murray &amp; Millett</td>
<td>M</td>
</tr>
<tr class="even">
<td>30</td>
<td>Literature</td>
<td><em>War and Peace</em></td>
<td>Leo Tolstoy</td>
<td>Human</td>
</tr>
<tr class="odd">
<td>31</td>
<td>Literature</td>
<td><em>Dispatches</em></td>
<td>Michael Herr</td>
<td>Human</td>
</tr>
<tr class="even">
<td>32</td>
<td>Literature</td>
<td><em>Matterhorn</em></td>
<td>Karl Marlantes</td>
<td>Human</td>
</tr>
</tbody>
</table>
</section>
<section id="year-3-contemporary-challenges-critique-synthesis-17-books" class="level2">
<h2 class="anchored" data-anchor-id="year-3-contemporary-challenges-critique-synthesis-17-books">Year 3: Contemporary Challenges, Critique &amp; Synthesis (17 books)</h2>
<table class="caption-top table">
<colgroup>
<col style="width: 9%">
<col style="width: 22%">
<col style="width: 22%">
<col style="width: 25%">
<col style="width: 19%">
</colgroup>
<thead>
<tr class="header">
<th>#</th>
<th>Track</th>
<th>Title</th>
<th>Author</th>
<th>DIME</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td>33</td>
<td>Irregular</td>
<td><em>Counterinsurgency</em></td>
<td>David Kilcullen</td>
<td>M/I</td>
</tr>
<tr class="even">
<td>34</td>
<td>Irregular</td>
<td><em>The Dragons and the Snakes</em></td>
<td>David Kilcullen</td>
<td>M/I</td>
</tr>
<tr class="odd">
<td>35</td>
<td>Irregular</td>
<td><em>Wrong Turn</em></td>
<td>Gian Gentile</td>
<td>M/D</td>
</tr>
<tr class="even">
<td>36</td>
<td>Irregular</td>
<td><em>A Savage War of Peace</em></td>
<td>Alistair Horne</td>
<td>M/D/I</td>
</tr>
<tr class="odd">
<td>37</td>
<td>Irregular</td>
<td><em>Inside Al Qaeda</em></td>
<td>Rohan Gunaratna</td>
<td>I/M</td>
</tr>
<tr class="even">
<td>38</td>
<td>Non-Western</td>
<td><em>Unrestricted Warfare</em></td>
<td>Qiao Liang &amp; Wang Xiangsui</td>
<td>M/I/E</td>
</tr>
<tr class="odd">
<td>39</td>
<td>Non-Western</td>
<td><em>Grand Strategy of the Byzantine Empire</em></td>
<td>Edward Luttwak</td>
<td>D/I</td>
</tr>
<tr class="even">
<td>40</td>
<td>Information</td>
<td><em>Active Measures</em></td>
<td>Thomas Rid</td>
<td>I</td>
</tr>
<tr class="odd">
<td>41</td>
<td>Economic</td>
<td><em>War by Other Means</em></td>
<td>Blackwill &amp; Harris</td>
<td>E/D</td>
</tr>
<tr class="even">
<td>42</td>
<td>Failure</td>
<td><em>The March of Folly</em></td>
<td>Barbara Tuchman</td>
<td>D/M</td>
</tr>
<tr class="odd">
<td>43</td>
<td>Intelligence</td>
<td><em>Strategic Surprise</em></td>
<td>Richard Betts</td>
<td>I/M</td>
</tr>
<tr class="even">
<td>44</td>
<td>Ethics</td>
<td><em>Just and Unjust Wars</em></td>
<td>Michael Walzer</td>
<td>D/M</td>
</tr>
<tr class="odd">
<td>45</td>
<td>Civil-Military</td>
<td><em>The Soldier and the State</em></td>
<td>Samuel Huntington</td>
<td>D/M</td>
</tr>
<tr class="even">
<td>46</td>
<td>Literature</td>
<td><em>The Things They Carried</em></td>
<td>Tim O’Brien</td>
<td>Human</td>
</tr>
<tr class="odd">
<td>47</td>
<td>Literature</td>
<td><em>Blood Meridian</em></td>
<td>Cormac McCarthy</td>
<td>Human</td>
</tr>
<tr class="even">
<td>48</td>
<td>Literature</td>
<td><em>Generation Kill</em></td>
<td>Evan Wright</td>
<td>Human</td>
</tr>
</tbody>
</table>


</section>

 ]]></description>
  <category>strategy</category>
  <category>military history</category>
  <category>reading list</category>
  <category>self-education</category>
  <guid>https://jonathanwhitmore.com/posts/2026-02-08-military-strategy-reading-program/</guid>
  <pubDate>Sun, 08 Feb 2026 00:00:00 GMT</pubDate>
  <media:content url="https://jonathanwhitmore.com/posts/2026-02-08-military-strategy-reading-program/daumier-preview.webp" medium="image" type="image/webp"/>
</item>
<item>
  <title>Is MathAcademy Worth It? Thoughts After 2,000 Experience Points (XP)</title>
  <dc:creator>Jonathan Whitmore</dc:creator>
  <link>https://jonathanwhitmore.com/posts/2024-09-10-mathacademy/</link>
  <description><![CDATA[ 





<section id="introduction" class="level1 page-columns page-full">
<h1>Introduction</h1>
<p>For the past two months, I’ve dedicated daily practice to <a href="https://MathAcademy.com">MathAcademy.com</a>, accumulating more than 2,000 experience points (~40 hours of total work).</p>
<p><a href="https://en.wikipedia.org/wiki/BLUF_(communication)">Main takeaway</a>: <strong>MathAcademy is extraordinary</strong>.</p>

<div class="no-row-height column-margin column-container"><div class="">
<p><a href="https://MathAcademy.com">MathAcademy.com</a> is an online platform that adapts to each student’s learning pace and style, ensuring mastery of mathematical concepts through scientifically-backed methods. Currently ~$50 per month.</p>
</div></div><p>In this post, I’ll explore the concept of knowledge retention, introduce you to MathAcademy, and share my personal experience with the platform. I’ll also cover how MathAcademy addresses the challenges of efficient learning and long-term knowledge retention, and why I believe it’s a game-changer for motivated individuals with the goal of learning math.</p>
</section>
<section id="what-is-mathacademy" class="level1 page-columns page-full">
<h1>What is MathAcademy?</h1>
<p>MathAcademy is an innovative online learning platform that goes beyond traditional math education methods. It uses adaptive learning algorithms to tailor the learning experience to each student’s current knowledge. Unlike many other platforms, MathAcademy focuses on efficiently teaching true mastery of concepts.</p>
<p>It has offerings for students in 4th grade through university level mathematics (pretty deep into a standard math major curriculum). It has a couple of other paths for different student needs. The Mathematics Foundations series is tailored to adult students who, like me, are mostly re-learning content they “learned” 20 years ago. See this <a href="https://mathacademy.com/courses/">list of courses</a> for a better explanation.</p>

<div class="no-row-height column-margin column-container"><div class="">
<p>Here’s <a href="https://x.com/ninja_maths/status/1834324698663915551">a tweet</a> from one of the content authors (<a href="https://x.com/ninja_maths"><span class="citation" data-cites="ninja_maths">@ninja_maths</span></a>) at MathAcademy with more on the Foundations series.</p>
</div></div><p>Two more courses that have drawn my attention are the <a href="https://mathacademy.com/courses/mathematics-for-machine-learning">Mathematics for Machine Learning</a> and the <a href="https://mathacademy.com/courses/methods-of-proof">Methods of Proof</a> classes. Soon.</p>
</section>
<section id="the-challenge-knowledge-retention" class="level1 page-columns page-full">
<h1>The Challenge: Knowledge Retention</h1>
<p>Throughout our lives, we’ve gathered countless bits of knowledge, only to watch some of them drift away. Take the rivers of Texas, for example—I once knew them, but now I can’t quite recall which one is the Brazos. And perhaps, like me, you’re perfectly content letting such details fade into the aether*.</p>

<div class="no-row-height column-margin column-container"><div class="">
<p>*The <a href="https://en.wikipedia.org/wiki/Aether_theories">aether</a> is not real.</p>
</div></div><p>But what if the knowledge that slipped away was something you truly cared about?</p>
<p>Years ago, I went to graduate school to get a PhD in physics. One of the significant hurdles along the way was the qualifying exam, known simply as “the qual”. Fast forward a few years, and when the topic of “the qual” came up with my fellow graduate students, we’d lament the skills that we had lost, and wonder if we could still pass it. Some were confident they still had the chops, while others—myself included—suspected we’d need a fair bit of luck.</p>

<div class="no-row-height column-margin column-container"><div class="">
<p>The physics department at UC San Diego no longer requires “the qual”. I’ve maintained the qualifying exams from 1987–2019 on my personal website since about 2008: <a href="https://jonathanwhitmore.com/physics/physics-quals/">UC San Diego, Physics PhD Qualifying Exams</a>.</p>
</div></div><p>I felt that losing all that knowledge was incredibly sad. And I knew that all it would take is some dedicated and persistent effort from my side. But I had no idea how much time and effort it would take.</p>
<section id="the-costbenefit-tradeoff-of-knowledge-retention" class="level2 page-columns page-full">
<h2 class="anchored" data-anchor-id="the-costbenefit-tradeoff-of-knowledge-retention">The Cost/Benefit Tradeoff of Knowledge Retention</h2>
<p>I wanted to have a good estimate of what the Cost/Benefit tradeoff looked like. If I wanted to retain 90% of my physics knowledge, was it closer to the optimistic or pessimistic curve?</p>
<div id="fig-tradeoff" class="quarto-float quarto-figure quarto-figure-center anchored">
<figure class="quarto-float quarto-float-fig figure">
<div aria-describedby="fig-tradeoff-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
<img src="https://jonathanwhitmore.com/posts/2024-09-10-mathacademy/tradeoff.png" class="img-fluid figure-img" style="width:80.0%">
</div>
<figcaption class="quarto-float-caption-bottom quarto-float-caption quarto-float-fig" id="fig-tradeoff-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
Figure&nbsp;1: Cost Benefit Tradeoff
</figcaption>
</figure>
</div>
<p>If it really was only 5 minutes of daily practice (optimistic curve) to maintain 90% of my physics knowledge and problem-solving skills, I’d easily commit to working on this while drinking my tea in the morning and keep myself 90% sharp. Conversely, if it required 47 minutes per day (pessimistic curve), realistically it wouldn’t be worth it.</p>
<p>But I didn’t have an answer to the question: <strong>What is the actual cost for maintaining different levels of knowledge?</strong></p>
<p>This question is crucial because it directly impacts how we approach learning and knowledge retention. If the cost is low, we might be more inclined to maintain a broader range of knowledge. If it’s high, we might need to be more selective about what we choose to retain.</p>
<p>The efficiency of practice is another critical factor. If you could identify the skills that were about to leave your mind and get lost in the abyss*, you could potentially optimize your retention efforts.</p>

<div class="no-row-height column-margin column-container"><div class="">
<p>*The <a href="https://en.wikipedia.org/wiki/Abyss_(Thelema)">abyss</a> is not real.</p>
</div></div><p>I’ve studied numerous technologies and learning strategies over the years. I’ve used Anki, a popular SRS (Spaced-Repetition Software or Spaced-Retrieval System) program, for years. One of the best mental reframes that I’ve had about Anki comes from <a href="https://michaelnielsen.org/">Michael Nielsen</a> when he writes, “<a href="https://augmentingcognition.com/ltm.html">Anki makes memory a choice</a>.” While Anki is a powerful tool, it’s not the focus of this post.</p>

<div class="no-row-height column-margin column-container"><div class="">
<p><a href="https://apps.ankiweb.net/">Anki</a> is a free program (the iOS app is not free) that makes remembering things easy.</p>
<blockquote class="blockquote">
<p>Because it’s a lot more efficient than traditional study methods, you can either greatly decrease your time spent studying, or greatly increase the amount you learn. – <a href="https://apps.ankiweb.net/">Anki website</a>.</p>
</blockquote>
</div></div></section>
<section id="going-beyond-retention" class="level2">
<h2 class="anchored" data-anchor-id="going-beyond-retention">Going beyond retention</h2>
<p>I set this up as a retention focused problem. But the problem is actually much larger. If you can create a system that both teaches and helps you retain what you’ve learned, you’ve done something special.</p>
<p>This is where MathAcademy comes back in, offering a solution that addresses both the efficiency of learning and the challenge of long-term retention.</p>
</section>
</section>
<section id="my-experience-with-mathacademy" class="level1 page-columns page-full">
<h1>My Experience with MathAcademy</h1>
<p>I’ve live-streamed myself working through a few practice sessions, so if you want to see what it looks like (and what I look like while working on it) here’s the session where I completed the <a href="https://mathacademy.com/courses/mathematical-foundations-ii">Foundations II</a> course:</p>
<div class="quarto-video ratio ratio-16x9"><iframe data-external="1" src="https://www.youtube.com/embed/xdhGvv3LYQI" title="" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen=""></iframe></div>
<section id="adaptive-learning-and-progress-tracking" class="level2 page-columns page-full">
<h2 class="anchored" data-anchor-id="adaptive-learning-and-progress-tracking">Adaptive Learning and Progress Tracking</h2>
<p>One of the most striking aspects of my MathAcademy experience has been its ability to adapt to my current knowledge level. I began with a diagnostic that identifies areas where I needed more practice, and areas that I already comfortably knew. After the diagnostic I was placed at something like 99% done with Foundations I, and 76% done with the Foundations II course. This personalized approach meant that I was always working at the edge of my abilities, maximizing my learning efficiency.</p>
<p>This point is important so I’ll state it another way. There are many free and high-quality math courses that exist on the internet right now. However, these lectures and videos are aimed at an audience that has a different background knowledge than me. There’s stuff that I already know, and probably things that the lecturer assumes that I know that I might not. So even with high quality courses, I have to spend significant time and effort in filtering the content so that I can actually get to the topics that are actually new to me (or look up something that I was supposed to have learned).</p>

<div class="no-row-height column-margin column-container"><div class="">
<p>It’s even more cool than that. They’ve developed a way of giving partial credit to lower level skills if you’ve just demonstrated a skill that relies on it. As I understand it, for example, if you do a higher level problem that requires a lower level skill to complete, you get partial reinforcement for that lower level skill. For more details, see: <a href="https://www.justinmath.com/individualized-spaced-repetition-in-hierarchical-knowledge-structures/">this blog post on Fractional Implicit Repetition</a>.</p>
</div></div><p>Further, they aren’t usually paired (as MathAcademy is) in a tight feedback loop with questions that test whether you could apply what you just learned. And finally, there is spaced-repetition built in, so it ensures that your knowledge is elevated into the heavenly quintessence* before it fades away.</p>

<div class="no-row-height column-margin column-container"><div class="">
<p>*The <a href="https://en.wikipedia.org/wiki/Aether_(classical_element)">heavenly quintessence</a> is not real.</p>
</div></div><p>Over my 40 hours of learning, I have completed the Mathematics <a href="https://mathacademy.com/courses/mathematical-foundations-ii">Foundations II</a> course. I’ve started Mathematics <a href="https://mathacademy.com/courses/mathematical-foundations-iii">Foundations III</a>, and again, a nice aspect of the site is that it gives an estimate of how many “experience points” it will take me to complete it. It, like Anki, turns a goal that I want to accomplish into something like “turn the effort-crank X times and you’ll have re-learned Linear Algebra to a deep level”.</p>
<p>This approach directly addresses the Cost/Benefit tradeoff we discussed earlier. By optimizing the learning process and providing clear metrics, MathAcademy helps minimize the “cost” side of the equation while maximizing the “benefit” through efficient, targeted learning.</p>
<p>It’s hard to give a good sense of how important that experience is. It’s a similar point that <a href="https://x.com/rorysutherland">Rory Sutherland</a> has made many times, including <a href="https://www.edge.org/conversation/rory_sutherland-this-thing-for-which-we-have-no-name">here</a>, where he says that the innovation of Uber is not the calling of a cab, but in showing you a real-time map of where your cab is while it’s on your way to pick you up. The act of reducing uncertainty is a very big effect, but it’s hard to appreciate if you’ve just read about it. I think a similar thing is happening with MathAcademy (whether by accident or by design); you know how much effort or time it is until you’ve learned your next goal. It seems like a small thing, but it’s not, it’s really important. And I’ve noticed a number of these things that really make a difference to the student’s experience.</p>
</section>
</section>
<section id="conclusion-is-it-worth-it" class="level1">
<h1>Conclusion: Is it worth it?</h1>
<p>After spending two months with MathAcademy, accumulating 2,000 experience points over about 40 hours of learning, I can confidently say that the $50 monthly subscription fee is well worth the investment. Here’s why:</p>
<ol type="1">
<li><strong>A Tireless Expert Tutor</strong>: For less than the cost of a single hour with a private math tutor, MathAcademy provides you with 24/7 access to what is essentially a tireless, expert math tutor. This AI-driven platform doesn’t get fatigued, lose patience, or have scheduling conflicts.</li>
<li><strong>Personalized Learning Path</strong>: MathAcademy excels at identifying exactly what you need to work on, zeroing in on your weak spots and areas for improvement.</li>
<li><strong>Mastery Through Practice</strong>: The platform provides a seemingly endless supply of practice problems tailored to your skill level, challenging you until you demonstrate true mastery of a concept.</li>
<li><strong>Structured Progression</strong>: It creates a clear path forward, eliminating the guesswork and potential gaps in knowledge that can occur with self-directed study.</li>
<li><strong>Long-Term Retention Focus</strong>: The platform’s use of spaced repetition and adaptive review ensures that you’re building lasting mathematical knowledge and skills.</li>
</ol>
<p>MathAcademy has not only helped me relearn and solidify mathematical concepts, but it’s also changed my perspective on what effective learning can look like. It addresses the question of knowledge retention in a way that balances efficiency and thoroughness, making it possible to maintain a high level of skill with manageable daily practice.</p>
<p>When you consider the depth of content, the adaptive technology, and the personalized attention you receive, MathAcademy offers exceptional value. For anyone serious about improving their math skills - whether you’re a student looking to excel in your classes, a professional aiming to enhance your quantitative abilities, or simply someone who wants to reconnect with mathematics - MathAcademy provides a level of instruction and practice that would cost hundreds or even thousands of dollars per month to replicate with traditional tutoring.</p>
<p>Returning to our initial question about the cost of maintaining knowledge, MathAcademy seems to offer a solution that leans towards the optimistic end of the spectrum. While it may not be as quick as “5 minutes a day,” the efficiency and effectiveness of the platform make the time investment highly worthwhile. It transforms the daunting tasks of learning and retaining complex mathematical knowledge into a manageable, even enjoyable, daily practice.</p>
<p>As I continue my journey with MathAcademy, I’m excited to see how much further I can progress and how well I’ll retain this knowledge in the long term. For anyone looking to learn or relearn mathematics, I can’t recommend MathAcademy highly enough. It’s not just a learning tool; it’s a new paradigm in education that makes mathematical mastery achievable for everyone.</p>
<section id="one-final-thought" class="level2">
<h2 class="anchored" data-anchor-id="one-final-thought">One final thought</h2>
<p>I am very interested in seeing if the MathAcademy team is thinking about expanding to math-adjacent topics like Physics. If so, I have a <a href="https://www.linkedin.com/in/jonathanbwhitmore/">person in mind</a> who is knowledgeable about physics, has enthusiastically bought into your overall approach, and has lots of ideas for problems and problem-types.</p>
</section>
</section>
<section id="acknowledgements" class="level1">
<h1>Acknowledgements</h1>
<p>Thank you to <a href="https://x.com/one_extra_j">Julija Whitmore</a> for reading early drafts of this.</p>
</section>
<section id="reference-links" class="level1">
<h1>Reference Links</h1>
<section id="mathacademy-resources" class="level2">
<h2 class="anchored" data-anchor-id="mathacademy-resources">MathAcademy Resources</h2>
<ul>
<li><a href="https://MathAcademy.com">MathAcademy.com</a></li>
<li><a href="https://mathacademy.com/courses/">List of courses</a></li>
<li><a href="https://mathacademy.com/courses/mathematics-for-machine-learning">Mathematics for Machine Learning</a></li>
<li><a href="https://mathacademy.com/courses/methods-of-proof">Methods of Proof</a></li>
<li><a href="https://mathacademy.com/courses/mathematical-foundations-ii">Foundations II</a></li>
<li><a href="https://mathacademy.com/courses/mathematical-foundations-iii">Foundations III</a></li>
<li><a href="https://www.bit.ly/ma-way">The MathAcademy Way</a></li>
<li><a href="https://www.justinmath.com/how-to-get-from-high-school-math-to-cutting-edge-ml-ai/">How to get from high school math to cutting-edge ML/AI</a></li>
</ul>
</section>
<section id="learning-and-memory" class="level2">
<h2 class="anchored" data-anchor-id="learning-and-memory">Learning and Memory</h2>
<ul>
<li><a href="https://apps.ankiweb.net/">Anki</a></li>
<li><a href="https://augmentingcognition.com/ltm.html">Anki makes memory a choice</a></li>
<li><a href="https://www.justinmath.com/individualized-spaced-repetition-in-hierarchical-knowledge-structures/">Fractional Implicit Repetition</a></li>
</ul>
</section>
<section id="physics-and-academia" class="level2">
<h2 class="anchored" data-anchor-id="physics-and-academia">Physics and Academia</h2>
<ul>
<li><a href="https://jonathanwhitmore.com/physics/physics-quals/">UC San Diego, Physics PhD Qualifying Exams</a></li>
</ul>
</section>
<section id="concepts-and-theories" class="level2">
<h2 class="anchored" data-anchor-id="concepts-and-theories">Concepts and Theories</h2>
<ul>
<li><a href="https://en.wikipedia.org/wiki/BLUF_(communication)">BLUF (communication)</a></li>
<li><a href="https://en.wikipedia.org/wiki/Aether_theories">Aether</a></li>
<li><a href="https://en.wikipedia.org/wiki/Abyss_(Thelema)">Abyss</a></li>
<li><a href="https://en.wikipedia.org/wiki/Aether_(classical_element)">Quintessence</a></li>
</ul>
</section>
<section id="people-and-profiles" class="level2">
<h2 class="anchored" data-anchor-id="people-and-profiles">People and Profiles</h2>
<ul>
<li><a href="https://michaelnielsen.org/">Michael Nielsen</a></li>
<li><a href="https://x.com/rorysutherland">Rory Sutherland</a></li>
<li><a href="https://www.linkedin.com/in/jonathanbwhitmore/">Jonathan Whitmore LinkedIn</a></li>
</ul>
</section>
<section id="articles-and-discussions" class="level2">
<h2 class="anchored" data-anchor-id="articles-and-discussions">Articles and Discussions</h2>
<ul>
<li><a href="https://www.edge.org/conversation/rory_sutherland-this-thing-for-which-we-have-no-name">This Thing For Which We Have No Name</a></li>
</ul>


</section>
</section>

 ]]></description>
  <category>math education</category>
  <category>learning</category>
  <category>cognitive science</category>
  <guid>https://jonathanwhitmore.com/posts/2024-09-10-mathacademy/</guid>
  <pubDate>Tue, 10 Sep 2024 00:00:00 GMT</pubDate>
</item>
<item>
  <title>[Solved] Custom Domain Keeps Reverting to GitHub Pages</title>
  <dc:creator>Jonathan Whitmore</dc:creator>
  <link>https://jonathanwhitmore.com/posts/2024-07-11-cname-fix/</link>
  <description><![CDATA[ 





<section id="solved-custom-domain-keeps-reverting-on-my-github-pages-site" class="level1">
<h1>[Solved] Custom Domain Keeps Reverting on My GitHub Pages Site</h1>
<section id="the-setup" class="level2">
<h2 class="anchored" data-anchor-id="the-setup">The Setup</h2>
<p>I used <a href="https://quarto.org/">Quarto</a> and <a href="https://nbdev.fast.ai/">nbdev</a> to create my website and a blog on a custom URL.</p>
<p>The whole process went rather smoothly. I had my website up and running, and I changed my hosting to point to the right place. My website appeared, and the DNS checks on GitHub’s side all passed. I had my website on the custom URL and enforced HTTPS.</p>
</section>
<section id="the-problem" class="level2">
<h2 class="anchored" data-anchor-id="the-problem">The Problem</h2>
<p>Whenever I made an update to my website, however, my URL broke. The GitHub Pages page (github.io/jbwhit/…) worked, but the custom URL (jonathanwhitmore.com) no longer pointed to the right spot.</p>
</section>
<section id="the-start-of-a-solution" class="level2">
<h2 class="anchored" data-anchor-id="the-start-of-a-solution">The Start of a Solution</h2>
<p>When I first added my Custom Domain, GitHub helpfully created a CNAME (Canonical Name) file in the top-level directory of the repo on the <code>gh-pages</code> branch (if that’s what you’re using, and I was).</p>
<div class="quarto-figure quarto-figure-center">
<figure class="figure">
<p><img src="https://jonathanwhitmore.com/posts/2024-07-11-cname-fix/githubsettings.png" class="img-fluid figure-img"></p>
<figcaption>CNAME file in GitHub</figcaption>
</figure>
</div>
</section>
<section id="the-fix" class="level2">
<h2 class="anchored" data-anchor-id="the-fix">The Fix</h2>
<p>Simply move the CNAME file from the top level directory and place it in the <code>nbs</code> directory, and then run <code>nbdev_prepare</code> and update as usual. I found that this completely solved the problem that occurred every single time I pushed a commit to GitHub.</p>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="annotated-cell-1" style="background: #f1f3f5;"><pre class="sourceCode bash code-annotation-code code-with-copy code-annotated"><code class="sourceCode bash"><span id="annotated-cell-1-1"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Directory structure of the GitHub website repo when using nbdev</span></span>
<button class="code-annotation-anchor" data-target-cell="annotated-cell-1" data-target-annotation="1">1</button><span id="annotated-cell-1-2" class="code-annotation-target"><span class="ex" style="color: null;
background-color: null;
font-style: inherit;">├──</span> ❌ CNAME</span>
<button class="code-annotation-anchor" data-target-cell="annotated-cell-1" data-target-annotation="2">2</button><span id="annotated-cell-1-3" class="code-annotation-target"><span class="ex" style="color: null;
background-color: null;
font-style: inherit;">├──</span> nbs</span>
<span id="annotated-cell-1-4"><span class="ex" style="color: null;
background-color: null;
font-style: inherit;">│</span>  ├── _quarto.yml</span>
<button class="code-annotation-anchor" data-target-cell="annotated-cell-1" data-target-annotation="3">3</button><span id="annotated-cell-1-5" class="code-annotation-target"><span class="ex" style="color: null;
background-color: null;
font-style: inherit;">│</span>  ├── ✅ CNAME</span>
<span id="annotated-cell-1-6"><span class="ex" style="color: null;
background-color: null;
font-style: inherit;">│</span>  ├── sidebar.yml</span>
<span id="annotated-cell-1-7"><span class="ex" style="color: null;
background-color: null;
font-style: inherit;">│</span>  └── styles.css</span>
<span id="annotated-cell-1-8"><span class="ex" style="color: null;
background-color: null;
font-style: inherit;">├──</span> README.md</span>
<span id="annotated-cell-1-9"><span class="ex" style="color: null;
background-color: null;
font-style: inherit;">├──</span> settings.ini</span>
<span id="annotated-cell-1-10"><span class="ex" style="color: null;
background-color: null;
font-style: inherit;">├──</span> setup.py</span><div class="code-annotation-gutter-bg"></div><div class="code-annotation-gutter"></div></code></pre></div></div>
<dl class="code-annotation-container-hidden code-annotation-container-grid">
<dt data-target-cell="annotated-cell-1" data-target-annotation="1">1</dt>
<dd>
<span data-code-cell="annotated-cell-1" data-code-lines="2" data-code-annotation="1">❌ This CNAME file is created by GitHub and placed in the root directory of your git repo (one level above the <code>nbs</code> directory that nbdev uses). The red X indicates this is not the correct location.</span>
</dd>
<dt data-target-cell="annotated-cell-1" data-target-annotation="2">2</dt>
<dd>
<span data-code-cell="annotated-cell-1" data-code-lines="3" data-code-annotation="2">nbdev uses the <code>nbs</code> directory as the top-level of the website repo (this differs from what GitHub expects).</span>
</dd>
<dt data-target-cell="annotated-cell-1" data-target-annotation="3">3</dt>
<dd>
<span data-code-cell="annotated-cell-1" data-code-lines="5" data-code-annotation="3">✅ The correct place to put the CNAME file: under the <code>nbs</code> directory. The green checkmark indicates this is the proper location.</span>
</dd>
</dl>
</section>
<section id="the-why" class="level2">
<h2 class="anchored" data-anchor-id="the-why">The Why</h2>
<p>Long story short: GitHub assumes that the git repository that you are turning into a website is using the top level directory as the directory for the website, and suggests the CNAME to be in the top level directory for that reason.</p>
<p>In contrast, Nbdev uses the <code>nbs</code> directory as the top-level of the website repo. This is why the fix is very simple – move the CNAME to the top-level directory of the website, which for nbdev projects is the <code>nbs</code> directory.</p>
</section>
<section id="resources" class="level2">
<h2 class="anchored" data-anchor-id="resources">Resources</h2>
<ul>
<li><a href="https://github.com/fastai/nbdev/issues/1033">Nbdev issue: push to main branch removes custom domain from GitHub Pages settings</a></li>
<li><a href="https://docs.github.com/en/pages/configuring-a-custom-domain-for-your-github-pages-site">Configuring a custom domain for your GitHub Pages site</a></li>
<li><a href="https://nbdev.fast.ai/">Nbdev Documentation</a></li>
<li><a href="https://quarto.org/docs/websites/">Quarto Documentation</a></li>
<li><a href="https://en.wikipedia.org/wiki/CNAME_record">Understanding CNAME records</a></li>
</ul>


</section>
</section>

 ]]></description>
  <category>quarto</category>
  <category>nbdev</category>
  <category>GitHub</category>
  <guid>https://jonathanwhitmore.com/posts/2024-07-11-cname-fix/</guid>
  <pubDate>Thu, 11 Jul 2024 00:00:00 GMT</pubDate>
</item>
<item>
  <title>Talent vs Luck: A Critical Response</title>
  <dc:creator>Jonathan Whitmore</dc:creator>
  <link>https://jonathanwhitmore.com/posts/2018-03-12-talent-vs-luck/</link>
  <description><![CDATA[ 





<p>The paper “Talent vs Luck: the role of randomness in success and failure” (<a href="https://www.worldscientific.com/doi/abs/10.1142/S0219525918500145">journal</a>, <a href="https://arxiv.org/abs/1802.07068">arXiv</a>) by Pluchino, Biondo, and Rapisarda was covered in <a href="https://www.technologyreview.com/s/610395/if-youre-so-smart-why-arent-you-rich-turns-out-its-just-chance/">MIT Technology Review</a> and <a href="https://www.scientificamerican.com/article/why-success-is-based-on-more-than-talent-and-work/">Scientific American</a>, and later won the <a href="https://improbable.com/ig/winners/#ig2022">2022 Ig Nobel Prize in Economics</a>. The authors build a simulation — the Talent vs Luck model (TvL) — and conclude:</p>
<blockquote class="blockquote">
<p>We can conclude that, if there is not an exceptional talent behind the enormous success of some people, another factor is probably at work. Our simulation clearly shows that such a factor is just pure luck. — Pluchino, Biondo, Rapisarda</p>
</blockquote>
<p>We argue this conclusion is <strong>baked into the structure of the model from the start</strong>.</p>
<p>In the TvL model a person in the 95th percentile of talent has roughly a 6.1% chance of doubling their capital each timestep; a person in the 5th percentile has 3.4%. The difference between extreme outliers is only <strong>~2.6 percentage points per timestep</strong>. Starting from such a small difference between talent levels essentially guarantees the conclusion before the simulation even runs.</p>
<p>What makes the model’s outcome inevitable is its multiplicative structure. While the <em>average</em> capital grows slightly for talented people, the geometric-mean growth rate — which governs typical long-run paths — is negative for everyone with talent below 1. A few lucky individuals capture enormous gains, pulling the arithmetic mean up, while for realistic talent levels in this model, most people lose capital. This asymmetry is baked into the model by construction: talent can help you capitalize on lucky events, but it offers zero protection against unlucky ones.</p>
<section id="the-tvl-model" class="level2">
<h2 class="anchored" data-anchor-id="the-tvl-model">The TvL Model</h2>
<p>A high-level description of the model from the paper:</p>
<ul>
<li><img src="https://latex.codecogs.com/png.latex?N"> people are placed uniformly at random in a square environment and stay fixed.</li>
<li><img src="https://latex.codecogs.com/png.latex?N"> events are also placed uniformly at random, each classified as Lucky or Unlucky (50/50).</li>
<li>The events randomly walk the environment each timestep.</li>
<li>At each timestep, capital is updated:
<ul>
<li><strong>No overlap with an event:</strong> capital unchanged.</li>
<li><strong>Overlap with an Unlucky event:</strong> capital halved.</li>
<li><strong>Overlap with a Lucky event:</strong> if a uniform random draw <img src="https://latex.codecogs.com/png.latex?u%20%5Cin%20%5B0,1)"> is less than the person’s talent score, capital doubles; otherwise unchanged.</li>
</ul></li>
</ul>
<p>Talent is drawn from <img src="https://latex.codecogs.com/png.latex?%5Cmathcal%7BN%7D(0.6,%5C%200.1%5E2)">, truncated to <img src="https://latex.codecogs.com/png.latex?%5B0,1%5D">. Everyone starts with 10 units of capital and the simulation runs for 80 timesteps.</p>
<p>The one parameter the paper does not give explicitly is <img src="https://latex.codecogs.com/png.latex?p_%5Ctext%7Bevent%7D"> — the probability that a given person overlaps an event at a given timestep. We estimate it in the appendix; our best estimate is <strong>0.16</strong>.</p>
</section>
<section id="setup" class="level2">
<h2 class="anchored" data-anchor-id="setup">Setup</h2>
<div id="setup" class="cell" data-execution_count="1">
<details class="code-fold">
<summary>Imports and parameters</summary>
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb1" style="background: #f1f3f5;"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb1-1"><span class="im" style="color: #00769E;
background-color: null;
font-style: inherit;">import</span> numpy <span class="im" style="color: #00769E;
background-color: null;
font-style: inherit;">as</span> np</span>
<span id="cb1-2"><span class="im" style="color: #00769E;
background-color: null;
font-style: inherit;">import</span> matplotlib.pyplot <span class="im" style="color: #00769E;
background-color: null;
font-style: inherit;">as</span> plt</span>
<span id="cb1-3"><span class="im" style="color: #00769E;
background-color: null;
font-style: inherit;">import</span> scipy.stats <span class="im" style="color: #00769E;
background-color: null;
font-style: inherit;">as</span> ss</span>
<span id="cb1-4"></span>
<span id="cb1-5">rng <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> np.random.default_rng(seed<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">20180312</span>)</span>
<span id="cb1-6"></span>
<span id="cb1-7"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Paper's parameters</span></span>
<span id="cb1-8">N_PEOPLE <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1000</span></span>
<span id="cb1-9">N_TIMESTEPS <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">80</span></span>
<span id="cb1-10">STARTING_CAPITAL <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">10.0</span></span>
<span id="cb1-11">TALENT_MEAN <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.6</span></span>
<span id="cb1-12">TALENT_SD <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.1</span></span>
<span id="cb1-13">P_LUCKY <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.5</span></span>
<span id="cb1-14"></span>
<span id="cb1-15"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Our estimate of p_event (derived in appendix)</span></span>
<span id="cb1-16">P_EVENT <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.16</span></span></code></pre></div></div>
</details>
</div>
</section>
<section id="simulating-the-tvl-model" class="level2">
<h2 class="anchored" data-anchor-id="simulating-the-tvl-model">Simulating the TvL model</h2>
<div id="simulation" class="cell" data-execution_count="2">
<details class="code-fold">
<summary>Vectorized TvL simulation</summary>
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb2" style="background: #f1f3f5;"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb2-1"><span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">def</span> run_tvl_simulation(n_people<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span>N_PEOPLE, n_timesteps<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span>N_TIMESTEPS,</span>
<span id="cb2-2">                       starting_capital<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span>STARTING_CAPITAL,</span>
<span id="cb2-3">                       talent_mean<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span>TALENT_MEAN, talent_sd<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span>TALENT_SD,</span>
<span id="cb2-4">                       p_event<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span>P_EVENT, p_lucky<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span>P_LUCKY, rng<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span>rng):</span>
<span id="cb2-5">    <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">"""Run the TvL simulation; returns (talent array, final_capital array)."""</span></span>
<span id="cb2-6">    talent <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> np.clip(rng.normal(talent_mean, talent_sd, n_people), <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span>, <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>)</span>
<span id="cb2-7"></span>
<span id="cb2-8">    <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Pre-draw all random numbers: shape (n_people, n_timesteps)</span></span>
<span id="cb2-9">    event_roll   <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> rng.random((n_people, n_timesteps))</span>
<span id="cb2-10">    lucky_roll   <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> rng.random((n_people, n_timesteps))</span>
<span id="cb2-11">    capital_roll <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> rng.random((n_people, n_timesteps))</span>
<span id="cb2-12"></span>
<span id="cb2-13">    event_happens <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> event_roll <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;</span> p_event</span>
<span id="cb2-14">    is_lucky      <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> lucky_roll <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;</span> p_lucky</span>
<span id="cb2-15">    capitalizes   <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> capital_roll <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;</span> talent[:, np.newaxis]</span>
<span id="cb2-16"></span>
<span id="cb2-17">    <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># multiplier per (person, timestep)</span></span>
<span id="cb2-18">    multiplier <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> np.where(</span>
<span id="cb2-19">        event_happens <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&amp;</span> is_lucky <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&amp;</span> capitalizes, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">2.0</span>,</span>
<span id="cb2-20">        np.where(event_happens <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&amp;</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">~</span>is_lucky, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.5</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1.0</span>)</span>
<span id="cb2-21">    )</span>
<span id="cb2-22"></span>
<span id="cb2-23">    final_capital <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> starting_capital <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span> multiplier.prod(axis<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>)</span>
<span id="cb2-24">    <span class="cf" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">return</span> talent, final_capital</span>
<span id="cb2-25"></span>
<span id="cb2-26">talent, final_capital <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> run_tvl_simulation()</span>
<span id="cb2-27"><span class="bu" style="color: null;
background-color: null;
font-style: inherit;">print</span>(<span class="ss" style="color: #20794D;
background-color: null;
font-style: inherit;">f"Median final capital:  </span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">{</span>np<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">.</span>median(final_capital)<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">:.3f}</span><span class="ss" style="color: #20794D;
background-color: null;
font-style: inherit;">"</span>)</span>
<span id="cb2-28"><span class="bu" style="color: null;
background-color: null;
font-style: inherit;">print</span>(<span class="ss" style="color: #20794D;
background-color: null;
font-style: inherit;">f"Mean final capital:    </span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">{</span>np<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">.</span>mean(final_capital)<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">:.3f}</span><span class="ss" style="color: #20794D;
background-color: null;
font-style: inherit;">"</span>)</span>
<span id="cb2-29"><span class="bu" style="color: null;
background-color: null;
font-style: inherit;">print</span>(<span class="ss" style="color: #20794D;
background-color: null;
font-style: inherit;">f"Max final capital:     </span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">{</span>np<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">.</span><span class="bu" style="color: null;
background-color: null;
font-style: inherit;">max</span>(final_capital)<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">:.1f}</span><span class="ss" style="color: #20794D;
background-color: null;
font-style: inherit;">"</span>)</span>
<span id="cb2-30"><span class="bu" style="color: null;
background-color: null;
font-style: inherit;">print</span>(<span class="ss" style="color: #20794D;
background-color: null;
font-style: inherit;">f"Fraction who grew:     </span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">{</span>(final_capital <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&gt;</span> STARTING_CAPITAL)<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">.</span>mean()<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">:.1%}</span><span class="ss" style="color: #20794D;
background-color: null;
font-style: inherit;">"</span>)</span></code></pre></div></div>
</details>
<div class="cell-output cell-output-stdout">
<pre><code>Median final capital:  1.250
Mean final capital:    26.164
Max final capital:     5120.0
Fraction who grew:     17.4%</code></pre>
</div>
</div>
</section>
<section id="what-does-talent-actually-do" class="level2">
<h2 class="anchored" data-anchor-id="what-does-talent-actually-do">What Does Talent Actually Do?</h2>
<p>Because the probability of each outcome is determined analytically (not just by simulation), we can compute it directly for any talent quantile.</p>
<div id="tvl-probabilities" class="cell" data-execution_count="3">
<details class="code-fold">
<summary>Analytical per-timestep probabilities</summary>
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb4" style="background: #f1f3f5;"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb4-1"><span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">def</span> tvl_probabilities(quantile, talent_mean<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span>TALENT_MEAN, talent_sd<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span>TALENT_SD,</span>
<span id="cb4-2">                      p_event<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span>P_EVENT, p_lucky<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span>P_LUCKY):</span>
<span id="cb4-3">    <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">"""Return (p_halve, p_same, p_double) for a person at a given talent quantile."""</span></span>
<span id="cb4-4">    p_halve  <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> p_event <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span> (<span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1.0</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span> p_lucky)</span>
<span id="cb4-5">    talent   <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> np.clip(ss.norm.ppf(quantile, loc<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span>talent_mean, scale<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span>talent_sd), <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span>, <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>)</span>
<span id="cb4-6">    p_double <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> p_event <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span> p_lucky <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span> talent</span>
<span id="cb4-7">    p_same   <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1.0</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span> p_halve <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span> p_double</span>
<span id="cb4-8">    <span class="cf" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">return</span> p_halve, p_same, p_double</span>
<span id="cb4-9"></span>
<span id="cb4-10"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Compare extremes</span></span>
<span id="cb4-11"><span class="cf" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">for</span> q, label <span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">in</span> [(<span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.05</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"5th percentile"</span>), (<span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.50</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"50th percentile"</span>), (<span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.95</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"95th percentile"</span>)]:</span>
<span id="cb4-12">    ph, ps, pd <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> tvl_probabilities(q)</span>
<span id="cb4-13">    <span class="bu" style="color: null;
background-color: null;
font-style: inherit;">print</span>(<span class="ss" style="color: #20794D;
background-color: null;
font-style: inherit;">f"</span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">{</span>label<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">:20s}</span><span class="ss" style="color: #20794D;
background-color: null;
font-style: inherit;">  p_double=</span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">{</span>pd<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">:.4f}</span><span class="ss" style="color: #20794D;
background-color: null;
font-style: inherit;">  p_same=</span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">{</span>ps<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">:.4f}</span><span class="ss" style="color: #20794D;
background-color: null;
font-style: inherit;">  p_halve=</span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">{</span>ph<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">:.4f}</span><span class="ss" style="color: #20794D;
background-color: null;
font-style: inherit;">"</span>)</span>
<span id="cb4-14"></span>
<span id="cb4-15">ph_95, _, pd_95 <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> tvl_probabilities(<span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.95</span>)</span>
<span id="cb4-16">ph_05, _, pd_05 <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> tvl_probabilities(<span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.05</span>)</span>
<span id="cb4-17"><span class="bu" style="color: null;
background-color: null;
font-style: inherit;">print</span>(<span class="ss" style="color: #20794D;
background-color: null;
font-style: inherit;">f"</span><span class="ch" style="color: #20794D;
background-color: null;
font-style: inherit;">\n</span><span class="ss" style="color: #20794D;
background-color: null;
font-style: inherit;">Difference in p_double (95th − 5th): </span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">{</span>pd_95 <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span> pd_05<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">:.4f}</span><span class="ss" style="color: #20794D;
background-color: null;
font-style: inherit;">  (</span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">{</span>(pd_95 <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span> pd_05)<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span><span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">100</span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">:.2f}</span><span class="ss" style="color: #20794D;
background-color: null;
font-style: inherit;"> pp)"</span>)</span></code></pre></div></div>
</details>
<div class="cell-output cell-output-stdout">
<pre><code>5th percentile        p_double=0.0348  p_same=0.8852  p_halve=0.0800
50th percentile       p_double=0.0480  p_same=0.8720  p_halve=0.0800
95th percentile       p_double=0.0612  p_same=0.8588  p_halve=0.0800

Difference in p_double (95th − 5th): 0.0263  (2.63 pp)</code></pre>
</div>
</div>
<p>The difference in the probability of doubling between the 95th and 5th percentile is only <strong>~2.6 percentage points</strong>. The probability of <em>halving</em> is identical for everyone — talent offers no protection from bad luck at all.</p>
<div id="cell-fig-probability-bands" class="cell" data-execution_count="4">
<details class="code-fold">
<summary>Code</summary>
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb6" style="background: #f1f3f5;"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb6-1">quantiles <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> np.linspace(<span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.001</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.999</span>, <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">300</span>)</span>
<span id="cb6-2">probs <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> np.array([tvl_probabilities(q) <span class="cf" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">for</span> q <span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">in</span> quantiles])</span>
<span id="cb6-3">p_halve, p_same, p_double <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> probs[:, <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span>], probs[:, <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>], probs[:, <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span>]</span>
<span id="cb6-4"></span>
<span id="cb6-5">fig, ax <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> plt.subplots(figsize<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span>(<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">7</span>, <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">3</span>))</span>
<span id="cb6-6">ax.fill_between(quantiles, p_halve <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> p_same, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1.0</span>,   color<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"#076678"</span>, alpha<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.8</span>, label<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Doubles"</span>)</span>
<span id="cb6-7">ax.fill_between(quantiles, p_halve,           p_halve <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> p_same, color<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"#a89984"</span>, alpha<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.35</span>, label<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Stays the same"</span>)</span>
<span id="cb6-8">ax.fill_between(quantiles, <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span>,                 p_halve,          color<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"#cc241d"</span>, alpha<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.8</span>, label<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Halves"</span>)</span>
<span id="cb6-9"></span>
<span id="cb6-10"><span class="cf" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">for</span> q <span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">in</span> (<span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.05</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.95</span>):</span>
<span id="cb6-11">    ax.axvline(q, color<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"black"</span>, lw<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1.0</span>, ls<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"--"</span>, alpha<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.6</span>)</span>
<span id="cb6-12"></span>
<span id="cb6-13">ax.set_xlim(<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span>, <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>)</span>
<span id="cb6-14">ax.set_ylim(<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span>, <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>)</span>
<span id="cb6-15">ax.set_xlabel(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Talent quantile"</span>)</span>
<span id="cb6-16">ax.set_ylabel(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Probability per timestep"</span>)</span>
<span id="cb6-17">ax.legend(loc<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"center"</span>, framealpha<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.9</span>)</span>
<span id="cb6-18">plt.tight_layout()</span>
<span id="cb6-19">plt.show()</span></code></pre></div></div>
</details>
<div class="cell-output cell-output-display">
<div id="fig-probability-bands" class="quarto-float quarto-figure quarto-figure-center anchored">
<figure class="quarto-float quarto-float-fig figure">
<div aria-describedby="fig-probability-bands-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
<img src="https://jonathanwhitmore.com/posts/2018-03-12-talent-vs-luck/index_files/figure-html/fig-probability-bands-output-1.png" width="662" height="278" class="figure-img">
</div>
<figcaption class="quarto-float-caption-bottom quarto-float-caption quarto-float-fig" id="fig-probability-bands-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
Figure&nbsp;1: Per-timestep outcome probabilities across all talent quantiles. The 5th and 95th percentiles are marked. The tiny difference in the blue ‘doubles’ band is the entire effect of talent in this model.
</figcaption>
</figure>
</div>
</div>
</div>
</section>
<section id="mean-vs-geometric-mean-the-multiplicative-trap" class="level2">
<h2 class="anchored" data-anchor-id="mean-vs-geometric-mean-the-multiplicative-trap">Mean vs Geometric Mean: The Multiplicative Trap</h2>
<p>Because we have analytical probabilities, we can compute both the expected (mean) final capital and the geometric-mean growth rate for any talent quantile. No simulation needed.</p>
<p>The expected value of each timestep multiplier is <img src="https://latex.codecogs.com/png.latex?E%5Bm%5D%20=%202%20p_%5Ctext%7Bdouble%7D%20+%201%20%5Ccdot%20p_%5Ctext%7Bsame%7D%20+%200.5%20%5Ccdot%20p_%5Ctext%7Bhalve%7D">, which is above 1 for talent &gt; 0.5. But capital is a <em>multiplicative</em> process — the long-run growth rate is governed by the <em>geometric</em> mean of the per-step multiplier: <img src="https://latex.codecogs.com/png.latex?%5Cexp(p_%5Ctext%7Bdouble%7D%20%5Cln%202%20+%20p_%5Ctext%7Bhalve%7D%20%5Cln%200.5)">. This geometric mean is below 1 for all talent &lt; 1, meaning capital shrinks on a typical path even though the arithmetic mean grows.</p>
<div id="mean-vs-median" class="cell" data-execution_count="5">
<details class="code-fold">
<summary>Mean and geometric-mean capital calculations</summary>
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb7" style="background: #f1f3f5;"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb7-1"><span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">def</span> expected_value(quantile, starting_capital<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span>STARTING_CAPITAL, n_timesteps<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span>N_TIMESTEPS):</span>
<span id="cb7-2">    p_halve, p_same, p_double <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> tvl_probabilities(quantile)</span>
<span id="cb7-3">    per_step_ev_multiplier <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> p_double <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">2.0</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> p_same <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1.0</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> p_halve <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.5</span></span>
<span id="cb7-4">    <span class="cf" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">return</span> starting_capital <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span> per_step_ev_multiplier <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">**</span> n_timesteps</span>
<span id="cb7-5"></span>
<span id="cb7-6"><span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">def</span> geometric_mean_value(quantile, starting_capital<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span>STARTING_CAPITAL, n_timesteps<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span>N_TIMESTEPS):</span>
<span id="cb7-7">    <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">"""Capital implied by the geometric-mean growth rate (typical-path estimate)."""</span></span>
<span id="cb7-8">    p_halve, p_same, p_double <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> tvl_probabilities(quantile)</span>
<span id="cb7-9">    geo_multiplier <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> np.exp(p_double <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span> np.log(<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span>) <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> p_halve <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span> np.log(<span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.5</span>))</span>
<span id="cb7-10">    <span class="cf" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">return</span> starting_capital <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span> geo_multiplier <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">**</span> n_timesteps</span>
<span id="cb7-11"></span>
<span id="cb7-12"><span class="cf" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">for</span> q, label <span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">in</span> [(<span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.5</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"50th"</span>), (<span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.95</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"95th"</span>), (<span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.999</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"99.9th"</span>), (<span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.99999</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"99.999th"</span>)]:</span>
<span id="cb7-13">    ev <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> expected_value(q)</span>
<span id="cb7-14">    gm <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> geometric_mean_value(q)</span>
<span id="cb7-15">    <span class="bu" style="color: null;
background-color: null;
font-style: inherit;">print</span>(<span class="ss" style="color: #20794D;
background-color: null;
font-style: inherit;">f"</span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">{</span>label<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">:10s}</span><span class="ss" style="color: #20794D;
background-color: null;
font-style: inherit;"> percentile → mean: </span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">{</span>ev<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">:8.2f}</span><span class="ss" style="color: #20794D;
background-color: null;
font-style: inherit;">   geo-mean path: </span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">{</span>gm<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">:7.4f}</span><span class="ss" style="color: #20794D;
background-color: null;
font-style: inherit;">  (started at </span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">{</span>STARTING_CAPITAL<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">}</span><span class="ss" style="color: #20794D;
background-color: null;
font-style: inherit;">)"</span>)</span></code></pre></div></div>
</details>
<div class="cell-output cell-output-stdout">
<pre><code>50th       percentile → mean:    18.92   geo-mean path:  1.6958  (started at 10.0)
95th       percentile → mean:    53.39   geo-mean path:  3.5177  (started at 10.0)
99.9th     percentile → mean:   131.42   geo-mean path:  6.6792  (started at 10.0)
99.999th   percentile → mean:   230.50   geo-mean path: 10.0000  (started at 10.0)</code></pre>
</div>
</div>
<p>The mean and the geometric-mean path tell completely different stories. The mean grows — a 95th-percentile person has an expected final capital over 50. But the geometric-mean path shrinks for every talent level below perfect: a 95th-percentile person’s typical-path capital is about 3.5, down from 10. Only someone with literally perfect talent (<img src="https://latex.codecogs.com/png.latex?T%20=%201">) has a non-shrinking geometric mean.</p>
<p>This is the signature of a multiplicative process. A few people get lucky runs — several doublings without any halvings — and their enormous gains pull the arithmetic mean far above what most people actually experience. The mean is dominated by rare winners; the geometric mean reflects typical long-run growth.</p>
<p>A caveat: over a finite horizon like 80 steps, variance is high enough that extremely talented individuals still have a meaningful chance of coming out ahead. The geometric mean governs the long-run typical path, but at 80 steps we’re not yet in the long run — the distribution of outcomes is wide, and luck can easily overcome the downward drift for any individual. This doesn’t rescue the model’s claim, though: it just means that <em>which</em> talented people succeed is still driven by luck.</p>
<div id="cell-fig-mean-vs-median" class="cell" data-execution_count="6">
<details class="code-fold">
<summary>Code</summary>
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb9" style="background: #f1f3f5;"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb9-1">quantiles <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> np.linspace(<span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.001</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.999</span>, <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">300</span>)</span>
<span id="cb9-2"></span>
<span id="cb9-3">fig, ax <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> plt.subplots(figsize<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span>(<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">7</span>, <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">5</span>))</span>
<span id="cb9-4">evs <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> [expected_value(q) <span class="cf" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">for</span> q <span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">in</span> quantiles]</span>
<span id="cb9-5">gms <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> [geometric_mean_value(q) <span class="cf" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">for</span> q <span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">in</span> quantiles]</span>
<span id="cb9-6">ax.plot(quantiles, evs, ls<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"--"</span>, lw<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span>, color<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"#076678"</span>, label<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Mean (expected value)"</span>)</span>
<span id="cb9-7">ax.plot(quantiles, gms, ls<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"-"</span>, lw<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span>, color<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"#cc241d"</span>, label<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Geometric-mean path"</span>)</span>
<span id="cb9-8">ax.axhline(STARTING_CAPITAL, color<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"black"</span>, lw<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.8</span>, ls<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">":"</span>, alpha<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.5</span>, label<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Starting capital"</span>)</span>
<span id="cb9-9"></span>
<span id="cb9-10"><span class="cf" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">for</span> q <span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">in</span> (<span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.05</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.95</span>):</span>
<span id="cb9-11">    ax.axvline(q, color<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"black"</span>, lw<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.8</span>, ls<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"--"</span>, alpha<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.4</span>)</span>
<span id="cb9-12"></span>
<span id="cb9-13">ax.set_xlim(<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span>, <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>)</span>
<span id="cb9-14">ax.set_xlabel(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Talent quantile"</span>)</span>
<span id="cb9-15">ax.set_ylabel(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Final capital after 80 timesteps"</span>)</span>
<span id="cb9-16">ax.set_yscale(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"log"</span>)</span>
<span id="cb9-17">ax.legend()</span>
<span id="cb9-18">plt.tight_layout()</span>
<span id="cb9-19">plt.show()</span></code></pre></div></div>
</details>
<div class="cell-output cell-output-display">
<div id="fig-mean-vs-median" class="quarto-float quarto-figure quarto-figure-center anchored">
<figure class="quarto-float quarto-float-fig figure">
<div aria-describedby="fig-mean-vs-median-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
<img src="https://jonathanwhitmore.com/posts/2018-03-12-talent-vs-luck/index_files/figure-html/fig-mean-vs-median-output-1.png" width="661" height="470" class="figure-img">
</div>
<figcaption class="quarto-float-caption-bottom quarto-float-caption quarto-float-fig" id="fig-mean-vs-median-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
Figure&nbsp;2: Mean (dashed) vs geometric-mean path (solid) after 80 timesteps. The arithmetic mean grows with talent, but the geometric-mean path — reflecting typical long-run growth — stays well below starting capital for all realistic talent levels. Only perfect talent (T = 1) breaks even.
</figcaption>
</figure>
</div>
</div>
</div>
</section>
<section id="concluding-thoughts" class="level2">
<h2 class="anchored" data-anchor-id="concluding-thoughts">Concluding Thoughts</h2>
<p>The TvL paper’s conclusion — that luck dominates talent — is essentially a restatement of its inputs. Two design choices do most of the work:</p>
<ol type="1">
<li><p><strong>Tiny talent bandwidth.</strong> The difference in doubling probability between the 5th and 95th percentile of talent is only ~2.6 percentage points. With such narrow dynamic range, talent can barely move the needle.</p></li>
<li><p><strong>Asymmetric multipliers.</strong> Unlucky events halve your capital regardless of talent, but lucky events only help if you’re talented enough to capitalize. In a multiplicative process, this asymmetry means the <em>typical</em> person loses capital over time even though the <em>average</em> grows — the gains are concentrated in a lucky few.</p></li>
</ol>
<p>These are modeling choices, not discoveries about the world. The simulation doesn’t <em>demonstrate</em> that luck dominates talent — it <em>assumes</em> a structure where that outcome is nearly inevitable. This is not to say luck is unimportant in real life; it may well dominate. But this particular model can’t tell us that.</p>
</section>
<section id="further-reading" class="level2">
<h2 class="anchored" data-anchor-id="further-reading">Further Reading</h2>
<ul>
<li><a href="https://archeothoughts.wordpress.com/2019/09/03/luck-is-very-important-but-just-how-insignificant-is-talent-a-comment-on-pluchino-et-al-2018/">ArcheoThoughts: “Luck is very important, but just how insignificant is talent?”</a> — another critique identifying the downward pressure on capital in the TvL model.</li>
<li><a href="https://ergodicityeconomics.com/">Ergodicity Economics</a> by Ole Peters — the formal mathematical framework for why geometric means diverge from arithmetic means in multiplicative processes.</li>
<li><a href="https://en.wikipedia.org/wiki/Kelly_criterion">The Kelly Criterion</a> — the classic solution for maximizing geometric growth under uncertainty.</li>
<li><em>The Success Equation</em> by Michael Mauboussin — on how luck becomes dominant when skill levels converge (“the Paradox of Skill”).</li>
<li><a href="https://www.navalmanack.com/almanack-of-naval-ravikant/how-to-get-lucky">Naval Ravikant on the four kinds of luck</a> — challenges the assumption that luck is purely external by explaining how talent and agency can increase the <em>frequency</em> of lucky events.</li>
</ul>
</section>
<section id="appendix-estimating-p_event" class="level2">
<h2 class="anchored" data-anchor-id="appendix-estimating-p_event">Appendix: Estimating <code>p_event</code></h2>
<p>The paper does not state <img src="https://latex.codecogs.com/png.latex?p_%5Ctext%7Bevent%7D"> directly. We infer it by finding values that reproduce the maximum number of unlucky events seen in the paper’s Figure 5b (approximately 15 events across 1,000 people). The plot below sweeps <code>p_event</code> over 50 simulation trials; our best estimate of <strong>0.16</strong> sits in the center of the plausible range.</p>
<div id="cell-fig-p-event" class="cell" data-execution_count="7">
<details class="code-fold">
<summary>Estimating p_event from paper Figure 5b</summary>
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb10" style="background: #f1f3f5;"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb10-1">p_event_low      <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.11</span></span>
<span id="cb10-2">p_event_estimate <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.16</span></span>
<span id="cb10-3">p_event_high     <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.21</span></span>
<span id="cb10-4"></span>
<span id="cb10-5">p_events <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> np.linspace(<span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.0</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.5</span>, <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">250</span>)</span>
<span id="cb10-6">trial_rng <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> np.random.default_rng(seed<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">42</span>)</span>
<span id="cb10-7"></span>
<span id="cb10-8">fig, ax <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> plt.subplots(figsize<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span>(<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">7</span>, <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">4</span>))</span>
<span id="cb10-9"><span class="cf" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">for</span> trial <span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">in</span> <span class="bu" style="color: null;
background-color: null;
font-style: inherit;">range</span>(<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">50</span>):</span>
<span id="cb10-10">    max_unlucky <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> []</span>
<span id="cb10-11">    <span class="cf" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">for</span> pe <span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">in</span> p_events:</span>
<span id="cb10-12">        n_events <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> (trial_rng.random((N_PEOPLE, N_TIMESTEPS)) <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;</span> pe).<span class="bu" style="color: null;
background-color: null;
font-style: inherit;">sum</span>(axis<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>)</span>
<span id="cb10-13">        n_lucky  <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> np.array([trial_rng.binomial(n, P_LUCKY) <span class="cf" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">for</span> n <span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">in</span> n_events])</span>
<span id="cb10-14">        max_unlucky.append((n_events <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span> n_lucky).<span class="bu" style="color: null;
background-color: null;
font-style: inherit;">max</span>())</span>
<span id="cb10-15">    ax.plot(p_events, max_unlucky, lw<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.4</span>, color<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"#076678"</span>, alpha<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.5</span>)</span>
<span id="cb10-16"></span>
<span id="cb10-17">ax.axhline(<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">15</span>, color<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"#cc241d"</span>, lw<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span>, label<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Observed max unlucky events (paper Fig. 5b)"</span>)</span>
<span id="cb10-18">ax.axvline(p_event_low,      color<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"black"</span>, lw<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1.5</span>, ls<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">":"</span>,  label<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Our estimated range"</span>)</span>
<span id="cb10-19">ax.axvline(p_event_high,     color<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"black"</span>, lw<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1.5</span>, ls<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">":"</span>)</span>
<span id="cb10-20">ax.axvline(p_event_estimate, color<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"black"</span>, lw<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">2.0</span>, ls<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"--"</span>, label<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Best estimate (0.16)"</span>)</span>
<span id="cb10-21">ax.set_xlim(<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.5</span>)</span>
<span id="cb10-22">ax.set_ylim(<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span>, <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">40</span>)</span>
<span id="cb10-23">ax.set_xlabel(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"p_event"</span>)</span>
<span id="cb10-24">ax.set_ylabel(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Max unlucky events across 1,000 people"</span>)</span>
<span id="cb10-25">ax.legend(fontsize<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">9</span>)</span>
<span id="cb10-26">plt.tight_layout()</span>
<span id="cb10-27">plt.show()</span></code></pre></div></div>
</details>
<div class="cell-output cell-output-display">
<div id="fig-p-event" class="quarto-float quarto-figure quarto-figure-center anchored">
<figure class="quarto-float quarto-float-fig figure">
<div aria-describedby="fig-p-event-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
<img src="https://jonathanwhitmore.com/posts/2018-03-12-talent-vs-luck/index_files/figure-html/fig-p-event-output-1.png" width="662" height="374" class="figure-img">
</div>
<figcaption class="quarto-float-caption-bottom quarto-float-caption quarto-float-fig" id="fig-p-event-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
Figure&nbsp;3: Maximum unlucky events per person across 50 simulation trials, for different values of p_event. The paper’s Figure 5b shows a maximum of ~15 unlucky events; our estimate of p_event=0.16 sits in the middle of the plausible range.
</figcaption>
</figure>
</div>
</div>
</div>


</section>

 ]]></description>
  <category>python</category>
  <category>statistics</category>
  <category>simulation</category>
  <category>data-science</category>
  <guid>https://jonathanwhitmore.com/posts/2018-03-12-talent-vs-luck/</guid>
  <pubDate>Mon, 12 Mar 2018 00:00:00 GMT</pubDate>
</item>
<item>
  <title>Monty Hall Monte Carlo — Python</title>
  <dc:creator>Jonathan Whitmore</dc:creator>
  <link>https://jonathanwhitmore.com/posts/2010-11-26-monty-hall-monte-carlo-python/</link>
  <description><![CDATA[ 





<p>In <a href="../2010-11-24-making-money-with-monty-hall/">my previous post</a>, I proposed a bet to a YouTube commenter who insisted the Monty Hall problem is a 50-50 coin flip. He declined to put money on it — so let’s let the computer settle things instead.</p>
<p>Below is a Monte Carlo simulation that plays the bet millions of times. The “stay” player always keeps Door 1; the “switch” player always switches to the remaining closed door after a goat is revealed. The payout terms: the switcher pays $1.08 when staying wins, and the stayer pays $1.00 when switching wins.</p>
<div id="setup" class="cell" data-execution_count="1">
<details class="code-fold">
<summary>Code</summary>
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb1" style="background: #f1f3f5;"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb1-1"><span class="im" style="color: #00769E;
background-color: null;
font-style: inherit;">import</span> numpy <span class="im" style="color: #00769E;
background-color: null;
font-style: inherit;">as</span> np</span>
<span id="cb1-2"><span class="im" style="color: #00769E;
background-color: null;
font-style: inherit;">import</span> matplotlib.pyplot <span class="im" style="color: #00769E;
background-color: null;
font-style: inherit;">as</span> plt</span>
<span id="cb1-3"></span>
<span id="cb1-4">rng <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> np.random.default_rng(seed<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">42</span>)</span></code></pre></div></div>
</details>
</div>
<section id="the-simulation" class="level2">
<h2 class="anchored" data-anchor-id="the-simulation">The simulation</h2>
<div id="simulation" class="cell" data-execution_count="2">
<details class="code-fold">
<summary>Code</summary>
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb2" style="background: #f1f3f5;"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb2-1">ROUNDS <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">10_000_000</span></span>
<span id="cb2-2">SWITCH_BET <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1.08</span>  <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># switcher pays this when staying wins</span></span>
<span id="cb2-3">STAY_BET <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1.00</span>    <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># stayer pays this when switching wins</span></span>
<span id="cb2-4">DOORS <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> np.array([<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>, <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span>, <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">3</span>])</span>
<span id="cb2-5"></span>
<span id="cb2-6">STAY_DOOR <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span></span>
<span id="cb2-7"></span>
<span id="cb2-8"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Randomly place the prize behind a door each round</span></span>
<span id="cb2-9">winning_doors <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> rng.choice(DOORS, size<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span>ROUNDS)</span>
<span id="cb2-10"></span>
<span id="cb2-11"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Staying wins when the prize is behind Door 1</span></span>
<span id="cb2-12">stay_wins <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> winning_doors <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">==</span> STAY_DOOR</span>
<span id="cb2-13"></span>
<span id="cb2-14"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Switching wins whenever staying loses (the revealed door is never the prize)</span></span>
<span id="cb2-15">switch_wins <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">~</span>stay_wins</span>
<span id="cb2-16"></span>
<span id="cb2-17">stay_win_count <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> stay_wins.<span class="bu" style="color: null;
background-color: null;
font-style: inherit;">sum</span>()</span>
<span id="cb2-18">switch_win_count <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> switch_wins.<span class="bu" style="color: null;
background-color: null;
font-style: inherit;">sum</span>()</span>
<span id="cb2-19"></span>
<span id="cb2-20"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Net payouts</span></span>
<span id="cb2-21">switch_net <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> switch_win_count <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span> STAY_BET <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span> stay_win_count <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span> SWITCH_BET</span>
<span id="cb2-22">stay_net <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span>switch_net</span>
<span id="cb2-23"></span>
<span id="cb2-24"><span class="bu" style="color: null;
background-color: null;
font-style: inherit;">print</span>(<span class="ss" style="color: #20794D;
background-color: null;
font-style: inherit;">f"Rounds:              </span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">{</span>ROUNDS<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">:&gt;12,}</span><span class="ss" style="color: #20794D;
background-color: null;
font-style: inherit;">"</span>)</span>
<span id="cb2-25"><span class="bu" style="color: null;
background-color: null;
font-style: inherit;">print</span>(<span class="ss" style="color: #20794D;
background-color: null;
font-style: inherit;">f"Stay wins:           </span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">{</span>stay_win_count<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">:&gt;12,}</span><span class="ss" style="color: #20794D;
background-color: null;
font-style: inherit;">  (</span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">{</span>stay_win_count <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">/</span> ROUNDS<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">:.2%}</span><span class="ss" style="color: #20794D;
background-color: null;
font-style: inherit;">)"</span>)</span>
<span id="cb2-26"><span class="bu" style="color: null;
background-color: null;
font-style: inherit;">print</span>(<span class="ss" style="color: #20794D;
background-color: null;
font-style: inherit;">f"Switch wins:         </span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">{</span>switch_win_count<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">:&gt;12,}</span><span class="ss" style="color: #20794D;
background-color: null;
font-style: inherit;">  (</span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">{</span>switch_win_count <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">/</span> ROUNDS<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">:.2%}</span><span class="ss" style="color: #20794D;
background-color: null;
font-style: inherit;">)"</span>)</span>
<span id="cb2-27"><span class="bu" style="color: null;
background-color: null;
font-style: inherit;">print</span>(<span class="ss" style="color: #20794D;
background-color: null;
font-style: inherit;">f"Stayer nets:         $</span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">{</span>stay_net<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">:&gt;12,.2f}</span><span class="ss" style="color: #20794D;
background-color: null;
font-style: inherit;">"</span>)</span>
<span id="cb2-28"><span class="bu" style="color: null;
background-color: null;
font-style: inherit;">print</span>(<span class="ss" style="color: #20794D;
background-color: null;
font-style: inherit;">f"Switcher nets:       $</span><span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">{</span>switch_net<span class="sc" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">:&gt;12,.2f}</span><span class="ss" style="color: #20794D;
background-color: null;
font-style: inherit;">"</span>)</span></code></pre></div></div>
</details>
<div class="cell-output cell-output-stdout">
<pre><code>Rounds:                10,000,000
Stay wins:              3,333,698  (33.34%)
Switch wins:            6,666,302  (66.66%)
Stayer nets:         $-3,065,908.16
Switcher nets:       $3,065,908.16</code></pre>
</div>
</div>
<p>Switching wins about 2/3 of the time — exactly as the math predicts. Even with the switcher paying an 8% premium on losses, the edge is overwhelming over millions of rounds.</p>
</section>
<section id="convergence-plot" class="level2">
<h2 class="anchored" data-anchor-id="convergence-plot">Convergence plot</h2>
<p>As the number of rounds grows, the win ratios converge to their true probabilities: 1/3 for staying, 2/3 for switching.</p>
<div id="cell-fig-convergence" class="cell" data-execution_count="3">
<details class="code-fold">
<summary>Code</summary>
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb4" style="background: #f1f3f5;"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb4-1">cumulative_stay <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> np.cumsum(stay_wins)</span>
<span id="cb4-2">cumulative_switch <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> np.cumsum(switch_wins)</span>
<span id="cb4-3">rounds <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> np.arange(<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>, ROUNDS <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>)</span>
<span id="cb4-4"></span>
<span id="cb4-5"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Sample points for plotting (log-spaced to keep the plot manageable)</span></span>
<span id="cb4-6">idx <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> np.unique(np.geomspace(<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>, ROUNDS, num<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">2000</span>).astype(<span class="bu" style="color: null;
background-color: null;
font-style: inherit;">int</span>)) <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span></span>
<span id="cb4-7"></span>
<span id="cb4-8">fig, ax <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> plt.subplots(figsize<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span>(<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">9</span>, <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">5</span>))</span>
<span id="cb4-9">ax.semilogx(rounds[idx], cumulative_stay[idx] <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">/</span> rounds[idx], label<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Stay"</span>, color<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"#e74c3c"</span>)</span>
<span id="cb4-10">ax.semilogx(rounds[idx], cumulative_switch[idx] <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">/</span> rounds[idx], label<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Switch"</span>, color<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"#2ecc71"</span>)</span>
<span id="cb4-11">ax.axhline(<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">/</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">3</span>, color<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"#e74c3c"</span>, linestyle<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"--"</span>, alpha<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.4</span>, label<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"1/3"</span>)</span>
<span id="cb4-12">ax.axhline(<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">/</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">3</span>, color<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"#2ecc71"</span>, linestyle<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"--"</span>, alpha<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.4</span>, label<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"2/3"</span>)</span>
<span id="cb4-13">ax.set_xlabel(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Rounds played"</span>)</span>
<span id="cb4-14">ax.set_ylabel(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Win ratio"</span>)</span>
<span id="cb4-15">ax.set_title(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Monty Hall Monte Carlo — Win Ratio Convergence"</span>)</span>
<span id="cb4-16">ax.legend()</span>
<span id="cb4-17">ax.set_ylim(<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span>, <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>)</span>
<span id="cb4-18">plt.tight_layout()</span>
<span id="cb4-19">plt.show()</span></code></pre></div></div>
</details>
<div class="cell-output cell-output-display">
<div id="fig-convergence" class="quarto-float quarto-figure quarto-figure-center anchored">
<figure class="quarto-float quarto-float-fig figure">
<div aria-describedby="fig-convergence-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
<img src="https://jonathanwhitmore.com/posts/2010-11-26-monty-hall-monte-carlo-python/index_files/figure-html/fig-convergence-output-1.png" width="854" height="468" class="figure-img">
</div>
<figcaption class="quarto-float-caption-bottom quarto-float-caption quarto-float-fig" id="fig-convergence-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
Figure&nbsp;1: Win ratio convergence over 10 million rounds
</figcaption>
</figure>
</div>
</div>
</div>
</section>
<section id="try-it-yourself" class="level2">
<h2 class="anchored" data-anchor-id="try-it-yourself">Try it yourself</h2>
<p>Want to run this locally? With <a href="https://docs.astral.sh/uv/">uv</a> installed:</p>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb5" style="background: #f1f3f5;"><pre class="sourceCode bash code-with-copy"><code class="sourceCode bash"><span id="cb5-1"><span class="ex" style="color: null;
background-color: null;
font-style: inherit;">uv</span> run <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">--with</span> numpy <span class="at" style="color: #657422;
background-color: null;
font-style: inherit;">--with</span> matplotlib monty_hall.py</span></code></pre></div></div>
<p>Or copy the code blocks above into a Jupyter notebook and experiment — try changing the number of doors, the bet amounts, or the number of rounds.</p>


</section>

 ]]></description>
  <category>probability</category>
  <category>python</category>
  <guid>https://jonathanwhitmore.com/posts/2010-11-26-monty-hall-monte-carlo-python/</guid>
  <pubDate>Fri, 26 Nov 2010 00:00:00 GMT</pubDate>
</item>
<item>
  <title>Making Money with Monty Hall</title>
  <dc:creator>Jonathan Whitmore</dc:creator>
  <link>https://jonathanwhitmore.com/posts/2010-11-24-making-money-with-monty-hall/</link>
  <description><![CDATA[ 





<p>There’s a fun and notorious probability problem known as the <a href="https://en.wikipedia.org/wiki/Monty_Hall_problem">Monty Hall problem</a>. It’s famous for tripping up smart people. The setup is simple.</p>
<p>You’re on a game show and are presented with three closed doors: a prize behind 1 of the doors and non-prizes behind the other 2. Usually it’s a car behind one door and a goat behind each of the other two.</p>
<p>The rules: once you choose a door, one of the losing doors is revealed. After the reveal, you may switch your choice or keep it.</p>
<p>Assuming you want the prize, what strategy should you adopt? Should you stay or switch?</p>
<div class="quarto-figure quarto-figure-center">
<figure class="figure">
<p><img src="https://jonathanwhitmore.com/posts/2010-11-24-making-money-with-monty-hall/monty_open_door.svg" class="img-fluid figure-img" style="width:80.0%" alt="Three doors: Door 1 chosen by contestant, Door 3 opened showing a goat, Door 2 remaining closed."></p>
<figcaption>The Monty Hall problem: you picked Door 1, the host reveals a goat behind Door 3. Do you switch to Door 2?</figcaption>
</figure>
</div>
<p class="figure-caption text-muted" style="text-align:center; font-size:0.8rem;">
Illustration by <a href="https://commons.wikimedia.org/wiki/User:Cepheus~commonswiki">Cepheus</a>, via <a href="https://commons.wikimedia.org/wiki/File:Monty_open_door.svg">Wikimedia Commons</a>. Public domain.
</p>

<div class="no-row-height column-margin column-container"><div class="">
<p>A common source of confusion is that the problem only works as stated because the host <strong>knows</strong> where the car is and <strong>always</strong> deliberately reveals a goat. This is part of the rules. The host is not opening a random door and getting lucky — the reveal is always informative about the other doors, never about yours. If the host opened doors randomly and happened to show a goat, the odds really would be 50-50.</p>
</div></div><p>Turns out, <strong>you should switch</strong>. You have a 2/3 chance of winning by switching, and only a 1/3 chance if you stay.</p>
<p>It’s a notorious problem because most people — especially somewhat math-inclined people — are tempted to reject the answer. They insist the odds are 50-50.</p>
<section id="the-youtube-argument" class="level2">
<h2 class="anchored" data-anchor-id="the-youtube-argument">The YouTube Argument</h2>
<p>There’s a YouTube video that mentions the Monty Hall problem and the correct solution. A commenter insisted the real odds are 50-50 — and confronted with the possibility that <a href="http://xkcd.com/386/">someone is wrong on the internet</a> — I engaged.</p>
<p>After a lot of back and forth, the last volley was:</p>
<div class="callout callout-style-default callout-note callout-titled" title="Me">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
<span class="screen-reader-only">Note</span>Me
</div>
</div>
<div class="callout-body-container callout-body">
<p>I don’t forget that the door is removed — and it isn’t just removed, it’s <em>revealed</em> — and that is crucial to why a person should switch.</p>
<p><strong>(a)</strong> If you happened to have picked a door with a goat, when the only other goat is revealed, you are <strong>guaranteed to win the car if you switch</strong>.</p>
<p><strong>(b)</strong> And since you agree that 2/3 of the time you will pick a door with a goat, it follows by necessity that switching will win you the car 2/3 of the time.</p>
<p>It’s not opinion, it’s math.</p>
</div>
</div>
<div class="callout callout-style-default callout-warning callout-titled" title="The commenter">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon"></i>
</div>
<div class="callout-title-container flex-fill">
<span class="screen-reader-only">Warning</span>The commenter
</div>
</div>
<div class="callout-body-container callout-body">
<p>Its opinioinated math. There are two doors left. NOT THREE. Its now 50% chnace the car is behind door 1, and 50% its behind door 3, thats simple math.</p>
<p>Who cares when you made the choice? It does not affect the outcome.</p>
<p>You have fallen prey to a fallacy. Count the doors before you switch. 2 doors, and there is nothing magical making one more likely. Its simple logic. Your maths works fine, your logic is shit.</p>
<p>2/3 of the time you chose a door with a goat, and 1 goat is revealed, so its now 1/2 times you chose a goat. Got it you removed one door, you did not alter your math. Redo the math based on the current situation, not the historical situation.</p>
<p>2 doors, not three — the removed door boosts your choice just as much as the alternate door.</p>
</div>
</div>
<p>So: wrong, impervious to correction, and publicly proclaiming he’s right at my expense. The way I deal with these situations is to <strong>make a bet</strong>. Even if he won’t change his mind, he’ll get punished monetarily for holding false and uncorrectable beliefs. It’s win-win as far as I’m concerned.</p>
</section>
<section id="the-bet" class="level2">
<h2 class="anchored" data-anchor-id="the-bet">The Bet</h2>
<p>Since this commenter thinks the odds are 50-50 whether you switch or stay, and I think they’re 2/3 vs.&nbsp;1/3 for switching, we pay each other depending on whose strategy wins each round:</p>
<table class="caption-top table">
<thead>
<tr class="header">
<th>Outcome</th>
<th>Payout</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td>Staying wins (Door 1 had the car)</td>
<td>I pay him <strong>$1.08</strong></td>
</tr>
<tr class="even">
<td>Switching wins (Door 2 or 3 had the car)</td>
<td>He pays me <strong>$1.00</strong></td>
</tr>
</tbody>
</table>
<p>That’s an 8% payout difference on what he thinks is a coin flip — and if he’s got conviction, he should really want to play as many times as possible.</p>
<section id="how-the-rounds-work" class="level3">
<h3 class="anchored" data-anchor-id="how-the-rounds-work">How the rounds work</h3>
<p>Using a <a href="http://www.random.org/integers/?num=1000&amp;min=1&amp;max=3&amp;col=1&amp;base=10&amp;format=html&amp;rnd=new">random number generator</a> to determine which door hides the prize each round:</p>
<ol type="1">
<li>We both always pick <strong>Door 1</strong> to start.</li>
<li>One goat door is revealed (from Door 2 or 3).</li>
<li>I am forced to <strong>switch</strong> to the remaining closed door. He is forced to <strong>stay</strong> with Door 1.</li>
<li>Whoever picked the right door gets paid by the other.</li>
</ol>
</section>
<section id="first-10-rounds" class="level3">
<h3 class="anchored" data-anchor-id="first-10-rounds">First 10 rounds</h3>
<p>Using the first 10 random prize placements:</p>
<table class="caption-top table">
<colgroup>
<col style="width: 11%">
<col style="width: 22%">
<col style="width: 23%">
<col style="width: 13%">
<col style="width: 28%">
</colgroup>
<thead>
<tr class="header">
<th>Round</th>
<th>Prize behind</th>
<th>What happens</th>
<th>Result</th>
<th>My running total</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td>1</td>
<td>Door 2</td>
<td>Door 3 revealed → I switch to Door 2 → <strong>win</strong></td>
<td>+$1.00</td>
<td>+$1.00</td>
</tr>
<tr class="even">
<td>2</td>
<td>Door 3</td>
<td>Door 2 revealed → I switch to Door 3 → <strong>win</strong></td>
<td>+$1.00</td>
<td>+$2.00</td>
</tr>
<tr class="odd">
<td>3</td>
<td>Door 1</td>
<td>A goat revealed → I switch away → <strong>lose</strong></td>
<td>−$1.08</td>
<td>+$0.92</td>
</tr>
<tr class="even">
<td>4</td>
<td>Door 2</td>
<td>Door 3 revealed → I switch to Door 2 → <strong>win</strong></td>
<td>+$1.00</td>
<td>+$1.92</td>
</tr>
<tr class="odd">
<td>5</td>
<td>Door 3</td>
<td>Door 2 revealed → I switch to Door 3 → <strong>win</strong></td>
<td>+$1.00</td>
<td>+$2.92</td>
</tr>
<tr class="even">
<td>6</td>
<td>Door 1</td>
<td>A goat revealed → I switch away → <strong>lose</strong></td>
<td>−$1.08</td>
<td>+$1.84</td>
</tr>
<tr class="odd">
<td>7</td>
<td>Door 3</td>
<td>Door 2 revealed → I switch to Door 3 → <strong>win</strong></td>
<td>+$1.00</td>
<td>+$2.84</td>
</tr>
<tr class="even">
<td>8</td>
<td>Door 1</td>
<td>A goat revealed → I switch away → <strong>lose</strong></td>
<td>−$1.08</td>
<td>+$1.76</td>
</tr>
<tr class="odd">
<td>9</td>
<td>Door 3</td>
<td>Door 2 revealed → I switch to Door 3 → <strong>win</strong></td>
<td>+$1.00</td>
<td>+$2.76</td>
</tr>
<tr class="even">
<td>10</td>
<td>Door 1</td>
<td>A goat revealed → I switch away → <strong>lose</strong></td>
<td>−$1.08</td>
<td>+$1.68</td>
</tr>
</tbody>
</table>
<p>After 10 rounds: 6 wins, 4 losses — right in line with the 2/3 prediction — and I’m up $1.68.</p>
<p>How many rounds would you like to play? A thousand? A million? Ten million? I’ll play until someone goes bankrupt. Or <a href="../2010-11-26-monty-hall-monte-carlo-python/">let the computer play ten million rounds for you</a>.</p>


</section>
</section>

 ]]></description>
  <category>probability</category>
  <category>python</category>
  <guid>https://jonathanwhitmore.com/posts/2010-11-24-making-money-with-monty-hall/</guid>
  <pubDate>Wed, 24 Nov 2010 00:00:00 GMT</pubDate>
</item>
</channel>
</rss>
