AP Statistics / Mr. Hansen |
Name: _________________________ |
Solution to Pi Simulation Exercise
Your task was to estimate p by performing a Monte Carlo simulation involving the
first quadrant quarter circle of radius 2. Here are the steps:
Here is a tabulation of
results:
Trial # |
x |
y |
Success?
(1=yes, 0=no) |
1 |
1.514869 |
0.716877 |
1 |
2 |
0.523154 |
1.529781 |
1 |
3 |
0.802115 |
1.278847 |
1 |
4 |
0.415451 |
0.817405 |
1 |
5 |
0.299436 |
0.58402 |
1 |
6 |
1.850538 |
0.705966 |
1 |
7 |
1.724866 |
0.858874 |
1 |
8 |
1.247713 |
1.688632 |
0 |
9 |
0.012287 |
0.056046 |
1 |
10 |
0.223077 |
1.922212 |
1 |
11 |
1.032865 |
0.495525 |
1 |
12 |
1.332576 |
1.832073 |
0 |
13 |
1.340788 |
0.805873 |
1 |
14 |
0.71197 |
1.074217 |
1 |
15 |
0.94439 |
1.988424 |
0 |
16 |
0.602156 |
0.140416 |
1 |
17 |
0.912871 |
1.164401 |
1 |
18 |
1.564564 |
0.540651 |
1 |
19 |
0.881133 |
0.729464 |
1 |
20 |
1.945962 |
0.416888 |
1 |
21 |
0.735593 |
1.772785 |
1 |
22 |
1.748613 |
0.014502 |
1 |
23 |
0.481978 |
0.939933 |
1 |
24 |
0.71744 |
0.052331 |
1 |
25 |
1.341016 |
1.939306 |
0 |
26 |
1.389113 |
1.649355 |
0 |
27 |
1.085715 |
0.918535 |
1 |
28 |
0.693089 |
0.021667 |
1 |
29 |
1.156587 |
0.06176 |
1 |
30 |
1.291855 |
1.666163 |
0 |
|
|
|
|
|
|
Success count |
24 |
|
0.800 |
Therefore, the estimate of p would be 4(0.800) = 3.2.
Using an Excel
spreadsheet and a macro, I ran 5 million trials and obtained an estimate of
3.140911 for p.