Estimating Pi with Twister Algorithm & Monte Carlo Simulation

  • Thread starter Thread starter bobsmiters
  • Start date Start date
  • Tags Tags
    Algorithm
AI Thread Summary
The discussion focuses on using a Monte Carlo simulation to estimate pi by simulating dart throws on a board with a radius of 1 and an inscribed square. The user has attempted to generate random numbers using the Twister algorithm seeded with 0.123456 but encountered issues with the command "rand('twister', 0.123456)" yielding no results. Clarification is sought regarding how to plot the points generated and whether the variables "b" and "w" are correctly defined. The user confirms they are using MATLAB for their simulation. The conversation emphasizes the need for understanding how random number generation functions in different programming languages.
bobsmiters
Messages
12
Reaction score
0
okay new problem here. I am doing a Monte Carlo simulation to estimate pi. The question deals with throwing darts randomly at a board with a radius 1 with a square inscribed in it. I have done a script that randomly selected a number b/w -1 and 1. Then I was supposed to generate the results of 500 uniformly random throws using the twister algorithm and seeded with 0.123456

I approached this by: rand('twister', 0.123456) nothing happened I'm not sure if that is supposed to happen?

The next part of the question asks you to use this information to estimate pi. To answer this question do I plot the points that were randomly assigned?
 
Physics news on Phys.org
bobsmiters said:
okay new problem here. I am doing a Monte Carlo simulation to estimate pi. The question deals with throwing darts randomly at a board with a radius 1 with a square inscribed in it. I have done a script that randomly selected a number b/w -1 and 1. Then I was supposed to generate the results of 500 uniformly random throws using the twister algorithm and seeded with 0.123456

I approached this by: rand('twister', 0.123456) nothing happened I'm not sure if that is supposed to happen?

The next part of the question asks you to use this information to estimate pi. To answer this question do I plot the points that were randomly assigned?
I am afraid you are going to have to explain more. Do you mean b/(w-1) or (b/w)- 1? What are "b" and "w"? What language are you using? "rand" may work differently for different languages (and different compilers for a given language).
 
Re

Sorry, I meant between (b/w) -1 and 1. I am using the MATLAB program.
 
I picked up this problem from the Schaum's series book titled "College Mathematics" by Ayres/Schmidt. It is a solved problem in the book. But what surprised me was that the solution to this problem was given in one line without any explanation. I could, therefore, not understand how the given one-line solution was reached. The one-line solution in the book says: The equation is ##x \cos{\omega} +y \sin{\omega} - 5 = 0##, ##\omega## being the parameter. From my side, the only thing I could...
Back
Top