• Lobby
  • Pi to one MILLION decimal places

PI = limit as n->infinity of n(sin(180-(2(180(n-2)/2n))))/2(sin((180(n-2))/2n))

this is calculated .. following .. a procedure .. in which we get the perimetre of a polygon of n sides .. in comparison to the diagonal/2

if this polygon had infinite sides .. then the thing would be a circle .. and the diagonal would be the diametre of the circle ..

so .. as long as we keep increasing n .. PI gets more accurate. . .. but it's one theorem of calculating PI)

and actually .. it's dumb to think .. that pi is the perimetre of a circle in relation to it's radius or so .. cuz u calculate the perimetre of the circle using pi ..

it's said how they do it .. in that link KingRhye posted..

been a long time .. but .. the one they use in computers / calculators .. is actually .. the sum thing (Gregory and Leibniz's Method) in that link
PI = limit as n->infinity of n(sin(180-(2(180(n-2)/2n))))/2(sin((180(n-2))/2n))
ya that :P :P
AyMaN I thought you were talking about a recursive C function, cos I know how it's done in maths, I don't need formulas or even explanations, but I'm curious on how you could implement it in the "basic programming thing" you mentioned, as I intended to prove it's not so basic to calculate pi to the millionth decimal as you think it is, taking into consideration the restrictions on floating point decimals etc etc.. shall I elaborate or do you know what I'm aiming at ?
and actually .. it's dumb to think .. that pi is the perimetre of a circle in relation to it's radius or so .. cuz u calculate the perimetre of the circle using pi ..
You're wrong, pi was first introduced and calculated as a ratio between the perimeter and radius, not the opposite. Just ask yourself, where did the number pi come from in the beginning ? ;)
Thanks For The Info. Guys.
AyMaN I thought you were talking about a recursive C function, cos I know how it's done in maths, I don't need formulas or even explanations, but I'm curious on how you could implement it in the "basic programming thing" you mentioned, as I intended to prove it's not so basic to calculate pi to the millionth decimal as you think it is, taking into consideration the restrictions on floating point decimals etc etc.. shall I elaborate or do you know what I'm aiming at ?
and actually .. it's dumb to think .. that pi is the perimetre of a circle in relation to it's radius or so .. cuz u calculate the perimetre of the circle using pi ..
You're wrong, pi was first introduced and calculated as a ratio between the perimeter and radius, not the opposite. Just ask yourself, where did the number pi come from in the beginning ? ;)
recursion starts with math .. and as i said .. they used the sum formula .. that's a recursive function in math ..

which is simply implemented in C .. doesn't even need explanation .. u just need the formula..
You're wrong, pi was first introduced and calculated as a ratio between the perimeter and radius, not the opposite. Just ask yourself, where did the number pi come from in the beginning ? ;)
eh .. it was calculated (like 4000 years ago) .. by putting a string on the perimetre of the circle and relatively to it's radius .. ya3neh .. if u were that dumb .. be my guest .. calculate it this way .. ya3neh .. get a rope .. and mesure the perimetre of the circle .. (ya3neh caveman methods.) ..
and if u know any other way of calculating the perimtre of a circle .. please tell me..

this is a chronology of PI

http://rpimath.topcities.com/irrationals/pi.html

and for the recursive C function .. here u go .. there's an explanation of a common formula.. in this link..
http://rpimath.topcities.com/Pi/doug05.html

and when i said "basic programming" .. i ment .. that they teach u that when u start learning recursion in C .. and u take it first in calculus. . taylor series .. i think .. and u "apply" it in C.
recursion starts with math .. and as i said .. they used the sum formula .. that's a recursive function in math ..

which is simply implemented in C .. doesn't even need explanation .. u just need the formula..
You're wrong, pi was first introduced and calculated as a ratio between the perimeter and radius, not the opposite. Just ask yourself, where did the number pi come from in the beginning ? ;)
eh .. it was calculated (like 4000 years ago) .. by putting a string on the perimetre of the circle and relatively to it's radius .. ya3neh .. if u were that dumb .. be my guest .. calculate it this way .. ya3neh .. get a rope .. and mesure the perimetre of the circle .. (ya3neh caveman methods.) ..
and if u know any other way of calculating the perimtre of a circle .. please tell me..

this is a chronology of PI

http://rpimath.topcities.com/irrationals/pi.html

and for the recursive C function .. here u go .. there's an explanation of a common formula.. in this link..
http://rpimath.topcities.com/Pi/doug05.html

and when i said "basic programming" .. i ment .. that they teach u that when u start learning recursion in C .. and u take it first in calculus. . taylor series .. i think .. and u "apply" it in C.
Okay first things first, here's the definition of pi quoted from the Webster's dictionary:
a- the symbol pi denoting the ratio of the circumference of a circle to its diameter
b- the ratio itself: a transcendental number having a value to eight decimal places of 3.14159265
You missed the point, pi didn't drop from the skies, it was defined as this ratio.
Now for the rest of what you said, a sum (infinite in this case) isn't a recursion, there's a huge difference. Anyway that's not the issue here, you also missed my second point. I checked out the methods you linked me to, and naturally I must say they stand correct, mathematically, no one can refute that, but my point is, when you're computing in C or any other language, you're using variables of a certain type, double or long double or whatever, and these variables are programmatically bounded by a certain precision, for instance, say you wanna define the simple ratio 1/3, we all know it's 0.3333... and there you've got an infinite sequence of 3's, so when representing this ratio in a variable, you can't define 1/3 infinitly, you're bounded by the precision of the type of variable you use, and that precision is finite, which introduces an error in your calculations if you're intending to calculate to a million decimals and more, and therefore, your precision is bounded by an epsilon limit. For instance, the last link you provided which illustrates the Gauss-Legendre Method algorithm uses the sqrt function, now suppose the algorithm encountered sqrt(2), which it did, then stores it in a variable, it's normal to expect a rounded value of sqrt(2) stored, not the whole transcending square root value of 2. So to obtain the very high precision needed, you have to use special libraries that provide such precision, for example the apfloat library.
I hope that by now you got my point, I tried to be as clear as I could. Nowadays there are fast methods of iteration to calculate pi, if you like you can search the internet and post them here. Good hunting.
ayman ... shu el fare2 if you got pi to be 3.14 or 3.14whatver those numbers were ?

so cavemen methods rule :D
ayman ... shu el fare2 if you got pi to be 3.14 or 3.14whatver those numbers were ?

so cavemen methods rule :D
haha
ayman ... shu el fare2 if you got pi to be 3.14 or 3.14whatver those numbers were ?

so cavemen methods rule
the difference is negligeable when you are making normal calcules, but i don't think that the NASA will program their stuff using PI = 3.14 but PI = 3.14whatever.

got the point ;) ?
LOL good point Samer.. Imagine USA nuking a "sister country" and hitting Lebanon by mistake cos they estimated pi to 3.14 :P