My Attempt to Explain Binary Splitting for Chudnovsky Algorithm of Calculating Pi

My Attempt to Explain Binary Splitting for Chudnovsky Algorithm of Calculating Pi 

First of all, There is an Amazing Blog by Nick Craig-Wood which explains how binary splitting works and also provides an example python code for the same as well.

I shall be using his blog as a major resource throughout this blog, so hats off to you Nick.

I am writing from the point of view I understood it.

 

The Chudnovsky algorithm goes as follows


 

So to get rid of the crazy power on the denominator, we move it out- 

                          

Since (640320)^(3k+3/2) = (640320)^3k * (640320)^(3/2).
We are doing that, since (640320)^(3/2) is a constant, and not dependent on 'k'.

Factoring out (640320)^(3/2) to the other part of the equation,  Since [a^(3/2)] will give (a * square root of a)

 

Which then, when simplified will give

 

 

Now, lets use 2 variables 'a' and 'b'. And distribute them (13591409 + 545140134k) 

 

b = a*k (this will be useful in the next step, since 'b' is multiplied by '545140134*k', Therefore the 'k' is present)

 

Distribution over (13591409 + 545140134k), and substituting 'a' and 'b' will give

 

 

Then, the reciprocal to find pi 

 

 

With this, since 'a' basically is a summation, we can continue our calculation from where we left off, only knowing the final summation for the 'k' terms calculated.

 

So, 

 

 


Coming back, 

Substituting a(k) and b(k), and a known value of a(k) [The summation till k terms], we can resume computing pi whenever needed.

 

 

So, how does this help improve in optimizing the computer to compute pi to arbitrary precision? 

Good Question.

Well, I do not exactly know. But here it is in my simple language - 

Computers have something known as cores. These are like multiple CPUs in one CPU, which help in multi tasking.
So, by splitting terms, we can compute them in parallel and then just merge the output, instead of just 1 CPU Core just computing the long, original formula.

 

Comments