[comp.misc] Here are FORMULAS for PI!

crds@NCoast.ORG (Glenn A. Emelko) (01/07/91)

Okay, okay -- I waited to see if anyone was going to actually put forth
any formulas for Pi before I throw in my $1.85 worth of commentary.  Here
are some formulas for Pi which have historical significance, as best that
I can represent them in textual form:
-------------------------------------------------------------------------
John Wallis, 1665, VERY slow to converge:                 WALLIS' PRODUCT
 
Pi   2*2   4*4   6*6   8*8
-- = --- * --- * --- * --- ....
2    1*3   3*5   5*7   7*9
-------------------------------------------------------------------------
James Gregory, 1671, VERY slow to converge:              GREGORY'S SERIES
 
Pi       1   1   1   1
-- = 1 - - + - - - + - ....
4        3   5   7   9
-------------------------------------------------------------------------
John Machin, 1706, reasonable convergence:               MACHIN'S FORMULA
 
Pi
-- = 4 * arctan(1/5) - arctan(1/239)
4
 
		n^3   n^5   n^7
arctan(n) = n - --- + --- - --- + ....
		 3     5     7
-------------------------------------------------------------------------
John Gauss, about 1850, VERY slow to converge:
 
Pi^2        1     1     1     1
---- = 1 + --- + --- + --- + --- ....
  6        2*2   3*3   4*4   5*5
 
This is notable because Gauss succeeded in solving the elusive summation
of the reciprocals of the squares of the natural numbers -- other than
that it has little value.  Gauss went on to find similar equations for
Pi^3 thru Pi^26!
 
       infinity
Pi^2    ____    1
---- =  \      ---
  6     /___   n^2
         n=1
-------------------------------------------------------------------------
Srinivasa Ramanujan, 1914, fast convergance (about 8 digits per term):
 
             infinity
1    sqr(8)   ____    (4n)! * (1103+26390n)
-- = ------ * \       ---------------------
Pi    9801    /___      (n!)^4 * 396^(4n)
               n=0
 
Note that by definition, 0! = 1.
-------------------------------------------------------------------------
Johnathan M. Borwein and Peter B. Borwein, 1986, EXTREMELY fast:
 
(A computer iterative approach, the number of correct digits increases
 by a factor of four for each term!  This is not the fastest converging
 algorithm they developed, but it may be the most efficient.  This is
 *the* algorithm used on supercomputers to produce the 1986 record of
 29,360,000 decimal places on a Cray-2 by David H. Bailey, iterating
 it only 12 times, also to set the 1987 record of 134,217,000 places
 on a NEC SX-2 by Yasumasa Kanada and his colleagues.)
 
Y(0) = sqr(2) - 1         A(0) = 6 - 4sqr(2)
 
For each iteration (start with n=0):
 
         1 - (1-Y(n)^4)^(1/4)
Y(n+1) = --------------------
         1 + (1-Y(n)^4)^(1/4)
 
Compute the result Y(n+1) and then use it in the following:
 
A(n+1) = [(1+y(n+1)^4) * A(n)] - [2^(2n+3) * Y(n+1) * (1+Y(n+1)+Y(n+1)^2)]
 
If you wish to do another iteration, increment n and go for it.
 
When you are done, Pi = 1/A(n+1).
 
My sincere apologies to Borwein and Borwein for butchering this so badly
(it's accurate but hardly readible)
-------------------------------------------------------------------------
The article mentioned in the bibliography below about Ramanujan is very
interesting, and I highly recommend it for all to read.  It also contains
most of the the formulas I transcribed above, plus numerous others and
alot of the theory that went along with their development.
 
Enjoy!
 
Glenn A. Emelko
-------------------------------------------------------------------------
Bibliography:
 
Ramanujan and Pi, Jonathan M. Borwein and Peter B. Borwein, Scientific
     American, February 1988, Volume 258 Number 2
A History of Pi, Peter Beckmann, The Golam Press, 1977.

kdq@demott.com (Kevin D. Quitt) (01/08/91)

    Why is it that all the good formulas for PI are really for 1/PI?
Is inversion using an infinite/very-high precision package that easy?

-- 
 _
Kevin D. Quitt         demott!kdq   kdq@demott.com
DeMott Electronics Co. 14707 Keswick St.   Van Nuys, CA 91405-1266
VOICE (818) 988-4975   FAX (818) 997-1190  MODEM (818) 997-4496 PEP last

brnstnd@kramden.acf.nyu.edu (Dan Bernstein) (01/08/91)

In article <1991Jan7.213551.14050@demott.com> kdq@demott.COM (Kevin D. Quitt) writes:
>     Why is it that all the good formulas for PI are really for 1/PI?

Not all of them are.

> Is inversion using an infinite/very-high precision package that easy?

Yeah, pretty much. It's a royal pain to get working the first time, but
only a few times slower than multiplication after that.

---Dan

bnolan@ccvax.ucd.ie (Breanndan O Nuallain) (01/15/91)

In article <1991Jan6.233340.808@NCoast.ORG>, 
	crds@NCoast.ORG (Glenn A. Emelko) writes:
> Okay, okay -- I waited to see if anyone was going to actually put forth
> any formulas for Pi before I throw in my $1.85 worth of commentary.  Here
>...
> John Gauss, about 1850, VERY slow to converge:
>  
> Pi^2        1     1     1     1
> ---- = 1 + --- + --- + --- + --- ....
>   6        2*2   3*3   4*4   5*5
>  
> This is notable because Gauss succeeded in solving the elusive summation
> of the reciprocals of the squares of the natural numbers -- other than
> that it has little value.  Gauss went on to find similar equations for
> Pi^3 thru Pi^26!
>  

Phew! He was some calculator, that Gauss fella! I reckon 
factorial twenty-six is about 4 * 10**26. That musta been 
his life's work!

-- 
____________________________________________________________
       ,  ,      ,
Breanndan O Nuallain        Department of Computer Science
                            University College Dublin
Phone: +353-1-693244        Belfield, Dublin 4
        ext 2487            Ireland
------------------------------------------------------------

dbell@cup.portal.com (David J Bell) (01/16/91)

>> John Gauss, about 1850, VERY slow to converge:
>>  
>> Gauss went on to find similar equations for
>> Pi^3 thru Pi^26!
>>  
 
>Phew! He was some calculator, that Gauss fella! I reckon 
>factorial twenty-six is about 4 * 10**26. That musta been 
>his life's work!
 
       ,  ,      ,
>Breanndan O Nuallain        Department of Computer Science
>                            University College Dublin
 
And then, he went and raised PI to that power - with GAMMA,
I made it about 6.8e28....
 
Dave          dbell@cup.portal.com