Calculator  SCIENTIFIC CALCULATOR

  ☾   ☀   Examples - Read Me - Tools

 Deg   Rad  This calculation:   Edit - Share - Print -
    Save

  • Press Ctrl-d to save this calculation as a bookmark.

- Reset


Let us estimate the value of Pi.
Throw 100 darts at 1x1 square with 1/4 of unit circle in it. Count hits outside the circle:
int(rand** 2 + rand** 2 ) + int(rand** 2 + rand** 2 ) + int(rand** 2 + rand** 2 ) + int(rand** 2 + rand** 2 )  =   1.0 [1]
ans + int(rand** 2 + rand** 2 ) + int(rand** 2 + rand** 2 ) + int(rand** 2 + rand** 2 ) + int(rand** 2 + rand** 2 )  =   3.0 [2]
ans + int(rand** 2 + rand** 2 ) + int(rand** 2 + rand** 2 ) + int(rand** 2 + rand** 2 ) + int(rand** 2 + rand** 2 )  =   5.0 [3]
ans + int(rand** 2 + rand** 2 ) + int(rand** 2 + rand** 2 ) + int(rand** 2 + rand** 2 ) + int(rand** 2 + rand** 2 )  =   6.0 [4]
ans + int(rand** 2 + rand** 2 ) + int(rand** 2 + rand** 2 ) + int(rand** 2 + rand** 2 ) + int(rand** 2 + rand** 2 )  =   7.0 [5]
ans + int(rand** 2 + rand** 2 ) + int(rand** 2 + rand** 2 ) + int(rand** 2 + rand** 2 ) + int(rand** 2 + rand** 2 )  =   8.0 [6]
ans + int(rand** 2 + rand** 2 ) + int(rand** 2 + rand** 2 ) + int(rand** 2 + rand** 2 ) + int(rand** 2 + rand** 2 )  =   8.0 [7]
ans + int(rand** 2 + rand** 2 ) + int(rand** 2 + rand** 2 ) + int(rand** 2 + rand** 2 ) + int(rand** 2 + rand** 2 )  =   10.0 [8]
ans + int(rand** 2 + rand** 2 ) + int(rand** 2 + rand** 2 ) + int(rand** 2 + rand** 2 ) + int(rand** 2 + rand** 2 )  =   11.0 [9]
ans + int(rand** 2 + rand** 2 ) + int(rand** 2 + rand** 2 ) + int(rand** 2 + rand** 2 ) + int(rand** 2 + rand** 2 )  =   11.0 [10]
ans + int(rand** 2 + rand** 2 ) + int(rand** 2 + rand** 2 ) + int(rand** 2 + rand** 2 ) + int(rand** 2 + rand** 2 )  =   14.0 [11]
ans + int(rand** 2 + rand** 2 ) + int(rand** 2 + rand** 2 ) + int(rand** 2 + rand** 2 ) + int(rand** 2 + rand** 2 )  =   15.0 [12]
ans + int(rand** 2 + rand** 2 ) + int(rand** 2 + rand** 2 ) + int(rand** 2 + rand** 2 ) + int(rand** 2 + rand** 2 )  =   15.0 [13]
ans + int(rand** 2 + rand** 2 ) + int(rand** 2 + rand** 2 ) + int(rand** 2 + rand** 2 ) + int(rand** 2 + rand** 2 )  =   17.0 [14]
ans + int(rand** 2 + rand** 2 ) + int(rand** 2 + rand** 2 ) + int(rand** 2 + rand** 2 ) + int(rand** 2 + rand** 2 )  =   19.0 [15]
ans + int(rand** 2 + rand** 2 ) + int(rand** 2 + rand** 2 ) + int(rand** 2 + rand** 2 ) + int(rand** 2 + rand** 2 )  =   20.0 [16]
ans + int(rand** 2 + rand** 2 ) + int(rand** 2 + rand** 2 ) + int(rand** 2 + rand** 2 ) + int(rand** 2 + rand** 2 )  =   20.0 [17]
ans + int(rand** 2 + rand** 2 ) + int(rand** 2 + rand** 2 ) + int(rand** 2 + rand** 2 ) + int(rand** 2 + rand** 2 )  =   22.0 [18]
ans + int(rand** 2 + rand** 2 ) + int(rand** 2 + rand** 2 ) + int(rand** 2 + rand** 2 ) + int(rand** 2 + rand** 2 )  =   25.0 [19]
ans + int(rand** 2 + rand** 2 ) + int(rand** 2 + rand** 2 ) + int(rand** 2 + rand** 2 ) + int(rand** 2 + rand** 2 )  =   26.0 [20]
ans + int(rand** 2 + rand** 2 ) + int(rand** 2 + rand** 2 ) + int(rand** 2 + rand** 2 ) + int(rand** 2 + rand** 2 )  =   27.0 [21]
ans + int(rand** 2 + rand** 2 ) + int(rand** 2 + rand** 2 ) + int(rand** 2 + rand** 2 ) + int(rand** 2 + rand** 2 )  =   28.0 [22]
ans + int(rand** 2 + rand** 2 ) + int(rand** 2 + rand** 2 ) + int(rand** 2 + rand** 2 ) + int(rand** 2 + rand** 2 )  =   29.0 [23]
ans + int(rand** 2 + rand** 2 ) + int(rand** 2 + rand** 2 ) + int(rand** 2 + rand** 2 ) + int(rand** 2 + rand** 2 )  =   31.0 [24]
ans + int(rand** 2 + rand** 2 ) + int(rand** 2 + rand** 2 ) + int(rand** 2 + rand** 2 ) + int(rand** 2 + rand** 2 )  =   32.0 [25]
4 * ( 1 - ans / 100 )  =   2.72 [26]
Now hit the reload button of your browser repeatedly.
You should see the value of expression [26] fluctuate around 3.14.
CalculatorPi.com
  






About - Terms of Service

SCIENTIFIC_CALCULATOR

Ⓒ 2012-2020 Troymius LLC