Changes

Jump to: navigation, search

Kernal Blas

643 bytes added, 14:15, 21 February 2018
Calculation of Pi
With this, we randomly generate points within the area and count the number of times each point falls within the circle, between 0 and 1. We then calculate the ratio and
multiply by 4 which will give us the approximation of Π.
 
 
When we run the program we see:
====== 1st Run ======
1000 3.152 - took - 0 millisecs
10000 3.1328 - took - 0 millisecs
10000000 3.1417368 - took - 998 millisecs
100000000 3.1419176 - took - 10035 millisecs
 
''The first column represents the "stride" or the number of digits of pi we are calculating to.
 
With this method, we can see that the accuracy of the calculation is slightly off. This is due to the randomization of points within the circle. Running the program again will give us slightly different results.
 
====== 2nd Run ======
1000 3.12 - took - 0 millisecs
10000 3.1428 - took - 0 millisecs
100000 3.13528 - took - 9 millisecs
1000000 3.143348 - took - 106 millisecs
10000000 3.1414228 - took - 1061 millisecs
100000000 3.14140056 - took - 8281 millisecs
=== Assignment 2 ===
=== Assignment 3 ===
96
edits

Navigation menu