Associated Topics || Dr. Math Home || Search Dr. Math

### How Pi is Calculated

```
Date: 08/07/97 at 07:42:58
From: Krono
Subject: How pi is calculated

If pi is calculated by the circumference of a circle divided by its
radius, how can computers generate pi to billions of decimal places?
Do they draw really accurate circles or what? Is there a
straightforward function (eg. log, polynomial, trigfunction,
exponential) to derive pi to, say, 20 places?
```

```
Date: 08/07/97 at 08:33:10
From: Doctor Wilkinson
Subject: Re: How pi is calculated

No, nobody calculates pi by measuring circles.

There are thousands of formulas, some simple, some very sophisticated,
that can be used. The simplest of these, which can be derived using
elementary calculus, comes from the series for the arctan function,
namely

arctan(x) = x - x^3/3 + x^5/5 - x^7/7 +-...

from which (by letting x = 1) you get

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

Unfortunately, this series is useless for computing pi with any degree
of accuracy. You would need billions of terms just to get your 20
decimal places. But similar formulas involving the arctan can also be
derived which converge much more rapidly. The best known of these is
called Machin's formula, which says

pi/4 = 4 * arctan(1/5) - arctan(1/239)

If you use the series above for these arctans, you can get quite good
approximations to pi fairly easily.

Much more powerful methods have been discovered, and pi has been
see  http://www.cecm.sfu.ca/pi/

And for more about pi and links to other sites on the Web, see the Dr.
Math FAQ:

http://mathforum.org/dr.math/faq/faq.pi.html

-Doctor Wilkinson,  The Math Forum
Check out our web site!  http://mathforum.org/dr.math/
```
Associated Topics:
High School Transcendental Numbers

Search the Dr. Math Library:

 Find items containing (put spaces between keywords):   Click only once for faster results: [ Choose "whole words" when searching for a word like age.] all keywords, in any order at least one, that exact phrase parts of words whole words

Submit your own question to Dr. Math
Math Forum Home || Math Library || Quick Reference || Math Forum Search