<h2id="org41c13a8"><spanclass="section-number-2">3</span> Using a surface fraction argument</h2>
<divclass="outline-text-2"id="text-3">
<p>
A method that is easier to understand and does not make use of the <code>sin</code> function is based on the fact that if \(X \approx U(0,1)\) and \(Y \approx U(0,1)\), then \(P[X^2 + Y^2 \leq 1] = \pi/4\) (see <ahref="https://en.wikipedia.org/wiki/Monte_Carlo_method">“Monte Carlo method on Wikipedia”</a>). The following code uses this approach:
...
...
@@ -309,14 +317,16 @@ ax.scatter(x[accept], y[accept], c=<span style="color: #98be65;">'b'</span>, alp
A method that is easier to understand and does not make use of the =sin= function is based on the fact that if $X \approx U(0,1)$ and $Y \approx U(0,1)$, then $P[X^2 + Y^2 \leq 1] = \pi/4$ (see [[https://en.wikipedia.org/wiki/Monte_Carlo_method]["Monte Carlo method on Wikipedia"]]). The following code uses this approach: