

Title  Calculate Pi using several series 
Keywords  pi, calculate, series, Euler, Gregory's Formula, Gregory's Series, Machin's Formula 
Categories  Algorithms 


This example shows how to calculate Pi using the following formulas:
 Pi = 4 * Atn(1)
 Gregory's Formula (slow)
Pi/4 = 1  1/3 + 1/5  1/7 + ...
 Gregory's Series
Pi/2/Sqrt(3) = 1  1/3/3 + 1/5/3^2  1/7/3^3 + ...
 Machin's Formula
Pi/4 = 4*atn(1/5)  atn(1/239)
 Euler's Formula
Pi/4 = 4*atn(1/2) + atn(1/3)
See the code for the details.
Also see Pi and the Fibonacci Numbers for lots of interesting discussion.





