Archives

- Beowulf
- Beowulf Announce
- Scyld-users
- Beowulf on Debian

# Math help: Calculate pi using Gregory's Series on Beowulf?

Many of your questions may have already been answered in earlier discussions or in the FAQ. The search results page will indicate current discussions as well as past list serves, articles, and papers.

Search

Martin Siegert siegert at sfu.ca
Fri Aug 3 10:49:04 PDT 2001

```On Fri, Aug 03, 2001 at 01:19:29PM -0300, Chris Richard Adams wrote:
> Calulating Pi.
>
> I found a link to compute pi using Gregory's Series. It states the form
> allowing quickest convergence
> is..
>
> 	pi = 2*sqrt(3)*[ 1 - (1/(3*3)) + (1/(5*3^2)) - (1/(7*3^3)) ... ]
>
> In the example for computing pi that comes with MPICH/MPI-Beowulf, I see
> something like...
>
> 	Sum = Sum + 4 * [ 1 / ( 1 + ( 1/n * ( i - 0.5 ) )^2 ) ]
>
> 	where we iterate n times and i increments from 1 to n.
>
> 	- then, pi = 1/n * sum
>
> ANyone see how to get from Gregory's series to this form, or does this
> form evolve from a different
> approach?  I'll keep trying... any feedback is appreciated.

This is different:

pi = 4 arctan(1) and arctan(x) = int_0^x[dy 1/(1 + y^2)]

If you want to know how to calculate pi check

http://www.cecm.sfu.ca/projects/pihex

Did you know that the quadrillionth bit of pi is '0' ?

Martin

========================================================================
Martin Siegert
Academic Computing Services                        phone: (604) 291-4691
Simon Fraser University                            fax:   (604) 291-4242
Burnaby, British Columbia                          email: siegert at sfu.ca