## How do they calculate Pi?

For the discussion of math. Duh.

Moderators: gmalivuk, Moderators General, Prelates

quesman
Posts: 1
Joined: Tue Apr 05, 2011 4:16 am UTC

### How do they calculate Pi?

Hey,
I know that Pi is 3.14159........., but how do they calculate that number? If someone wanted to calculate Pi to a certain decimal place, what equation do they use? I have heard of using 22/7, but I've also heard that it's just a rough estimate. So which is the actual expression that will get you Pi?
Thanks,
-AJ

webby
Posts: 139
Joined: Sat Jul 03, 2010 11:02 am UTC
Location: Sydney, Australia
Contact:

### Re: How do they calculate Pi?

There are lots of different ways to do it.

Archimedes estimated pi by estimating the circumference of a circle and dividing it by its diameter. The circumference of a circle was estimated by calculating the perimeter of two many-sided regular polygons - getting an upper bound from the perimeter of a polygon which completely encloses the circle and a lower bound from one which the circle completely encloses.

Now, we instead use complicated series to approximate pi - http://en.wikipedia.org/wiki/Approximat ... th_century.

sccard1
Posts: 3
Joined: Fri Mar 18, 2011 9:00 pm UTC

### Re: How do they calculate Pi?

There are a whole bunch of ways to compute pi, and there is no set "standard method" to compute pi. One way I have used to estimate pi is to use a Fourier series. Set up a 2-pi periodic Fourier series expansion for f(x)=x. Construct the Fourier series, and set x=pi/2 or pi/4. So the left hand term should be pi/2 or pi/4, then the right hand side should be your Fourier series expansion. Solve for pi and continue expanding. The series should converge, but it converges slowly (i.e after 12 terms or so) and even then it just brackets pi (i.e overshoot, then undershoot). Try that. You might find it to be interesting. I shall warn, a Fourier series can be a pain to construct. If you are unfamiliar with them, look up euler coefficients for Fourier series. It takes time to construct t, but you should be able to plug the resulting expression (solved for pi) into MATLAB and use a for loop to do the computations.

I hope this helps,
sccard1.

z4lis
Posts: 767
Joined: Mon Mar 03, 2008 10:59 pm UTC

### Re: How do they calculate Pi?

Here's a link to a formula to calculate any digit of pi you'd like in base 16: http://en.wikipedia.org/wiki/Bailey%E2% ... fe_formula.
What they (mathematicians) define as interesting depends on their particular field of study; mathematical anaylsts find pain and extreme confusion interesting, whereas geometers are interested in beauty.

Qaanol
The Cheshirest Catamount
Posts: 3069
Joined: Sat May 09, 2009 11:55 pm UTC

### Re: How do they calculate Pi?

quesman wrote:Hey,
I know that Pi is 3.14159........., but how do they calculate that number? If someone wanted to calculate Pi to a certain decimal place, what equation do they use? I have heard of using 22/7, but I've also heard that it's just a rough estimate. So which is the actual expression that will get you Pi?
Thanks,
-AJ

One very simple sum that converges (painfully slowly) to π is
$\pi = \sum_{n = 0}^{\infty}{(-1)^{n}\frac{4}{2n+1}} = \frac{4}{1} - \frac{4}{3} + \frac{4}{5} - \frac{4}{7} + \frac{4}{9} - \frac{4}{11} + \cdots$
For serious calculations of huge numbers of digits, nowadays most such algorithms are based on the work of Ramanujan, as covered in the Wikipedia article linked by webby above.

In between, as for the past few hundred years, a lot of ways to calculate π were based on various properties of the arctangent function, notably that [imath]\arctan\frac{\pi}{4} = 1[/imath]. One particular summation that is rather neat, although still moderately slow to converge, is the sum of reciprocal squares,
$\frac{\pi^2}{6} = \sum_{n = 1}^{\infty}\frac{1}{n^2} = \frac{1}{1^2} + \frac{1}{2^2} + \frac{1}{3^2} + \frac{1}{4^2} + \cdots$
wee free kings

mr-mitch
Posts: 477
Joined: Sun Jul 05, 2009 6:56 pm UTC

### Re: How do they calculate Pi?

Every time I come across this topic, I keep on trying to find elusive proofs that these series actually do converge, but I never seem to be able to find them. Does anyone have any links proofs, for example for the hypogeometric series(ses)?

Dopefish
Posts: 855
Joined: Sun Sep 20, 2009 5:46 am UTC
Location: The Well of Wishes

### Re: How do they calculate Pi?

Qaanol wrote: One particular summation that is rather neat, although still moderately slow to converge, is the sum of reciprocal squares,
$\frac{\pi^2}{6} = \sum_{n = 1}^{\infty}\frac{1}{n^2} = \frac{1}{1^2} + \frac{1}{2^2} + \frac{1}{3^2} + \frac{1}{4^2} + \cdots$

This one, and a number of similar ones can be proven by finding fourier series for things, and then evaulating them at suitable choice of argument. I believe the one above comes from the fourier series of f(t)=t^2 for 0<t<2, and then subbing in t=0 on both sides and doing some rearranging. (Other formulas that give pi that spawn from that same series come from setting t=1, and also if you add the series at t=1 and t=0 and divide by 2, which will cause the even terms to go away.)

lamemaar
Posts: 13
Joined: Wed Dec 29, 2010 9:52 am UTC

### Re: How do they calculate Pi?

Computing [imath]\pi[/imath] in, say, 1000 digits, can be done very quickly using this equation:
$\pi=48 \arctan \frac{1}{18}+32 \arctan \frac{1}{57}-20 \arctan \frac{1}{239}$
where each of these three arctan values is approximated by
$\arctan x = x - \frac{x^3}{3} + \frac{x^5}{5}-\frac{x^7}{7}+\cdots$
I did it some time ago, using a program of my own and getting this result:

3.
1415926535 8979323846 2643383279 5028841971 6939937510
5820974944 5923078164 0628620899 8628034825 3421170679
8214808651 3282306647 0938446095 5058223172 5359408128
4811174502 8410270193 8521105559 6446229489 5493038196
4428810975 6659334461 2847564823 3786783165 2712019091
4564856692 3460348610 4543266482 1339360726 0249141273
7245870066 0631558817 4881520920 9628292540 9171536436
7892590360 0113305305 4882046652 1384146951 9415116094
3305727036 5759591953 0921861173 8193261179 3105118548
0744623799 6274956735 1885752724 8912279381 8301194912
9833673362 4406566430 8602139494 6395224737 1907021798
6094370277 0539217176 2931767523 8467481846 7669405132
0005681271 4526356082 7785771342 7577896091 7363717872
1468440901 2249534301 4654958537 1050792279 6892589235
4201995611 2129021960 8640344181 5981362977 4771309960
5187072113 4999999837 2978049951 0597317328 1609631859
5024459455 3469083026 4252230825 3344685035 2619311881
7101000313 7838752886 5875332083 8142061717 7669147303
5982534904 2875546873 1159562863 8823537875 9375195778
1857780532 1712268066 1300192787 6611195909 2164201989