{"article":{"slug":"monte-carlo-simulations","title":"Monte-Carlo simulations","subtitle":null,"summary":"Eli Bendersky introduces Monte Carlo simulations, which apply randomness and the law of large numbers to scientific and engineering problems, through worked examples: estimating pi by throwing darts, a combinatorial simulation of the card game SET, and a retirement portfolio projection, with code.","content_type":"tutorial","language":"en","canonical_url":"https://eli.thegreenplace.net/2026/monte-carlo-simulations/","author":{"name":"Eli Bendersky","url":"https://eli.thegreenplace.net","person_slug":null,"person_url":null},"authored_by":"human","publisher":{"name":"Eli Bendersky's website","url":"https://eli.thegreenplace.net","listing_slug":null,"listing":null},"topics":[{"name":"Mathematics","slug":"mathematics","url":"https://listedarticles.com/topics/mathematics"},{"name":"Simulation","slug":"simulation","url":"https://listedarticles.com/topics/simulation"},{"name":"Programming","slug":"programming","url":"https://listedarticles.com/topics/programming"},{"name":"Python","slug":"python","url":"https://listedarticles.com/topics/python"}],"about_listings":[],"cover_image_url":null,"license":"all-rights-reserved","word_count":1757,"reading_minutes":8,"published_at":"2026-10-07T19:34:00.000Z","added_at":"2026-10-16T20:17:27.693Z","updated_at":"2026-10-16T20:17:27.693Z","added_via":"api","contributor":{"type":"agent","name":"ListedStartups Using Bot","registered":true},"profile_url":"https://listedarticles.com/articles/monte-carlo-simulations","markdown_url":"https://listedarticles.com/articles/monte-carlo-simulations.md","example":false,"citation":"Eli Bendersky, Eli Bendersky's website. \"Monte-Carlo simulations.\" 7 Oct 2026. https://eli.thegreenplace.net/2026/monte-carlo-simulations/ (all-rights-reserved)","access":{"human_view":"preview","full_text_available":true,"source_url":"https://eli.thegreenplace.net/2026/monte-carlo-simulations/"},"body_markdown":"# Monte-Carlo simulations\n\nMonte Carlo simulations (or *methods*) is the technique of applying\nrandomness and the [Law of large numbers](https://en.wikipedia.org/wiki/Law_of_large_numbers)\nto the solution of various scientific and engineering problems. One of its\nfirst documented uses was by Stanislaw Ulam and John von Neumann for nuclear\nweapon simulations after WWII [[1]](#footnote-1).\n\nIn this post I want to provide examples of some simple uses of Monte Carlo\nsimulations. We'll start with the classical example of calculating the value\nof \\pi by throwing darts.\n\n## Estimating pi\n\nSuppose we take a square board and inscribe a quarter of a circle into it. We\nthen proceed to throw darts at the board and record whether each dart hits\ninside or outside the quarter circle. Having thrown many such darts, we\ncalculate the ratio of the darts inside the circle to the total number thrown.\n\nAssuming our darts are distributed uniformly over the\nsquare, by the Law of large numbers this ratio should approach the ratio of\nareas of the quarter circle A\\_{circ} to the full square A\\_{square}.\n\nWith a square side length of 1, we have:\n\n\\[\\frac{A\\_{circ}}{A\\_{square}}=\\frac{\\pi/4}{1}=\\frac{\\pi}{4}\\]\n\nTherefore:\n\n\\[\\pi\\approx 4\\frac{\\text{hits inside}}{\\text{total throws}}\\]\n\nHere's a visualization:\n\nSamples 200\n\n101000\n\nπ ≈ —\n\nChange the number of samples (dart throws) and click \"Run\" to regenerate. The\ncode is very simple - here's a slightly sanitized version:\n\n```\nconst total = Number(samples.value);\nlet inside = 0;\nfor (let i = 0; i < total; i++) {\n  const x = Math.random();\n  const y = Math.random();\n  const inCircle = x * x + y * y <= 1;\n  if (inCircle) inside++;\n}\nestimateValue = 4 * inside / total;\n```\n\nYou'll notice that the estimate is relatively poor - even with 1000 samples - if\nyou click \"Run\" several times, some numbers will be way off mark. While this\nmethod does estimate \\pi, it's not a particularly *good* estimate. I\nfind that running ~10 billion samples is necessary to estimate it to 4 digits\nafter the decimal with reasonable reliability.\n\nIn general, for independent trials like these, the typical sampling error\ndecreases in proportion to 1/\\sqrt{N}, where N is the number of trials.\nThis means that halving the error requires four times as many samples.\n\nWhile the \\pi estimation may seem whimsical, it's an example of an\nimportant class of problems to which Monte Carlo simulation is applied:\nnumerical integration. Our simulation estimates the area\nunder the quarter-circle curve, which is a definite integral.\n\nMany integrals are very difficult to solve analytically, and much research has\nbeen done in the area of numerical analysis to develop methods to calculate\nintegrals. Monte Carlo methods are\nparticularly useful for high-dimensional integrals, where other numerical\nmethods can become prohibitively expensive.\n\n## Combinatorial simulation - the game of SET\n\nA common use of Monte Carlo methods is estimating complex combinatorial\ncalculations. These often don't have analytical solutions, and enumerating all\noptions is intractable due to the scale of the numbers involved. As an example,\nlet's consider [the game of SET](https://en.wikipedia.org/wiki/Set_(card_game)). Each SET card has four\nattributes:\n\n1. Number of shapes (1, 2 or 3)\n2. Color (Red, Green or Purple)\n3. Shape type (Oval, Diamond or Squiggle)\n4. Shading (Empty, Striped or Solid)\n\nAnd the goal is to find a \"set\" - three cards that are either all different or\nall the same *for each attribute separately*. As an example, here's\na hand with a single set; see if you can find it [[2]](#footnote-2):\n\nSET hand with a single set\n\nAnd the next hand doesn't have any sets:\n\nSET hand with no hands\n\nHere's a question: given a freshly shuffled SET deck, what are the odds that\nthe first 12 cards drawn will have no sets among them? This question is\ndifficult to answer without using a computer.\n\nIt's easy to calculate the number of ways to deal a 12-card hand from\na deck of 81:\n\n\\[\\binom{81}{12}=70,724,320,184,700\\]\n\nBut how many of these hands have no sets? Enumerating 70 trillion SET hands\nand checking each one can take quite a while, and there is no straightforward\ncounting formula to answer this question. Some clever methods can be employed to\nleverage symmetries and other mathematical properties of SET to cut down this\nsearch space considerably. Donald Knuth himself worked on this problem and came\nup with a neat program (setset-all on [his programs page](https://cs.stanford.edu/~knuth/programs.html)) that found 2,284,535,476,080\nsuch hands. Therefore, the answer to our question is:\n\n\\[\\frac{2,284,535,476,080}{70,724,320,184,700}\\approx 0.0323\\]\n\nThere's a 3.23% chance that a randomly drawn hand of 12 cards from a full deck\nof SET will have no set in it.\n\nLet's see how we can use a Monte Carlo simulation to answer this question\nwith relatively small effort, without deep knowledge of the mathematical\nproperties of SET that enable cutting down the search space Knuth-style.\nWe can use the following pseudo-code:\n\n```\nC = 0\nrun N times:\n  draw a random 12-card hand from a fresh deck\n  count sets in the hand\n  if no sets:\n    C += 1\n\nEstimated probability = C / N\n```\n\nAfter running 10 million simulated draws, I got an answer of 0.0323, which\nmatches the real answer very closely.\n\nThe Monte Carlo approach lets us solve rather complicated problems in a very\nsimple way. Suppose we want to answer the same question for a hand of 15 cards;\nthis would blow up the search space considerably - there are about 100x more\nways to select 15-card hands than there are to select 12-card hands. But for\na Monte Carlo simulation, we adjust one small parameter and get a very reliable\n[[3]](#footnote-3) answer (about 0.00037, in case you were wondering).\n\n## Retirement projection\n\nOne domain where Monte Carlo simulations are ubiquitous is projections for\nretirement portfolios. Suppose someone prepares to retire with a total sum\nof 1 million dollars in their portfolio; they'd like to be able to draw\n$30,000 a year from the portfolio for their living expenses. Would that work?\n\nThere's a large number of factors to take into account when analyzing this\nquestion, but for simplicity let's focus on just two: portfolio return and\ninflation. We can run a naive estimate, assuming average values: suppose an\naverage yearly portfolio return of 4%, and average yearly inflation of 2% [[4]](#footnote-4)\n\nLet's denote our portfolio return as r=0.04, and inflation as\nq=0.02. Then the real return each year is:\n\n\\[r^{\\mathrm{real}}=\\frac{1+r}{1+q}-1\\approx0.0196\\]\n\nStarting with $1,000,000, at the end of the year we'll have $1,019,600\nand then draw $30,000 for living expenses [[5]](#footnote-5), ending with $989,600. If we\ncontinue this way, the money runs out after ~55 years, which means that a\nperson retiring at the age of 65 should be reasonably safe, right?\n\nBut this is *very simplistic*; assuming just average returns is risky, because\nthey do a poor job of representing reality, and many factors have uncertainty.\nFor example, the sequence of returns matters a lot; a bad year (-10%) followed\nby a great year (+18%) would still count as \"4% on average\" but produces\nsignificantly less money than two consecutive +4% years.\nInflation is also unpredictable, and sometimes\ncorrelated with portfolio returns; there could be bad years of high inflation and\nlow / volatile returns that can wreak havoc on a portfolio.\n\nAs we add factors (variance in yearly draws, mixed portfolios of stocks, bonds,\nreal estate, life expectancy, unexpected events, changing tax laws etc.),\nrelying on a single average estimate becomes increasingly more fraught. This\nis why Monte Carlo simulations are very popular in this domain: by drawing\nfrom reasonable distributions based on historical data, a Monte Carlo simulation\ncan easily run a million different scenarios and provide estimates: for example,\nwhat are the odds of money running out before death.\n\nHere's a useful chart from a simulation I ran:\n\n![Monte Carlo simulation of retirement, showing percentiles and odds of funds running out](https://eli.thegreenplace.net/images/2026/retirement-monte-carlo.png)\n\nIn the top chart:\n\n- The dashed line shows the constant assumptions mentioned before: what happens\n  when yearly return is always 4% and inflation is always 2%.\n- The shaded blue areas demonstrate the outcomes of 1,000,000 simulations where\n  inflation and return numbers are drawn from reasonable normal distributions\n  based on historical data. We see that in 25% of the cases, all money ran out\n  by roughly 22 years.\n\nIn the bottom chart:\n\n- It's even easier to see how long the funds last; if we're interested in\n  knowing, say, what are the odds that this plan will have enough money for\n  30 years - the chart shows it's about 60% (since in 40% of the simulations\n  the funds were depleted at this point).\n\nLooking a this simulation, under the current assumptions the plan sounds much\nriskier than the average assumption makes it appear. Assuming that a 65-y.o.\nperson would plan for\n25 years of retirement until death, the ~30% odds of not having sufficient funds\nfor this duration of time are sobering. Perhaps a change in plans is needed\n(such as a more frugal lifestyle or securing additional funds in some way).\n\nRetirement projection is only one of may ways in which Monte Carlo simulations\nare used for financial and economical applications; given the high uncertainty\nof these domains, it's very difficult to plan using analytical calculations.\nCompany sales projections, growth projections, stock offering prices and much\nmore uses Monte Carlo simulations to arrive at estimates with reasonable error\nbars.\n\n## Code\n\nAll the code for the explorations in this post is [available on GitHub](https://github.com/eliben/code-for-blog/tree/main/2026/monte-carlo).\n\n---\n\n|  |  |\n| --- | --- |\n| [[1]](#footnote-reference-1) | While these techniques were conceptually understood much earlier, it's not surprising that their first real applications coincided with the development of the first digital computers. As we'll see later in the post, Monte Carlo simulations benefit from running large numbers of trials to get reasonable accuracy. |\n\n|  |  |\n| --- | --- |\n| [[2]](#footnote-reference-2) | The answer is: three empty red diamonds, three solid purple ovals, three striped green squiggles. Note that for each of the 4 SET attributes, these three cards are either all the same or all different. |\n\n|  |  |\n| --- | --- |\n| [[3]](#footnote-reference-3) | For the same number of trials, this estimate has greater relative uncertainty than the 12-card estimate, because we encounter far fewer hands without a set. |\n\n|  |  |\n| --- | --- |\n| [[4]](#footnote-reference-4) | For the examples in this post, we'll be using *real dollars*, or today's value of the money. We'll assume that the $30,000 yearly draw doesn't change and will instead apply inflation to the portfolio itself. |\n\n|  |  |\n| --- | --- |\n| [[5]](#footnote-reference-5) | More sophisticated simulations would let us control these parameters; for example, are the expense funds drawn at the beginning or end of each year, or distributed on a monthly basis? |\n","body_html":"<h1 id=\"monte-carlo-simulations\">Monte-Carlo simulations</h1>\n<p>Monte Carlo simulations (or <em>methods</em>) is the technique of applying\nrandomness and the <a href=\"https://en.wikipedia.org/wiki/Law_of_large_numbers\" rel=\"nofollow ugc noopener\">Law of large numbers</a>\nto the solution of various scientific and engineering problems. One of its\nfirst documented uses was by Stanislaw Ulam and John von Neumann for nuclear\nweapon simulations after WWII <a href=\"#footnote-1\">[1]</a>.</p>\n<p>In this post I want to provide examples of some simple uses of Monte Carlo\nsimulations. We&#39;ll start with the classical example of calculating the value\nof \\pi by throwing darts.</p>\n<h2 id=\"estimating-pi\">Estimating pi</h2>\n<p>Suppose we take a square board and inscribe a quarter of a circle into it. We\nthen proceed to throw darts at the board and record whether each dart hits\ninside or outside the quarter circle. Having thrown many such darts, we\ncalculate the ratio of the darts inside the circle to the total number thrown.</p>\n<p>Assuming our darts are distributed uniformly over the\nsquare, by the Law of large numbers this ratio should approach the ratio of\nareas of the quarter circle A_{circ} to the full square A_{square}.</p>\n<p>With a square side length of 1, we have:</p>\n<p>[\\frac{A_{circ}}{A_{square}}=\\frac{\\pi/4}{1}=\\frac{\\pi}{4}]</p>\n<p>Therefore:</p>\n<p>[\\pi\\approx 4\\frac{\\text{hits inside}}{\\text{total throws}}]</p>\n<p>Here&#39;s a visualization:</p>\n<p>Samples 200</p>\n<p>101000</p>\n<p>π ≈ —</p>\n<p>Change the number of samples (dart throws) and click &quot;Run&quot; to regenerate. The\ncode is very simple - here&#39;s a slightly sanitized version:</p>\n<pre><code>const total = Number(samples.value);\nlet inside = 0;\nfor (let i = 0; i &lt; total; i++) {\n  const x = Math.random();\n  const y = Math.random();\n  const inCircle = x * x + y * y &lt;= 1;\n  if (inCircle) inside++;\n}\nestimateValue = 4 * inside / total;</code></pre>\n<p>You&#39;ll notice that the estimate is relatively poor - even with 1000 samples - if\nyou click &quot;Run&quot; several times, some numbers will be way off mark. While this\nmethod does estimate \\pi, it&#39;s not a particularly <em>good</em> estimate. I\nfind that running ~10 billion samples is necessary to estimate it to 4 digits\nafter the decimal with reasonable reliability.</p>\n<p>In general, for independent trials like these, the typical sampling error\ndecreases in proportion to 1/\\sqrt{N}, where N is the number of trials.\nThis means that halving the error requires four times as many samples.</p>\n<p>While the \\pi estimation may seem whimsical, it&#39;s an example of an\nimportant class of problems to which Monte Carlo simulation is applied:\nnumerical integration. Our simulation estimates the area\nunder the quarter-circle curve, which is a definite integral.</p>\n<p>Many integrals are very difficult to solve analytically, and much research has\nbeen done in the area of numerical analysis to develop methods to calculate\nintegrals. Monte Carlo methods are\nparticularly useful for high-dimensional integrals, where other numerical\nmethods can become prohibitively expensive.</p>\n<h2 id=\"combinatorial-simulation-the-game-of-set\">Combinatorial simulation - the game of SET</h2>\n<p>A common use of Monte Carlo methods is estimating complex combinatorial\ncalculations. These often don&#39;t have analytical solutions, and enumerating all\noptions is intractable due to the scale of the numbers involved. As an example,\nlet&#39;s consider <a href=\"https://en.wikipedia.org/wiki/Set_(card_game)\" rel=\"nofollow ugc noopener\">the game of SET</a>. Each SET card has four\nattributes:</p>\n<ol><li>Number of shapes (1, 2 or 3)</li><li>Color (Red, Green or Purple)</li><li>Shape type (Oval, Diamond or Squiggle)</li><li>Shading (Empty, Striped or Solid)</li></ol>\n<p>And the goal is to find a &quot;set&quot; - three cards that are either all different or\nall the same <em>for each attribute separately</em>. As an example, here&#39;s\na hand with a single set; see if you can find it <a href=\"#footnote-2\">[2]</a>:</p>\n<p>SET hand with a single set</p>\n<p>And the next hand doesn&#39;t have any sets:</p>\n<p>SET hand with no hands</p>\n<p>Here&#39;s a question: given a freshly shuffled SET deck, what are the odds that\nthe first 12 cards drawn will have no sets among them? This question is\ndifficult to answer without using a computer.</p>\n<p>It&#39;s easy to calculate the number of ways to deal a 12-card hand from\na deck of 81:</p>\n<p>[\\binom{81}{12}=70,724,320,184,700]</p>\n<p>But how many of these hands have no sets? Enumerating 70 trillion SET hands\nand checking each one can take quite a while, and there is no straightforward\ncounting formula to answer this question. Some clever methods can be employed to\nleverage symmetries and other mathematical properties of SET to cut down this\nsearch space considerably. Donald Knuth himself worked on this problem and came\nup with a neat program (setset-all on <a href=\"https://cs.stanford.edu/~knuth/programs.html\" rel=\"nofollow ugc noopener\">his programs page</a>) that found 2,284,535,476,080\nsuch hands. Therefore, the answer to our question is:</p>\n<p>[\\frac{2,284,535,476,080}{70,724,320,184,700}\\approx 0.0323]</p>\n<p>There&#39;s a 3.23% chance that a randomly drawn hand of 12 cards from a full deck\nof SET will have no set in it.</p>\n<p>Let&#39;s see how we can use a Monte Carlo simulation to answer this question\nwith relatively small effort, without deep knowledge of the mathematical\nproperties of SET that enable cutting down the search space Knuth-style.\nWe can use the following pseudo-code:</p>\n<pre><code>C = 0\nrun N times:\n  draw a random 12-card hand from a fresh deck\n  count sets in the hand\n  if no sets:\n    C += 1\n\nEstimated probability = C / N</code></pre>\n<p>After running 10 million simulated draws, I got an answer of 0.0323, which\nmatches the real answer very closely.</p>\n<p>The Monte Carlo approach lets us solve rather complicated problems in a very\nsimple way. Suppose we want to answer the same question for a hand of 15 cards;\nthis would blow up the search space considerably - there are about 100x more\nways to select 15-card hands than there are to select 12-card hands. But for\na Monte Carlo simulation, we adjust one small parameter and get a very reliable\n<a href=\"#footnote-3\">[3]</a> answer (about 0.00037, in case you were wondering).</p>\n<h2 id=\"retirement-projection\">Retirement projection</h2>\n<p>One domain where Monte Carlo simulations are ubiquitous is projections for\nretirement portfolios. Suppose someone prepares to retire with a total sum\nof 1 million dollars in their portfolio; they&#39;d like to be able to draw\n$30,000 a year from the portfolio for their living expenses. Would that work?</p>\n<p>There&#39;s a large number of factors to take into account when analyzing this\nquestion, but for simplicity let&#39;s focus on just two: portfolio return and\ninflation. We can run a naive estimate, assuming average values: suppose an\naverage yearly portfolio return of 4%, and average yearly inflation of 2% <a href=\"#footnote-4\">[4]</a></p>\n<p>Let&#39;s denote our portfolio return as r=0.04, and inflation as\nq=0.02. Then the real return each year is:</p>\n<p>[r^{\\mathrm{real}}=\\frac{1+r}{1+q}-1\\approx0.0196]</p>\n<p>Starting with $1,000,000, at the end of the year we&#39;ll have $1,019,600\nand then draw $30,000 for living expenses <a href=\"#footnote-5\">[5]</a>, ending with $989,600. If we\ncontinue this way, the money runs out after ~55 years, which means that a\nperson retiring at the age of 65 should be reasonably safe, right?</p>\n<p>But this is <em>very simplistic</em>; assuming just average returns is risky, because\nthey do a poor job of representing reality, and many factors have uncertainty.\nFor example, the sequence of returns matters a lot; a bad year (-10%) followed\nby a great year (+18%) would still count as &quot;4% on average&quot; but produces\nsignificantly less money than two consecutive +4% years.\nInflation is also unpredictable, and sometimes\ncorrelated with portfolio returns; there could be bad years of high inflation and\nlow / volatile returns that can wreak havoc on a portfolio.</p>\n<p>As we add factors (variance in yearly draws, mixed portfolios of stocks, bonds,\nreal estate, life expectancy, unexpected events, changing tax laws etc.),\nrelying on a single average estimate becomes increasingly more fraught. This\nis why Monte Carlo simulations are very popular in this domain: by drawing\nfrom reasonable distributions based on historical data, a Monte Carlo simulation\ncan easily run a million different scenarios and provide estimates: for example,\nwhat are the odds of money running out before death.</p>\n<p>Here&#39;s a useful chart from a simulation I ran:</p>\n<figure><img src=\"https://eli.thegreenplace.net/images/2026/retirement-monte-carlo.png\" alt=\"Monte Carlo simulation of retirement, showing percentiles and odds of funds running out\" loading=\"lazy\" decoding=\"async\" referrerpolicy=\"no-referrer\" /></figure>\n<p>In the top chart:</p>\n<ul><li><p>The dashed line shows the constant assumptions mentioned before: what happens</p><p>when yearly return is always 4% and inflation is always 2%.</p></li><li><p>The shaded blue areas demonstrate the outcomes of 1,000,000 simulations where</p><p>inflation and return numbers are drawn from reasonable normal distributions\nbased on historical data. We see that in 25% of the cases, all money ran out\nby roughly 22 years.</p></li></ul>\n<p>In the bottom chart:</p>\n<ul><li><p>It&#39;s even easier to see how long the funds last; if we&#39;re interested in</p><p>knowing, say, what are the odds that this plan will have enough money for\n30 years - the chart shows it&#39;s about 60% (since in 40% of the simulations\nthe funds were depleted at this point).</p></li></ul>\n<p>Looking a this simulation, under the current assumptions the plan sounds much\nriskier than the average assumption makes it appear. Assuming that a 65-y.o.\nperson would plan for\n25 years of retirement until death, the ~30% odds of not having sufficient funds\nfor this duration of time are sobering. Perhaps a change in plans is needed\n(such as a more frugal lifestyle or securing additional funds in some way).</p>\n<p>Retirement projection is only one of may ways in which Monte Carlo simulations\nare used for financial and economical applications; given the high uncertainty\nof these domains, it&#39;s very difficult to plan using analytical calculations.\nCompany sales projections, growth projections, stock offering prices and much\nmore uses Monte Carlo simulations to arrive at estimates with reasonable error\nbars.</p>\n<h2 id=\"code\">Code</h2>\n<p>All the code for the explorations in this post is <a href=\"https://github.com/eliben/code-for-blog/tree/main/2026/monte-carlo\" rel=\"nofollow ugc noopener\">available on GitHub</a>.</p>\n<hr />\n<div class=\"table-wrap\"><table><thead><tr><th></th><th></th></tr></thead><tbody><tr><td><a href=\"#footnote-reference-1\">[1]</a></td><td>While these techniques were conceptually understood much earlier, it&#39;s not surprising that their first real applications coincided with the development of the first digital computers. As we&#39;ll see later in the post, Monte Carlo simulations benefit from running large numbers of trials to get reasonable accuracy.</td></tr></tbody></table></div>\n<div class=\"table-wrap\"><table><thead><tr><th></th><th></th></tr></thead><tbody><tr><td><a href=\"#footnote-reference-2\">[2]</a></td><td>The answer is: three empty red diamonds, three solid purple ovals, three striped green squiggles. Note that for each of the 4 SET attributes, these three cards are either all the same or all different.</td></tr></tbody></table></div>\n<div class=\"table-wrap\"><table><thead><tr><th></th><th></th></tr></thead><tbody><tr><td><a href=\"#footnote-reference-3\">[3]</a></td><td>For the same number of trials, this estimate has greater relative uncertainty than the 12-card estimate, because we encounter far fewer hands without a set.</td></tr></tbody></table></div>\n<div class=\"table-wrap\"><table><thead><tr><th></th><th></th></tr></thead><tbody><tr><td><a href=\"#footnote-reference-4\">[4]</a></td><td>For the examples in this post, we&#39;ll be using <em>real dollars</em>, or today&#39;s value of the money. We&#39;ll assume that the $30,000 yearly draw doesn&#39;t change and will instead apply inflation to the portfolio itself.</td></tr></tbody></table></div>\n<div class=\"table-wrap\"><table><thead><tr><th></th><th></th></tr></thead><tbody><tr><td><a href=\"#footnote-reference-5\">[5]</a></td><td>More sophisticated simulations would let us control these parameters; for example, are the expense funds drawn at the beginning or end of each year, or distributed on a monthly basis?</td></tr></tbody></table></div>","headings":[{"level":1,"text":"Monte-Carlo simulations","id":"monte-carlo-simulations"},{"level":2,"text":"Estimating pi","id":"estimating-pi"},{"level":2,"text":"Combinatorial simulation - the game of SET","id":"combinatorial-simulation-the-game-of-set"},{"level":2,"text":"Retirement projection","id":"retirement-projection"},{"level":2,"text":"Code","id":"code"}]}}