Hi everyone. I'm not at all an experienced programmer, so if this answer to this is obvious, I apologize.
I was writing a program to calculate the Liebniz series, which states that the sum of 1 - 1/3 + 1/5 - 1/7 etc. equals pi/4. It is very slow - getting pi to 10 digits takes about 10 seconds to run. I tried various optimizations (loop unrolling, reducing variable usage in the loop, pairwise conversion to eliminate the need for negative numbers, etc), which was able to get runtime down to about 4 seconds.
But when I plug this series into WolframAlpha, it can calculate it to any desired precision almost instantly.
So my question is - how does it do this?
Thanks.
I was writing a program to calculate the Liebniz series, which states that the sum of 1 - 1/3 + 1/5 - 1/7 etc. equals pi/4. It is very slow - getting pi to 10 digits takes about 10 seconds to run. I tried various optimizations (loop unrolling, reducing variable usage in the loop, pairwise conversion to eliminate the need for negative numbers, etc), which was able to get runtime down to about 4 seconds.
But when I plug this series into WolframAlpha, it can calculate it to any desired precision almost instantly.
So my question is - how does it do this?
Thanks.