5 ms·
I had never heard of this product formula before, so I whipped up a quick python program: http://pastebin.com/FBR8rWxv http://pastebin.com/FBR8rWxv All I can s
by ythl 10y ago
I had never heard of this product formula before, so I whipped up a quick python program: http://pastebin.com/FBR8rWxv http://pastebin.com/FBR8rWxv
All I can say is wow, that formula slow to converge on pi. The product after 100 million terms is: 3.141592637878503
You can see that 100M terms only gets you 8 decimals of precision.
- theophrastus 10y agoIf speed of convergence is what you seek, i've yet to discover a more impressive case than a surprisingly simple method attributed to Gauss using the geometric and arithmetic means of two numbers. Three times around the loop and it's already correct to five decimal places: http://pastebin.com/674YJ9VM http://pastebin.com/674YJ9VM
- pvg 10y agoYou can get faster convergence although not quite as simple. https://en.wikipedia.org/wiki/Approximations_of_π#Efficient_methods https://en.wikipedia.org/wiki/Approximations_of_π#Efficient_...
- xyzzyz 10y agoFor another famous, but also very slow series converging to pi, try pi/4 = 1 - 1/3 + 1/5 - 1/7 + ...
- jeffwass 10y agoIf anyone's curious, that series comes from the equation Arctan(1)=Pi/4 and the Taylor expansion around zero of Arctan(x) = x - x^3/3 + x^5/5 + ... where x=1. What makes this expansion particularly painful is that usually Taylor expansion is done around a point where x is small, such that the x^n numerators of subsequent terms get progressively smaller. But in this case the numerator is always 1, so the series depends entirely on the denominator for convergence. Meanwhile, the denominator doesn't grow by the usual increasing factorial terms common to Taylor series, but grows only linearly. So both effects combined cause this expansion to take a very long time to converge.
- iamgopal 10y agoIs there a acceleration ? May be it converge much faster than rest of the method after say a billion precision point ?
- Twirrim 10y agomaybe I'm missing something (haven't tried to debug it), but that just results in 0. edit: Oh that's interesting. Python 2 gave me 0, Python 3 worked fine.
- pvg 10y agoProbably missing that python 2 defaults to integer division.
- deleted 10y ago[deleted]
- wrappertool 10y agoAre slow convergences useful for testing purposes? What is being tested with 100million function calls?