The constant value pi (π) is so useful in mathematics that it has been given special attention over the years — so much attention, in fact, that we must devote an entire section to it.


What is Pi?


Pi (π) is the ratio of a circle's circumference to its diameter. Because a circle has a circumference equal to πd or 2πr, we can desribe every circle as having a total angle of 2π radians (equal to 360 degrees). Radians is far more useful in mathematics than degrees, because it is based directly on a universal constant (π) and not an arbitrary number as is the degree measurement.


The value of pi can be found everyhere in nature and is used extensively in physics and n-space geometrical systems. Becasue of its usefulness, it has been studied in great detail by virtually every mathematician since it was first discovered by the Greek mathematician Archimedes.



101 Digits of Pi


π ≅ 3.1415926535 8979323846 2643383279 5028841971 6930037510 5820974944 5923078164 0628620899 8628034825 3421170679



A Poem by Michael Keith

A mnemonic poem by Michael Keith (1995) enumerates the digits of pi, where the number of letters in each word represent a digit (note that a word of 10 letters represents a zero digit.) The full poem enumerates the first 740 digits of pi. Many similar poems have been written in this manner. Constained poems of this type have been called "cadaeic" poems, because the letters C.A.D.A.E.I.C. have the letter positions equal to the fist 7 digits of pi. The longest such poem contains the first 4000 digits of pi. The first stanza of Michael Keith's poem specifies the first 42 digits, and makes learning the value of pi easy and fun.



Poe, E. Near A Raven

Midnights so dreary, tired and weary,
Silently pondering volumes extolling all by-now obsolete lore.
During my rather long nap, the weirdest tap!
An ominous vibrating sound disturbing my chamber's antedoor.
"This," I whispered quietly, "I ignore."



Calculating Pi

Several infinite series equations have been discovered that may be used to approximate the value of pi. Several of these series are listed below.

Leonard Euler


\(\frac{\pi^2}{6}=\frac{1}{1^2}+\frac{1}{2^2}+\frac{1}{3^2}+\frac{1}{4^2}+\cdots\) \(=\sum\limits_{k=1}^{\infty} \frac{1}{k^2}\)


Gottfried Leibniz


\(\frac{\pi}{4}=1-\frac{1}{3}+\frac{1}{5}-\frac{1}{7}+\frac{1}{9}+\cdots\) \(=\sum\limits_{k=0}^{\infty} (-1)^k(\frac{1}{2k+1})\)


John Wallis


\(\frac{\pi}{2}=\frac{2}{1}\cdot\frac{2}{3}\cdot\frac{4}{3}\cdot\frac{4}{5}\cdot\frac{6}{5}\cdot\frac{6}{7}\cdot\frac{8}{7}\cdot\frac{8}{9}\cdot\cdots\) \(=\prod\limits_{k=1}^{\infty} \frac{(2k)^2}{(2k-1)(2k+1)}\)


François Viéte (Viéte's Product)


\(\frac{2}{\pi}=(\frac{1}{2}\sqrt{2})\)\((\frac{1}{2}\sqrt{2+\sqrt{2}})\)\((\frac{1}{2}\sqrt{2+\sqrt{2+\sqrt{2}}})\cdots\)


This looks simple enough, but attempting to write a program using this equation can be a bit confusing. In order to simplify it, I came up with the folowing algoritmic notation:


\(\frac{2}{\pi}=\prod\limits_{[T=0]}^{\infty}\frac{T\leftarrow\sqrt{T+2}}{2}\)


Basically, what this says, is to start with a variable T=0, perform the squareroot of T+2 and assign it to T, then divide by 2 and multiply your result with the previous result; repeat until infinity. I put the variable T inside square brackets to denote that is is an independent variable that is not an iteration value as normally designated by a variable under a summation or product. This, of course, is my own notation, but I have found it extremely useful in developing mathematical algorithms.


Liebniz/Gregory


While Gottfried Leibniz is commonly given credit for the infinite series shown above, it was previously known by the Scotch mathematician James Gregory, as the inverse tangent series (Gregory's Series), where the tangent is 1:


where \(tan^{-1}\,x=x-\frac{x^3}{3}+\frac{x^5}{5}-\frac{x^7}{7}+\frac{x^9}{9}\cdots\)\((-1 \le x\le 1)\)

\(\frac{\pi}{4}=tan^{-1}\,1=1-\frac{1}{3}+\frac{1}{5}-\frac{1}{7}+\frac{1}{9}\cdots\)


It is also noteable that this series is easily modified to give \(\frac{\pi}{2}\), \(\pi\), or any other multiple thereof, by simply changing the numerators:


\(\frac{\pi}{2}=2-\frac{2}{3}+\frac{2}{5}-\frac{2}{7}+\frac{2}{9}\cdots\)

\(\pi=4-\frac{4}{3}+\frac{4}{5}-\frac{4}{7}+\frac{4}{9}\cdots\)


A simplified version of this in my own algorithmic notation looks like this:


\(\pi=\sum\limits_{k=0,\,[n=3]}^{\infty}\frac{8}{n\leftarrow 32k+n}\)


Each iteration of this algorithm is extremely fast and is quite simple to code:
 1) Let \(k=0\) and \(n=3\).
 2) Perform \(32k+n\) and assign this value to \(n\).
 3) Divide \(8\) by the result of step 2 (divide by new value of \(n\)) and add this result to the sum.
 4) Increment \(k\) and go back to step 2.

Of course, some logic needs to be added to either terminate after some number of iterations or when some amount of precision is reached.


I have also come up the the following equations based on this series:


\(\pi=\sum\limits_{k=0}^{\infty}\frac{8}{16k^2+16k+3}\)

\(\pi=\sum\limits_{k=0}^{\infty}\frac{8}{(4k+1)(4k+3)}\)

\(\pi=\sum\limits_{k=0}^{\infty}\big(\frac{4}{4k+1}-\frac{4}{4k+3}\big)\)

\(\pi=\frac{1}{2}\sum\limits_{k=0}^{\infty}\frac{1}{(k+\frac{3}{4})(k+\frac{1}{4})}\)




Constants: Introduction Constants: Phi (Φ)