-
Notifications
You must be signed in to change notification settings - Fork 0
/
monte-sim.html
107 lines (103 loc) · 3.87 KB
/
monte-sim.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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Monte Carlo Method</title>
<link rel="shotcut icon" type="image/jpg" href="images/FavAndLogo.png">
<link rel="stylesheet" href="css/style_monte-sim.css">
<script src='https://cdn.plot.ly/plotly-2.4.2.min.js'></script>
<script src="js/mnty.js"></script>
<style>
#canvas1 {
display: flex;
border: 3px solid orange;
background: black;
margin: auto;
margin-top: 3vh;
margin-bottom: 3vh;
}
</style>
</head>
<body>
<header>
<div class="logo"><img class="logo" src="images/andc_logo.jpg"></div>
<h1>V-Lab @ ANDC</h1>
<ul class="navigation">
<li><a href="index.html">Home</a></li>
<li><a href="index.html#labs_section">Labs</a></li>
<li><a href="index.html#team">Team</a></li>
<li><a href="contact.html">Contact Us</a></li>
<li><a href="https://www.andcollege.du.ac.in/" target="_blank" rel="noopener noreferrer">College Website</a>
</li>
</ul>
</header>
<div class="container">
<div class="myHead">
<div class="heading--1">
<h1>Calculating Pi(π)</h1>
</div>
<div class="heading--2">
<h1> Using Monte Carlo Simulation
</div>
</div>
<div class="explanation">
<h3>How it Works:</h3> <br>
The Monte Carlo method is a method of computing Pi(π). The way it works is by creating a
small
circle inside a square. The square should have a circle in it that covers it from top to bottom. A
small
arc will be placed in a random location of this square.
If the arc lands inside of the circle, the amount of circles inside increments by one. To calculate
π
you must do the following formula:
<div class="math1">
π = 4 × (Points Inside Circle ÷ Total Points)
</div>
The higher the values of the points the closer it is to π. Enter total number of points and press
Start button to start the
simulation.
</div>
<div class="monte-method">
<canvas id="canvas1">
This is a simulation
</canvas>
<!-- <canvas id="chutipai"></canvas> -->
<input type="number" name="inputnumber" id="inp1" value="" placeholder="Enter the number of point you want">
<div class="btn">
<button id="start">Start</button>
<!-- <button id="reset">Reset</button> -->
</div>
<div id="click_downlsoad">
<button id="click_download">File Download</button>
</div>
<table>
<tr>
<th>Points Inside:</th>
<th>Points Outside:</th>
<th>Total Points:</th>
</tr>
<tr>
<td id="inside">0</td>
<td id="outside">0</td>
<td id="total">0</td>
</tr>
</table>
<table>
<tr>
<th>Estimated value of Pi(π) is</th>
</tr>
<tr>
<td id="pi">0</td>
</tr>
</table>
<div id="graph">
</div>
</div>
<div class="copyright">
© Oct 2021 Created and Maintained by Ayush Mishra and Vaibhav Thapliyal
</div>
</div>
</body>
</html>