@jajoosam/

mathecarlo

HTML, CSS, JS

Creating an explorable to understanding ฯ€, and an introduction to the monte carlo integration ๐Ÿ‘€

fork
loading
Files
  • index.html
  • favicon.png
  • meta.png
  • result-script.js
  • results.html
  • script.js
  • style.css

This Plugin Crashed!

Error: Error: must not create an existing file {"type":"CREATE_FILE","wid":"0.5758232448761151","path":"index.html","file":{"path":"index.html","content":{"asEncoding":{"base64":"PCFET0NUWVBFIGh0bWw+CjxodG1sPgogIDxoZWFkPgogICAgPG1ldGEgY2hhcnNldD0idXRmLTgiPgogICAgPG1ldGEgbmFtZT0idmlld3BvcnQiIGNvbnRlbnQ9IndpZHRoPWRldmljZS13aWR0aCwgaW5pdGlhbC1zY2FsZT0xLjAiPgoKCQk8dGl0bGU+TWF0aGUgQ2FybG88L3RpdGxlPgoJCTxtZXRhIG5hbWU9ImRlc2NyaXB0aW9uIiBjb250ZW50PSJCcnV0ZWZvcmNpbmcgdG8gZGVyaXZlIM+AIj4KCgkJPG1ldGEgaXRlbXByb3A9Im5hbWUiIGNvbnRlbnQ9Ik1hdGhlIENhcmxvIj4KCQk8bWV0YSBpdGVtcHJvcD0iZGVzY3JpcHRpb24iIGNvbnRlbnQ9IkJydXRlZm9yY2luZyB0byBkZXJpdmUgz4AiPgoJCTxtZXRhIGl0ZW1wcm9wPSJpbWFnZSIgY29udGVudD0iaHR0cHM6Ly9tYXRoZWNhcmxvLmpham9vc2FtLnJlcGwuY28vbWV0YS5wbmciPgoKCQk8bWV0YSBwcm9wZXJ0eT0ib2c6dXJsIiBjb250ZW50PSJodHRwczovL3BpLjR0eTIuZnVuIj4KCgkJPG1ldGEgcHJvcGVydHk9Im9nOnR5cGUiIGNvbnRlbnQ9IndlYnNpdGUiPgoJCTxtZXRhIHByb3BlcnR5PSJvZzp0aXRsZSIgY29udGVudD0iTWF0aGUgQ2FybG8iPgoJCTxtZXRhIHByb3BlcnR5PSJvZzpkZXNjcmlwdGlvbiIgY29udGVudD0iQnJ1dGVmb3JjaW5nIH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Imh0dHBzOi8vY2RuLnNpbXBsZWFuYWx5dGljcy5pby9oZWxsby5qcyI+PC9zY3JpcHQ+IAoJCTxub3NjcmlwdD48aW1nIHNyYz0iaHR0cHM6Ly9hcGkuc2ltcGxlYW5hbHl0aWNzLmlvL2hlbGxvLmdpZiIgYWx0PSIiPjwvbm9zY3JpcHQ+CgogIDwvYm9keT4KPC9odG1sPg=="},"asBuffer":null},"loaded":true}}
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>
  <head>
    <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:card" content="summary_large_image">
		<meta name="twitter:title" content="Mathe Carlo">
		<meta name="twitter:description" content="Bruteforcing to derive ฯ€">
		<meta name="twitter:image" content="https://mathecarlo.jajoosam.repl.co/meta.png">

		<link rel="stylesheet" href="https://unpkg.com/picnic">

    <link href="style.css" rel="stylesheet" type="text/css" />
		<link rel="icon" href="favicon.png" type="image/png">

  </head>
  <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.

					Look at <a href="https://www.youtube.com/watch?v=M34TO71SKGk">Physics Girl's amazing video</a> to learn more!
					<br><br>
					<span id="made">Made by <a href="https://twitter.com/jajoosam">@jajoosam</a><br><a href="results.html"><img src="https://icongr.am/material/chart-arc.svg?size=20&color=3d3d3d" title="Aggregated Results"></a><a href="https://github.com/jajoosam/mathecarlo"><img src="https://icongr.am/material/github-circle.svg?size=20&color=3d3d3d" title="Github"></a>
					<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