Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: Monte Carlo approximation of PI

by robartes (Priest)
on Apr 04, 2003 at 12:10 UTC ( [id://248039]=note: print w/replies, xml ) Need Help??


in reply to Re: Monte Carlo approximation of PI
in thread Monte Carlo approximation of PI

Indeed, well spotted. So to make the algorithm even slower, we might actually have to run it twice, once with  < 1 and once with  <= 1, and then take the average of the two. Oh well :).

CU
Robartes-

Replies are listed 'Best First'.
Re: Monte Carlo approximation of PI
by Abigail-II (Bishop) on Apr 04, 2003 at 14:11 UTC
    I just ran a simulation with 16 million uniformely distributed points, and using both < 1 and <= 1 give estimates of 3.141020.

    Round-off errors probably pay their toll as well, even on my 64bit perl.

    Abigail

      OK. Let's file the < vs <= issue under 'premature (or even unnecessary) optimization' then (although not optimization in the speed sense :) ).

      CU
      Robartes-

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://248039]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (6)
As of 2024-03-29 01:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found