Skip to content

talha-devp/Approximating-the-Pi

Repository files navigation

Approximating-the-Pi

Tested a logic I saw from The Coding Train.

To simplify if you send random particles to a square and if you draw a circle inside of it, the particles that's inside of the circle's division by all particles multiplied by 4 will give us the pi.

Formula Explained:

(pi * r ^ 2) / (4 * r ^ 2) = pi/4 = insideCircleAmount / allParticles then we reach:
pi = 4 * insideCircleAmount / allParticles

Releases

No releases published

Languages