The formula for pi


By Zhidong Leong (P3545) on Wednesday, January 17, 2001 - 12:27 pm :

May I know the formula for pi?


By James Myatt (Jem50) on Wednesday, January 17, 2001 - 06:32 pm :
pi (p) is the ratio of the diameter of any circle to its diameter.

However if you want to know the value of pi, then that's a different matter. The value of pi can be found by taking sufficient terms of an infinite series. It is possible to obtain a Taylor series expansion of many functions such as tan x, sin x, arctan x, etc. arctan x = x - x3 /3 + x5 /5 - x7 /7 +¼for -1 < x £ 1.

It just so happens that tanp/4 = 1, hence p/4 = arctan 1 = 1 - 1/3 + 1/5 - 1/7 + ¼. By taking a large number of terms then this will converge on p/4 hence you can calculate the value to as much accuracy as you need. However this particular expansion converges very slowly.



Having just done 10000 terms (on my computer), you can be sure of 1 dp after 25 terms, 2dp after 1255, 3dp after 2464, and after 10000 you still don't have 4 dp of accuracy. So as you can see this is a particular series is very inefficient, as the difference between successive terms gets very small very quickly, that is 1/n - 1/(n+1).

There are many much faster algorithms, but I can't remember them, but are often work along similar lines.

If you want to know the value of pi, it's best looked up, and there are a variety of online resources, which can probably be located by sticking "pi" and "value" into any good search engine, such as this one .

Of course, what is pi? I would say pi is the ratio of the diameter of any circle to its diameter, someone else might say the sum of an infinite series, but an engineer or scientist might say pi is 3.14, or a school child might say it's a number that helps them calculate the area of a circle.

James