Gauss series for pi
   

   

 Math Help -> Procedures -> Expansions -> Gauss series for pi 

 

>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>

On 12/31/01 2:53:13 AM, Bruce Chiarelli wrote:

If you are looking for algorithms to calculate pi I know a few:

here is the gauss algorithm (Which I find easiest).

Set these values

a=1
b=1/sqrt(2)
t=1/4
x=1

Next do these iterations enough to be greater than the base 2 logarithm of the number of digits to compute for example:

If you want to calculate 1 million digits, iterate this 19 times because the base two logarithm of it is 19.932.

Here are the values you need to calculate:

y=a
a=(a+b)/2
b=sqrt(b*y)
t=t-x(y-a)²
x=2*x

Once this has been repeated sufficiently, substitute the values of a, b , and t into this:

pi=(a+b)²/(4*t)

WOW!

That's the fastest-converging series I've ever seen. It only took 3 iterations (not counting your initial values) to equal the precision of Excel, which is 15 digits.

Here's the spreadsheet I used to verify this:

  A B C D E
1 a b t x pi=(a+b)²/(4*t)
2 1 =1/sqrt(2) =1/4 1 =(A2+B2)^2/(4*C2)
3 =(A2+B2)/2 =sqrt(B2*A2) =C2-D2*(A2-A3)^2 =2*D2 =(A3+B3)^2/(4*C3)
4          
5          

Just copy the cells in row 3 to the rows below it, and here are the values you get: 

  A B C D E
1 a b t x pi=(a+b)²/(4*t)
2 1 0.707107 0.25 1 2.91421356237309
3 0.853553 0.840896 0.228553 2 3.14057925052217
4 0.847225 0.847201 0.228473 4 3.14159264621354
5 0.847213 0.847213 0.228473 8 3.14159265358979

The value of the cell E5, is

(((((((1+(1/sqrt(2)))/2)+ sqrt((1/sqrt(2))*1))/2)+ sqrt(sqrt((1/sqrt(2))*1)*((1+(1/sqrt(2)))/2)))/2)+ sqrt(sqrt(sqrt((1/sqrt(2))*1)*((1+(1/sqrt(2)))/2))*((((1+(1/sqrt(2)))/2)+ sqrt((1/sqrt(2))*1))/2)))²/(4*((((1/4)-1*(1-((1+(1/sqrt(2)))/2))²)-(2*1)*(((1+(1/sqrt(2)))/2)-((((1+(1/sqrt(2)))/2)+ sqrt((1/sqrt(2))*1))/2))²)-(2*(2*1))*(((((1+(1/sqrt(2)))/2)+ sqrt((1/sqrt(2))*1))/2)-((((((1+(1/sqrt(2)))/2)+ sqrt((1/sqrt(2))*1))/2)+ sqrt(sqrt((1/sqrt(2))*1)*((1+(1/sqrt(2)))/2)))/2))²))

The number 4 appears just twice, and they can be easily be replaced by (2*2). This means a value very close to pi can be obtained from an expression containing only ones, twos, and algebraic operators:

(((((((1+(1/sqrt(2)))/2)+ sqrt((1/sqrt(2))*1))/2)+ sqrt(sqrt((1/sqrt(2))*1)*((1+(1/sqrt(2)))/2)))/2)+ sqrt(sqrt(sqrt((1/sqrt(2))*1)*((1+(1/sqrt(2)))/2))*((((1+(1/sqrt(2)))/2)+ sqrt((1/sqrt(2))*1))/2)))²/(2*2*((((1/(2*2))-1*(1-((1+(1/sqrt(2)))/2))²)-(2*1)*(((1+(1/sqrt(2)))/2)-((((1+(1/sqrt(2)))/2)+ sqrt((1/sqrt(2))*1))/2))²)-(2*(2*1))*(((((1+(1/sqrt(2)))/2)+ sqrt((1/sqrt(2))*1))/2)-((((((1+(1/sqrt(2)))/2)+ sqrt((1/sqrt(2))*1))/2)+ sqrt(sqrt((1/sqrt(2))*1)*((1+(1/sqrt(2)))/2)))/2))²))

This is also called the Gauss-Legendre approximation.

Related pages on this website

Proof that p is irrational

 


The webmaster and author of the Math Help site is Graeme McRae.
     [home]  [email]  [search]  [Links to Math Sites]  [Whiteboard]