Wallis' product exploration
|
02-08-2020, 02:42 PM
Post: #3
|
|||
|
|||
RE: Wallis' product exploration
(02-08-2020 02:13 AM)Albert Chan Wrote: You can check the result with a direct formula, for n terms, here Really interesting document, thanks! I'll send it to my cousin. (By the way I won't say using factorial or double factorial is a "direct formula", as it is an iteration also. But... of course if there were a direct formula for PI, nobody would have tried to calculate its decimals with years and years of computing! ) I used the double factorial function of Wolfram Alpha to evaluate pi for n=10, then 100, ... and compare with my algorithm accuracy. Code:
n=10: 3.06770380664[...more digits with Wolfram but I fixed accuracy on 12] n=100: 3.13378749063 n=1E3: 3.14080774603 n=1E6: 3.14159186819 n=1E8: 3.14159264574 I can conclude I have no problems of accuracy with. With Free42 on iPhone XR it takes approximately 6 minutes to compute for 1E8. (02-08-2020 02:13 AM)Albert Chan Wrote: Or, using lgamma(), we haveI found quite the same for Free42 and Wolfram ! n=1E8: 3.14159264574 Now with the help of your link to calculus7.org and Wolfram, I computed approx. values of PI with the faster converging formula: Code:
n=100: 3.14158298190 n=1E3: 3.14159255556 n=1E4: 3.14159265261 -> better accuracy than 1st algorithm and n=1E8 n=1E5: 3.14159265358 n=1E6: 3.14159265359 -> 12 significant digits, it will not change anymore Yes it is a good version of the algorithm. Next step (tonight?) I'll try to create an optimized algorithm to compute the fractions of double factorials (!!) on Free42. Thanks again for your reply, Albert. Regards. |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 5 Guest(s)