An open API service indexing awesome lists of open source software.

https://github.com/programerr01/pi

calculating the value of pi
https://github.com/programerr01/pi

Last synced: 9 months ago
JSON representation

calculating the value of pi

Awesome Lists containing this project

README

          

# PI
calculating the value of pi
# Background
pi is the ratio of perimeter of the circle to the diameter

# Basic technique used
let a square whose side is 2r where r is 1
let a circle inside the square whose radius is r
the area of square is a^2 so a =2r
the area of circle is pi*r^2
so the ratio of area of circle divided by the area of square
= pi*r^2 / 4r^2
so the ratio is pi/4

similarly if we take the random point in the whole plane the
probability that the point will land inside the circle is
= points land in circle / total number of points thrown

this ratio should also equal to the ratio of area
pi/4 = total number in circle / total number of points
pi = 4 * total number in circle / total number of points