As for calculating pi... My favourite rational approximation is 355/113 by Tsu Ch'ung-Chi has a nice pattern of digits and is accurate to 6 decimal places (better than the 2 of 22/7 and better than any other below 103993/33102). Others are >223/71 and <22/7 (Archimedes) 3123/994 (the average of the above two, and better than either) 377/120 (Ptolemy) 1019514486099146/324521540032945 (Johann Lambert) Indeed, there are an infinite number of approximations. It just depends on how approximate you want to be. 3? 31/10? 157/50? 3141/1000? 6283/2000? In 1700, Jacob Marcelis gave this approximation (he claimed exact): 1008449087377541679894282184894 3 + ------------------------------- 6997183637540819440035239271702 Are you taking notes? There will be a test at the end... :-) As for pi itself... Which method you you want? There are (literally) an infinite number. Since pi is transcendental, there is no finite polynomial with integer coefficients (like 6x^13+2264448x^7+32123x^2+654) that you can just take a root of and out pops pi. Plenty of iterative methods though: The first was pi = 2/( 1 1 1 1 1 1 1 1 1 sqrt(-) sqrt(-+-sqrt(-)) sqrt(-+-sqrt(-+-sqrt(-)))... 2 2 2 2 2 2 2 2 2 ) ...where "sqrt" is the square-root function, of course. I hope I managed to make the pattern clear enough. pi 2 2 4 4 6 6 -- = - x - x - x - x - x -... 2 1 3 3 5 5 7 pi 1 1 1 1 -- = 1 - - + - - - + - ... 4 3 5 7 9 ...but don't use this one in practice, it takes ages. sqrt(2)pi 1 1 1 1 1 1 1 --------- = 1 + - - - - - + - + -- - -- - -- + ... 4 3 5 7 9 11 13 15 pi-3 1 1 1 ---- = ----- - ----- + ----- - ... 4 2x3x4 4x5x6 6x7x8 pi^2 1 1 1 ---- = 1 + --- + --- + --- + ... 6 2^2 3^2 4^2 pi^2 1 1 1 1 ---- = 1 + --- + --- + --- + --- + ... 8 3^2 5^2 7^2 9^2 1 1 1 1 2^24x76977927xpi^26 ---- + ---- + ---- + ---- + ... = ------------------- 1^26 2^26 3^26 4^26 27! Now just the primes! 2^2 3^2 5^2 7^2 11^2 pi^2 ----- x ----- x ----- x ----- x ------ x ... = ---- 2^2-1 3^2-1 5^2-1 7^2-1 11^2-1 6 Srinivasa Ramanujan gave some stunning approximations: (9^2+19^2/22)^(1/4) = 3.14159265262... 63(17+15sqrt(5)) ---------------- 25( 7+15sqrt(5)) 99^2 ----------- 2206sqrt(2) Some methods for calculating pi might be in order. I don't suppose you have the time or patience to work through an infinite sum or product to the number of terms or factors needed to get even a reasonable approximation (like I said, some of them take ages to get anywhere). So here it goes with a few methods. Step 0: Set a = x = 1, b = 1/sqrt(2) and c = 1/4. /-->Step 1: Set y = a | Set a = (a+b)/2 | Set b = sqrt(by) | Set c = c-x(a-y)^2 | Set x = 2x | Set p = (a+b)^2/4c. \---p is your approximation. To get a better one, go back to Step 1 and go through the loop again. After 3 times around the loop, the approximation is correct to 5 decimal places. Some others, which get more accurate faster, at the expense of extra calculation, are as follows: Step 0: Set y = 1/sqrt(2), c = 0 and p = 1/2 Step 1: Set c = c+1 Set a = sqrt(1-y^2) Set y = (1-a)/(1+a) Set p = p(1+y)^2-y2^c 1/p is your approximation. Loop back to Step 1 to improve it. This is accurate to 8 decimal places after three loops. Step 0: Set y = sqrt(2)-1, c = 0 and p = 6-4sqrt(2) Step 1: Set c = c+1 Set a = (1-y^4)^(1/4) Set y = (1-a)/(1+a) Set p = p(1+y)^4-y(1+y+y^2)2^(2c+1) 1/p is your approximation. Loop back to Step 1 to improve it. This is accurate to 171 decimal places after three loops and 694 after four. The best I know of: Step 0: Set s = 5(sqrt(5)-2), c=0 and p=1/2 Step 1: Set p = ps^2-5^c((s^2-5)/2+sqrt(s(s^2-2s+5))) Set x = 5/s-1 Set y = (x-1)^2+7 Set z = (x(y+sqrt(y^2-4x^3))/2)^(1/5) Set c = c+1 Set s = 25/(s(z+x/z+1)^2) 1/p is still your approximation. Loop back to Step 1 to improve it. This is accurate to 166 decimal places after three loops, and 848 after four. 1/pi = n inf (-1) (6n)! 12SUM(545140134n+13591409)----------------------- n=0 3n+1/2 3 640320 (3n)!(n!) Where n! is the factorial function n!=1x2x3x...xn. 4/pi = 1+1/(2+9/(2+25/(2+49/(2+...)))) 2 pi = n inf (2-sqrt(3)) 72SUM ------------ n=1 2 2n n C n with 2nCn being the choose function 2nCn = (2n)!/(n!)^2 pi = 1 3+---------------- 1 7+-------------- 1 15+----------- 1 1+--------- 1 292+----- 1 1+--- ... although I admit there's not much pattern there. Step 0: s=sqrt(2); p=2+s; y=sqrt(s) Step 1: Set x = (sqrt(x)+1/sqrt(x))/2 Set p = p(x+1)/(y+1) Set y = (ysqrt(x)+1/sqrt(x))/(y+1) And p is your approximation. Repeat Step 1 as necessary. After four times through the loop, this procedure gives p=3.141592653589793238462643383279502884197... and only after the "97" do the digits go haywire. I think I got those procedures right. Morgan L. Owens (himself) .sig under construction. Protective clothing MUST be worn.