It seems to me that two terms are enough to save computing resources. Of course, even with n = 100, the following differences are noticeable, but they need to be checked on exact numbers. Upon careful examination, a second difference of (2 / n 3) was found. I looked at the results at n = 100, 100 and found a (2 / n) difference. Each thread gave its own amount, and then with a small n, I noticed that most of the digits match, with the exception of a few. Then I divided the calculations into ten parallel threads and reduced n. Conclusion and Points of InterestĪt first, I used very large values of n = 1,000,000,000 and waited a few seconds before getting the result. 0 / (n * n * n) Īt least an accuracy greater than (1 / n 3) is obtained, in contrast to the initial accuracy less than (1 / n). For verification, use the value 4 arctan(1). Check the numerical value of the result for i from 1 to 99 (for n = 100) and compare it with the exact value of the pi number. We find the correcting terms empirically. Indian mathematician Madhava used correction terms to improve accuracy. This result is inverse to our goal of minimizing deviation. Thus, at each step, we get the maximum deviation (white color) from the line. Half of the segment (red color) is closer to the line than its edges (white color). At each step, the white line passes through the pi line. Our goal is to minimize deviation (red color) from the pi line (blue color) with a limited number of steps. How to get the result? It all depends on the goal. To get the exact value, we need to continue the endless calculation process. The simple program in C for calculating pi value:Īt each step, we get a value (white color) far from the pi line (blue color). To get pi, we need to multiply the result by 4. įor an infinite number of terms, this sum is equal to the fourth part of pi. For example, take the first number 1, the second number 1/3 with a minus sign, the third 1/5 with a plus sign, etc. The sign of a fraction is changed at every step. The formula Madhava - Gregory - Leibniz is a simple sum of fractions of one divided by odd number from 1 to infinity. It is always interesting to improve an existing method so that it works faster and easier. These methods are well researched and their characteristics are known, how much time and computing resources are needed to solve them. There are many interesting ways to calculate the pi number: geometric constructions, natural experiments using random numbers, as well as a huge number of different formulas from simple to complex.
0 Comments
Leave a Reply. |