TITLE Monte Carlo Derivation of Pi INDEPENDENT { t FROM 0 TO 100 WITH 100 } ASSIGNED { x y r Count PiEst FROM 0 TO 4 } INITIAL { Count = 0 } PLOT PiEst VS t BREAKPOINT { x = 2 * uniformrandom() - 1 y = 2 * uniformrandom() - 1 r = sqrt(x*x + y*y) IF (r <= 1) { Count = Count + 1 } IF (t != 0) { PiEst = Count * 4 / t } }