@jajoosam/

mathecarlo

Creating an explorable to understanding π, and an introduction to the monte carlo integration 👀

Files
• index.html
• favicon.png
• meta.png
• result-script.js
• results.html
• script.js
• style.css
index.html
```1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
```
```<!DOCTYPE html>
<html>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">

<title>Mathe Carlo</title>
<meta name="description" content="Bruteforcing to derive π">

<meta itemprop="name" content="Mathe Carlo">
<meta itemprop="description" content="Bruteforcing to derive π">
<meta itemprop="image" content="https://mathecarlo.jajoosam.repl.co/meta.png">

<meta property="og:url" content="https://pi.4ty2.fun">

<meta property="og:type" content="website">
<meta property="og:title" content="Mathe Carlo">
<meta property="og:description" content="Bruteforcing to derive π">
<meta property="og:image" content="https://mathecarlo.jajoosam.repl.co/meta.png">

<meta name="twitter:description" content="Bruteforcing to derive π">

<body>
<div id="container">
<div class="flex one two-600">
<div id="canvas"></div>
<div id="info">

<code>
Points In Circle: <span class="attr" id="inCircle">?</span>&nbsp;<br>
&nbsp;Total Points Plotted: <span class="attr" id="total">?</span>
<br>
&nbsp;<span class="attr" >Tap</span> or hit <span class="attr">Space</span> to add a point
</code>

<h3>The circle's area is<br>
<code id="percent"><em>?</em></code>
<br>
of the square.
</h3>
<br>
<code id="exp">
<span class="dec">?</span> · (2r)² = <span class="pie">π</span> · r²
<hr>
<span class="dec">?</span> · 2² · r² = <span class="pie">π</span> · r²
<hr>
<span class="pie">π</span> = <span class="dec">?</span> · 4

</code>
<br>

<h1>π = <code id="pi"><em>?</em></code></h1>
<br>
<footer>
An interactive demo of the Monte Carlo Integration - to derive <span class="pie">π</span> in a brute force sort of way.

<br><br>
<a href="https://simpleanalytics.io/pi.4ty2.fun/"><img src="https://icongr.am/material/chart-bar.svg?size=20&color=3d3d3d" title="Analytics"></a>
</footer>
</div>
</div>
</div>

<script src="https://unpkg.com/[email protected]/konva.min.js"></script>
<script src="script.js"></script>
<script async src="https://cdn.simpleanalytics.io/hello.js"></script>
<noscript><img src="https://api.simpleanalytics.io/hello.gif" alt=""></noscript>

</body>
</html>```
result
console