Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Search results for query: *

  • Users: pioTx
  • Order by date
  1. pioTx

    Calculating pi

    @mikrom: yeah you're right, I noticed that! In my opinion the fact that with n = 4678343 we get a better result than with n = 2147483647 could be possibly due to the fact that also in this plot http://upload.wikimedia.org/wikipedia/commons/7/7d/Errore_montecarlo_calcolo_pi_greco.PNG the error...
  2. pioTx

    Calculating pi

    @mikrom: you're right! call random_number works better than rand(), even though the convergence is very slow. I found this picture on Wikipedia that shows the percent error as a function of the number of drops, and it says that overall the program generated 1,37 billion drops, which is similar...
  3. pioTx

    Calculating pi

    Ohh thank you! I tried and it worked!
  4. pioTx

    Calculating pi

    @mikrom: and how could you do that? In fact, in another situation as well I needed a number bigger than 2^31-1, but I didn't manage to solve it. Is there any way?
  5. pioTx

    Calculating pi

    Whoa thank you very much! Both of your answers were very helpful! Thanks for the code, it's really useful to see another way to answer the problem. And I didn't know I wasn't using double precision numbers for all my values. You've just opened a new world for me! Thank you.
  6. pioTx

    Calculating pi

    sorry, I meant an error threshold of 10^(-10)
  7. pioTx

    Calculating pi

    Hello everyone, I'm trying to calculate pi by following an idea on Wikipedia http://en.wikipedia.org/wiki/Monte_Carlo_method In practice I generate some random points (x,y) in a square (side=1) and counting how many points are in the square and how many are in the circle (radius=1) remembering...

Part and Inventory Search

Back
Top