![]() ![]() Its efforts were "almost twice as fast as the record Google set using its cloud in 2019, and 3.5 times as fast as the previous world record in 2020", according to the university's Centre for Data Analytics, Visualisation and Simulation. I might squirrel that way for an OPCĬontest entry."The calculation took 108 days and nine hours" using a supercomputer, the Graubuenden University of Applied Sciences said in a statement. Supposedly there is a modern pi generating algorithm which takes constant time to generate any given digit of pi requested. Oops forgot to log in, above post was mineĬould you provide a link? I'm too lazy to search, but I would still like to read more about this particular approach. So the propability of any coordinate landing in the circle becomes area of circle/area of square or pi/4 so we divide the number that landed in the circle by the number overal and multiply the result by 4. The circle has a radius of 1, so it's area is pi (A=pi*r**2) and the square has an area of 4 since each side is 2. Thats exactly how the algorithm is supposed to work. Thaigrrrr Maybe I did not quite understand you. Some notes below your chosen depth have not been shown here Sorry for the cryptic code for a quick decrypt its: (2**n)*sqrt(2-sqrt(2+sqrt(2+sqrt(2+sqrt(2))))) with the number of 2's inside the sqrt equaling n. So, while not the best, but I have some strange affinity to it. With my perl, 14 iterations is gives the maximum accuracy: 3.14159265480759 Even though two is normally a computer friendly number, this algorithm isn't, because it also uses sqrt's. (neither is mine 10,000,000 runs should give me a digit or two more accuracy).Īnyway, here is my favorite approximation for pi, mainly because it only uses the number 2. (for an average of 3.1415) It's quite likely your rand() isn't perfect. ![]() Running for 10,000,000 twice I got 3.1405 the first run, and 3.1424 the second. Is this a nuence of the method, or is this have to do with srand not being completly random? Also after 50,000 or so, not once did it generate pi starting with 3.14 ?!? As it got farther than 50,000 it started going into 3.16. Can you please help me with something? I modified the code to repeat the calculations a certain number of times adding 10 cycles each time. WHen you throw the dart, there is a propability of pi/4 that it will land. Its based on a circle with a radius of 1 and a square dartboard with each sid being 2. I did not come up with the method if that's what you are asking. More often than not because the area within the circle is greater than that outside of the circle but within the square. This could be anyĬoordinate inside the square, therefore all of the points outside the circle but inside the square will not equal pi. What is happening in this algorithm is you are coming up with two random numbers but only couting your $yespi if (x^2 + y^2) <=1. Inside this square is a circle with a radius of 1, also with its center at (0,0) Think of an x,y plane with a 1x1 square with its center located at (0,0). I retested the numbers and I got some results: I actually did some testing on this, and it is pretty random, I plugged in a bunch of numbers, and got 3.14. The most remarkable result was that of Lazzerini (1901), who made 34080 tosses and got Various people have tried to calculate by throwing needles. ![]() If we have a uniform grid of parallel lines, unit distance apart and if we drop a needle of length k < 1 on the grid, the probability that the needle falls across a line is 2k/pi. Did you come up with this on your own? Is this based on the Buffon pin drop method, where he drops a pin of length X on a page of parallel lines? If so bravo I found it really entertaining :)Īlso the use of srand and rand (forcing the random number to be less than 1 but greater than zero) is pretty sweet. Not a very efficient method of calculating PI but really trivial because of the accuracy of PI as the cycles increase. I wrote a paper on AI and the Monte Carlo Method in college so I found it even more interesting. ![]()
0 Comments
Leave a Reply. |