What is the formula for "pi"?

What formula or algorithm do they use to calcualte pi? And, how do they know that it is the correct formula to calculate that IS how many times the diameter of a given circle would wrap around its circumference? Maybe the model is wrong!

I can’t answer any better than this (re: how it’s calculated). In particular, look at this section in the article.

A friend and I once wondered the same thing - so we decided to figure out how to do it without any help. The method we came up with is to approximate a circle with a polygon. Then you can calculate the circumference by multiplying the length of each side times the number of sides. You can then get arbitrarily close to pi by making the number of sides arbitrarily large. This method always overestimates the size of pi. If you do the same thing with an inscribed polygon, you can approach pi from the other side, which lets you converge on the actual value of pi faster.

Archimedes beat you to this by about 2,000 years, but that’s still worth a congrats!

That’s exactly how Archimedes did it. (You are probably not as smart as he is, though, because it took you like 2500 years more than him to figure it out.)

One way to calculate pi to an arbitrary precision is to calculate the following infinite series:

4 - ( 4/3 ) + ( 4/5 ) - ( 4/7 ) + ( 4/9 ) - ( 4/11 ) …

Keep going and you get closer and closer to pi. This method is not particularly efficient, and it doesn’t tell you how many digits are correct and where the incorrect digits begin. There are methods for calculating a given digit of pi, but I don’t know them.

More generally, since Pi is irrational no single operation can give it’s exact value. However there are proofs that certain infinite series have Pi as their limit, and by extension algorithms that involve iteration (taking the result you’ve reached so far and running it through the algorithm again) converge on Pi. How useful a formula is for generating Pi is another matter: some are very inefficient, taking a huge number of steps before reaching even a rough approximation of Pi.

Maybe because if the formula weren’t correct, wheels wouldn’t be round. :smack:

I hate it when I invent or discover something and it turns out someone invented/discovered it thousands of years before I did.

Lemme tell you about this named Prometheus…

Pi = c/d, where c is the circumference of a circle of diameter d. Bettr than that by formula you cannot do, since it’s an irrational (“transcendental”) number.

For elegance, revise friedo’s approximation to begin with 4**/1** - 4/3 + 4/5… Is there a logical reason why a sequence of adding and subtraacting 4 divided by consecutive odd digits approximates pi so closely?

Yeah, well, he probably didn’t have a public school education, either. :smiley:

C’mon, it isn’t that dumb of a question. Jinx is essentially confused about how we can prove that a specific formula yields pi if we are using it to compute digits of pi we’ve never seen before.


Actually, “irrational” and “transcendental” are two different ideas (though the latter is a subset of the former). “Irrational” means the number can’t be written as a quotient of two integers, while “transcendental” means the number is not a zero of a polynomial with integer coefficients. For example, the square root of 2 is irrational, but not transcendental.

As for that specific series, the idea is this:

There’s a power series expansion for the function 1/(1-x):

1 / (1 - x) = 1+x+x^2+x^3+x^4+…

Now substitute x with -u^2:

1 / (1 + u^2) = 1 - u^2 + u^4 - u^6 + u^8 - u^10 + …

Now integrate both sides with respect to u. The left hand side is arctan(u). We’ll do the right hand side by the power rule:

arctan(u) = u - u^3/3 + u^5/5 - u^7/7 + …

Now set u=1. Plugging in gives:

pi/4 = 1 - 1/3 + 1/5 - 1/7 + …

Multiply by 4 and you’re done.

(Of course, this brushes over a few things such as questions of convergence and worrying about the constant of integration, but that’s the basic idea).

22/7 is a close approximation of the ratio of a circle’s circumference to its diameter.

It’s what I used in applied math for engineering and construction calculations.

it’s accurate to two decimal places (3.14).

This article is easy to read and informative.

I’ve never used that approximation because, quite without meaning to, I memorized it to five places (3.14159) at a young age and I’ve always been able to use that.

Exapno Mapcase, isn’t it usually considered good form to answer questions before getting into the stupid jokes?

A quicker algorithm to find pi is the following:

Let x[sub]1[/sub]=2, or some other number close to pi. Set your calculator to radians mode.

Then let:


x[sub]2[/sub] will be a closer approximation to pi than x[sub]1[/sub] was.

Then repeating that:


will get you closer and closer to pi, very quickly.

If the number you start with is not pi/2 <= x[sub]1[/sub] <= 3pi/2, this process will converge to the nearest multiple of pi.

This is basically using Newton’s Method, which states: Given a function ƒ(x) and its derivative ƒ '(x), we begin with a first guess x[sub]1[/sub]. Provided the function is reasonably well-behaved, a better approximation than x[sub]1[/sub] is

x[sub]2[/sub]=x[sub]1[/sub]-ƒ(x[sub]1[/sub])/ƒ '(x[sub]1[/sub])

or more generally:

x[sub]n+1[/sub]=x[sub]n[/sub]-ƒ(x[sub]n[/sub])/ƒ '(x[sub]n[/sub])

This is repeated until a sufficiently accurate value is reached.

In my example, I’m basically finding a root of ƒ(x) = sin(x), which equals 0 at all integral multiples of pi. And since ƒ '(x)=cos(x), I replaced the ratio of sine and cosine with tan(x).

Surprisingly, there is also a formula that allows you to compute the n-th (base 16 or base 2) digit of pi without having to compute any of the previous digits. It’s called the BBP formula after its inventors, Bailey, Borwein, and Plouffe. Here is a PDF that goes into some detail about this miraculous algorithm.

Well, how about if you calculate pi empirically? You’d have to agree (I think) it would be pretty convincing if the value of pi emerged from an “experiment” (even if, as strongly suspected, Buffon cheated).

With that (hopefully) intriguing introduction, I strongly suggest you look here and then here. For sure, don’t skip that second link and the applet demo therein at the bottom of the page. Definitely worth your time.