Pi

Po = πr2

P = a2 = (2r)2 = 4r2

 Po      πr2
—— = ——
 P      4r2

 Po      π
—— = —
 P      4

 Po      k
—— ≈ —
 P      n

 π     k
— ≈ —
 4     n

         4k
π 
≈ ——
        n

Monte Carlo methodMonte Carlo Calculation of pi in Pascal
Monte Carlo Calculation of pi in C++
Monte Carlo Calculation of pi in Java in Java

   
© jtrzeciak@alg24.com