![]() ![]() The second program makes use of offsets to increase the precision of numbers. The first program is quite straight and uses random numbers with as many decimal digits as the RND() function offers. So, if we compute the ratio number points inside circle/ total number of points it’s very likely that we will get an estimate of PI! And similarly, the total number of random points created will give an estimate of the area of the square (remember that the total number of points created belong to the square for sure). So the idea is that if we generate a huge quantity of random points, the points inside the circle will give an estimate of the area of the circle itself. As for the circle instead, some points will belong to it, others will not. If we create many random numbers in the range, of course all points will belong to the size 2 square. ![]() Here’s what random numbers are all about in here. Now, a square of size 2, centered to the origin, is made up of (X, Y) points with their coordinates all belonging to the range. Have you ever been on a Casino? Me not… But still, we are now going to deal with random numbers. Now that’s the idea! If we get a way to estimate that ratio, then we get an estimation of PI as well! ![]() Now, the ratio between the area of the circle and the area of the square is, of course, PI/4. And the area of such a circle is PI (the area of a circle is PI * R^2). And imagine a circle inside the square with a diameter again of 2. This is kind of reasonable after all, since with this method we are using random number. This is not the case with the Monte Carlo method. And the newest value is always closer to PI than the oldest. With other methods you can get a succession of approximation values. Rather, by using random numbers you create a succession of numbers that eventually will hopefully stabilize on an approximate value of PI. With Monte Carlo Method, you are not creating a succession of values that eventually converge to an approximate value of PI. But, estimating PI using Monte Carlo Method is something quite different. For instance, you can use limits, series and so on. Many methods use some mathematical “trick” to get an approximate value of PI. OK, it’s not PI day, but I wanted to have a trial at estimating PI using Monte Carlo Method anyway. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |