Approximations of π

This page is about the history of approximations of π; see also chronology of computation of π for a tabular summary. See also the history of π for other aspects of the evolution of our knowledge about mathematical properties of π.

Graph showing the historical evolution of the record precision of numerical approximations to pi, measured in decimal places (depicted on a logarithmic scale; time before 1400 is not shown to scale).

Further progress was not made until the 15th century (Jamshīd al-Kāshī). Early modern mathematicians reached an accuracy of 35 digits by the beginning of the 17th century (Ludolph van Ceulen), and 126 digits by the 19th century (Jurij Vega), surpassing the accuracy required for any conceivable application outside of pure mathematics.

The record of manual approximation of π is held by William Shanks, who calculated 527 digits correctly in the years preceding 1873. Since the middle of the 20th century, the approximation of π has been the task of electronic digital computers; as of November 2016[update], the record is 22.4trillion digits.[1] (For a comprehensive account, see chronology of computation of π.)

The best known approximations to π dating to before the Common Era were accurate to two decimal places; this was improved upon in Chinese mathematics in particular by the mid-first millennium, to an accuracy of seven decimal places. After this, no further progress was made until the late medieval period.

Babylonian mathematics usually approximated π to 3, sufficient for the architectural projects of the time (notably also reflected in the description of Solomon's Temple in the Hebrew Bible).[6] The Babylonians were aware that this was an approximation, and one Old Babylonian mathematical tablet excavated near Susa in 1936 (dated to between the 19th and 17th centuries BCE) gives a better approximation of π as 25/8=3.125, about 0.5 percent below the exact value.[7][8][9][10]

Astronomical calculations in the Shatapatha Brahmana (c. 6th century BCE) use a fractional approximation of 339/108 ≈ 3.139.[12]

In the 3rd century BCE, Archimedes proved the sharp inequalities ​223⁄71 < π < ​22⁄7, by means of regular 96-gons (accuracies of 2·10−4 and 4·10−4, respectively).

In the 2nd century CE, Ptolemy, used the value ​377⁄120, the first known approximation accurate to three decimal places (accuracy 2·10−5).[13]

The Chinese mathematicianLiu Hui in 263 CE computed π to between 7000314102400000000♠3.141024 and 7000314270800000000♠3.142708 by inscribing a 96-gon and 192-gon; the average of these two values is 7000314186600000000♠3.141866 (accuracy 9·10−5). He also suggested that 3.14 was a good enough approximation for practical purposes. He has also frequently been credited with a later and more accurate result π ≈ 3927/1250 = 3.1416 (accuracy 2·10−6), although some scholars instead believe that this is due to the later (5th-century) Chinese mathematician Zu Chongzhi.[14] Zu Chongzhi is known to have computed π between 3.1415926 and 3.1415927, which was correct to seven decimal places. He gave two other approximations of π: π ≈ 22/7 and π ≈ 355/113. The latter fraction is the best possible rational approximation of π using fewer than five decimal digits in the numerator and denominator. Zu Chongzhi's result surpasses the accuracy reached in Hellenistic mathematics, and would remain without improvement for close to a millennium.

Comparison of the convergence of two Madhava series (the one with √12 in dark blue) and several historical infinite series for π. Sn is the approximation after taking n terms. Each subsequent subplot magnifies the shaded area horizontally by 10 times. (click for detail)

and used the first 21 terms to compute an approximation of π correct to 11 decimal places as 7000314159265359000♠3.14159265359.

The other method he used was to add a remainder term to the original series of π. He used the remainder term

n2+14n3+5n{\displaystyle {\frac {n^{2}+1}{4n^{3}+5n}}}

in the infinite series expansion of ​π⁄4 to improve the approximation of π to 13 decimal places of accuracy when n = 75.

In the second half of the 16th century, the French mathematician François Viète discovered an infinite product that converged on π known as Viète's formula.

The German-Dutch mathematician Ludolph van Ceulen (circa 1600) computed the first 35 decimal places of π with a 262-gon. He was so proud of this accomplishment that he had them inscribed on his tombstone.[22]

In Cyclometricus (1621), Willebrord Snellius demonstrated that the perimeter of the inscribed polygon converges on the circumference twice as fast as does the perimeter of the corresponding circumscribed polygon. This was proved by Christiaan Huygens in 1654. Snellius was able to obtain seven digits of π from a 96-sided polygon.[23]

In 1789, the Slovene mathematician Jurij Vega calculated the first 140 decimal places for π, of which the first 126 were correct[24] and held the world record for 52 years until 1841, when William Rutherford calculated 208 decimal places, of which the first 152 were correct. Vega improved John Machin's formula from 1706 and his method is still mentioned today.[citation needed]

The magnitude of such precision (152 decimal places) can be put into context by the fact that the circumference of the largest known object, the observable universe, can be calculated from its diameter (93billion light-years) to a precision of less than one Planck length (at 6965161620000000000♠1.6162×10−35meters, the shortest unit of length that has real meaning) using π expressed to just 62 decimal places.

The English amateur mathematician William Shanks, a man of independent means, spent over 20 years calculating π to 707 decimal places. This was accomplished in 1873, with the first 527 places correct. He would calculate new digits all morning and would then spend all afternoon checking his morning's work. This was the longest expansion of π until the advent of the electronic digital computer three-quarters of a century later.[citation needed]

which computes a further eight decimal places of π with each term in the series. His series are now the basis for the fastest algorithms currently used to calculate π. See also Ramanujan–Sato series.

From the mid-20th century onwards, all calculations of π have been done with the help of calculators or computers.

In 1944, D. F. Ferguson, with the aid of a mechanical desk calculator, found that William Shanks had made a mistake in the 528th decimal place, and that all succeeding digits were incorrect.

In the early years of the computer, an expansion of π to 7005100000000000000♠100000 decimal places[25]:78 was computed by Maryland mathematician Daniel Shanks (no relation to the above-mentioned William Shanks) and his team at the United States Naval Research Laboratory in Washington, D.C. In 1961, Shanks and his team used two different power series for calculating the digits of π. For one, it was known that any error would produce a value slightly high, and for the other, it was known that any error would produce a value slightly low. And hence, as long as the two series produced the same digits, there was a very high confidence that they were correct. The first 100,265 digits of π were published in 1962.[25]:80–99 The authors outlined what would be needed to calculate π to 1 million decimal places and concluded that the task was beyond that day's technology, but would be possible in five to seven years.[25]:78

In 1999, Yasumasa Kanada and his team at the University of Tokyo correctly computed π to over 200 billion decimal places on the supercomputer HITACHI SR8000/MPP (128 nodes) using another variation of Ramanujan's infinite series of π. In October 2005, they claimed to have calculated it to 1.24 trillion places.[26]

Records since then have all been accomplished on personal computers using the Chudnovsky algorithm. In 2009, Fabrice Bellard computed just under 2.7 trillion digits, and from 2010 onward, all records have been set using Alexander Yee's y-cruncher software. As of November 2016[update], the record stands at 22,459,157,718,361 (πe×1012) digits.[27] The limitation on further expansion is primarily storage space for the computation.[28]

In November 2002, Yasumasa Kanada and a team of 9 others used the Hitachi SR8000, a 64-node supercomputer with 1 terabyte of main memory, to calculate π to roughly 1.24 trillion digits in around 600 hours.

In August 2009, a Japanese supercomputer called the T2K Open Supercomputer more than doubled the previous record by calculating π to roughly 2.6 trillion digits in approximately 73 hours and 36 minutes.

In December 2009, Fabrice Bellard used a home computer to compute 2.7 trillion decimal digits of π. Calculations were performed in base 2 (binary), then the result was converted to base 10 (decimal). The calculation, conversion, and verification steps took a total of 131 days.[29]

In August 2010, Shigeru Kondo used Alexander Yee's y-cruncher to calculate 5 trillion digits of π. This was the world record for any type of calculation, but significantly it was performed on a home computer built by Kondo.[30] The calculation was done between 4 May and 3 August, with the primary and secondary verifications taking 64 and 66 hours respectively.[31]

In October 2011, Shigeru Kondo broke his own record by computing ten trillion (1013) and fifty digits using the same method but with better hardware.[32][33]

In December 2013, Kondo broke his own record for a second time when he computed 12.1 trillion digits of π.[34]

In October 2014, Sandon Van Ness, going by the pseudonym "houkouonchi" used y-cruncher to calculate 13.3 trillion digits of π.[35]

In November 2016, Peter Trueb and his sponsors computed on y-cruncher and fully verified 22.4 trillion digits of π. The computation took (with three interruptions) 105 days to complete.[36]

Depending on the purpose of a calculation, π can be approximated by using fractions for ease of calculation. The most notable such approximations are ​22⁄7 (accuracy 2·10−4) and ​355⁄113 (accuracy 8·10−8).

Of some notability are legal or historical texts purportedly "defining π" to have some rational value, notably the "Indiana Pi Bill" of 1897, which stated "the ratio of the diameter and circumference is as five-fourths to four" (which would imply "π = 3.2") and a passage in the Hebrew Bible that implies that π=3{\displaystyle \pi =3}.

Rabbi Nehemiah explained this in his Mishnat ha-Middot (the earliest known Hebrew text on geometry, ca. 150 CE) by saying that the diameter was measured from the outside rim while the circumference was measured along the inner rim. This interpretation implies a brim about 0.225 cubit (or, assuming an 18-inch "cubit", some 4 inches), or one and a third "handbreadths," thick (cf. NKJV and NKJV).

Maimonides states (ca. 1168 CE) that π can only be known approximately, so the value 3 was given as accurate enough for religious purposes. This is taken by some[38] as the earliest assertion that π is irrational.

Another rabbinical explanation[by whom?][year needed] invokes gematria: In NKJV the word translated 'measuring line' appears in the Hebrew text spelled QWH קַוה, but elsewhere the word is most usually spelled QW קַו. The ratio of the numerical values of these Hebrew spellings is ​111⁄106. If the putative value of 3 is multiplied by this ratio, one obtains ​333⁄106 = 3.141509433... – giving 5 correct digits, which is within 1/10,000 of the true value of π. For this to work, it must be assumed that the measuring line is different for the diameter and circumference.

There is still some debate on this passage in biblical scholarship.[not in citation given][39][40] Many reconstructions of the basin show a wider brim (or flared lip) extending outward from the bowl itself by several inches to match the description given in NKJV[41] In the succeeding verses, the rim is described as "a handbreadth thick; and the brim thereof was wrought like the brim of a cup, like the flower of a lily: it received and held three thousand baths" NKJV, which suggests a shape that can be encompassed with a string shorter than the total length of the brim, e.g., a Lilium flower or a Teacup.

The so-called "Indiana Pi Bill" of 1897 has often been characterized as an attempt to "legislate the value of Pi". Rather, the bill dealt with a purported solution to the problem of geometrically "squaring the circle".[42]

The bill was nearly passed by the Indiana General Assembly in the U.S., and has been claimed to imply a number of different values for π, although the closest it comes to explicitly asserting one is the wording "the ratio of the diameter and circumference is as five-fourths to four", which would make π = 16/5 = 3.2, a discrepancy of nearly 2 percent. A mathematics professor who happened to be present the day the bill was brought up for consideration in the Senate, after it had passed in the House, helped to stop the passage of the bill on its second reading, after which the assembly thoroughly ridiculed it before tabling it indefinitely.

Archimedes, in his Measurement of a Circle, created the first algorithm for the calculation of π based on the idea that the perimeter of any (convex) polygon inscribed in a circle is less than the circumference of the circle, which, in turn, is less than the perimeter of any circumscribed polygon. He started with inscribed and circumscribed regular hexagons, whose perimeters are readily determined. He then shows how to calculate the perimeters of regular polygons of twice as many sides that are inscribed and circumscribed about the same circle. This is a recursive procedure which would be described today as follows: Let pk and Pk denote the perimeters of regular polygons of k sides that are inscribed and circumscribed about the same circle, respectively. Then,

Archimedes uses this to successively compute P12, p12, P24, p24, P48, p48, P96 and p96.[43] Using these last values he obtains

31071<π<317.{\displaystyle 3{\frac {10}{71}}<\pi <3{\frac {1}{7}}.}

It is not known why Archimedes stopped at a 96-sided polygon; it only takes patience to extend the computations. Heron reports in his Metrica (about 60 CE) that Archimedes continued the computation in a now lost book, but then attributes an incorrect value to him.[44]

Archimedes uses no trigonometry in this computation and the difficulty in applying the method lies in obtaining good approximations for the square roots that are involved. Trigonometry, in the form of a table of chord lengths in a circle, was probably used by Claudius Ptolemy of Alexandria to obtain the value of π given in the Almagest (circa 150 CE).[45]

Advances in the approximation of π (when the methods are known) were made by increasing the number of sides of the polygons used in the computation. A trigonometric improvement by Willebrord Snell (1621) obtains better bounds from a pair of bounds gotten from the polygon method. Thus, more accurate results were obtained from polygons with fewer sides.[46]Viète's formula, published by François Viète in 1593, was derived by Viète using a closely related polygonal method, but with areas rather than perimeters of polygons whose numbers of sides are powers of two.[47]

The last major attempt to compute π by this method was carried out by Grienberger in 1630 who calculated 39 decimal places of π using Snell's refinement.[46]

(Note also that {x,y} = {239, 132} is a solution to the Pell equationx2−2y2 = −1.)

Formulae of this kind are known as Machin-like formulae. Machin's particular formula was used well into the computer era for calculating record numbers of digits of π,[25] but more recently other similar formulae have been used as well.

For instance, Shanks and his team used the following Machin-like formula in 1961 to compute the first 100,000 digits of π:[25]

where f(y)=(1−y4)1/4{\displaystyle f(y)=(1-y^{4})^{1/4}}, the sequence 1/ak{\displaystyle 1/a_{k}}converges quartically to π, giving about 100 digits in three steps and over a trillion digits after 20 steps. However, it is known that using an algorithm such as the Chudnovsky algorithm (which converges linearly) is faster than these iterative formulae.

The first one million digits of π and ​1⁄π are available from Project Gutenberg (see external links below). A former calculation record (December 2002) by Yasumasa Kanada of Tokyo University stood at 1.24 trillion digits, which were computed in September 2002 on a 64-node Hitachisupercomputer with 1 terabyte of main memory, which carries out 2 trillion operations per second, nearly twice as many as the computer used for the previous record (206 billion digits). The following Machin-like formulæ were used for this:

These approximations have so many digits that they are no longer of any practical use, except for testing new supercomputers.[49] Properties like the potential normality of π will always depend on the infinite string of digits on the end, not on any finite computation.

This curious approximation follows the observation that the 193rd power of 1/π yields the sequence 1122211125... Replacing 5 by 2 completes the symmetry without reducing the correct digits of π, while inserting a central decimal point remarkably fixes the accompanying magnitude at 10100.[53]

Based on one found by Daniel Shanks. Similar to the previous two, but this time is a quotient of a modular form, namely the Dedekind eta function, and where the argument involves τ=−3502{\displaystyle \tau ={\sqrt {-3502}}}. The discriminant d = 3502 has h(−d) = 16.

The continued fraction representation of π can be used to generate successive best rational approximations. These approximations are the best possible rational approximations of π relative to the size of their denominators. Here is a list of the first thirteen of these:[55][56]

Of all of these, 355113{\displaystyle {\frac {355}{113}}} is the only fraction in this sequence that gives more exact digits of π (i.e. 7) than the number of digits needed to approximate it (i.e. 6). The accuracy can be improved by using other fractions with larger numerators and denominators, but, for most such fractions, more digits are required in the approximation than correct significant figures achieved in the result.[57]

Numerical approximation of π: as points are randomly scattered inside the unit square, some fall within the unit circle. The fraction of points inside the circle approaches π/4 as points are added.

Pi can be obtained from a circle if its radius and area are known using the relationship:

A=πr2.{\displaystyle A=\pi r^{2}.}

If a circle with radius r is drawn with its center at the point (0, 0), any point whose distance from the origin is less than r will fall inside the circle. The Pythagorean theorem gives the distance from any point (x, y) to the center:

d=x2+y2.{\displaystyle d={\sqrt {x^{2}+y^{2}}}.}

Mathematical "graph paper" is formed by imagining a 1×1 square centered around each cell (x, y), where x and y are integers between −r and r. Squares whose center resides inside or exactly on the border of the circle can then be counted by testing whether, for each cell (x, y),

x2+y2≤r.{\displaystyle {\sqrt {x^{2}+y^{2}}}\leq r.}

The total number of cells satisfying that condition thus approximates the area of the circle, which then can be used to calculate an approximation of π. Closer approximations can be produced by using larger values of r.

In other words, begin by choosing a value for r. Consider all cells (x, y) in which both x and y are integers between −r and r. Starting at 0, add 1 for each cell whose distance to the origin (0,0) is less than or equal to r. When finished, divide the sum, representing the area of a circle of radius r, by r2 to find the approximation of π. For example, if r is 5, then the cells considered are:

(−5,5)

(−4,5)

(−3,5)

(−2,5)

(−1,5)

(0,5)

(1,5)

(2,5)

(3,5)

(4,5)

(5,5)

(−5,4)

(−4,4)

(−3,4)

(−2,4)

(−1,4)

(0,4)

(1,4)

(2,4)

(3,4)

(4,4)

(5,4)

(−5,3)

(−4,3)

(−3,3)

(−2,3)

(−1,3)

(0,3)

(1,3)

(2,3)

(3,3)

(4,3)

(5,3)

(−5,2)

(−4,2)

(−3,2)

(−2,2)

(−1,2)

(0,2)

(1,2)

(2,2)

(3,2)

(4,2)

(5,2)

(−5,1)

(−4,1)

(−3,1)

(−2,1)

(−1,1)

(0,1)

(1,1)

(2,1)

(3,1)

(4,1)

(5,1)

(−5,0)

(−4,0)

(−3,0)

(−2,0)

(−1,0)

(0,0)

(1,0)

(2,0)

(3,0)

(4,0)

(5,0)

(−5,−1)

(−4,−1)

(−3,−1)

(−2,−1)

(−1,−1)

(0,−1)

(1,−1)

(2,−1)

(3,−1)

(4,−1)

(5,−1)

(−5,−2)

(−4,−2)

(−3,−2)

(−2,−2)

(−1,−2)

(0,−2)

(1,−2)

(2,−2)

(3,−2)

(4,−2)

(5,−2)

(−5,−3)

(−4,−3)

(−3,−3)

(−2,−3)

(−1,−3)

(0,−3)

(1,−3)

(2,−3)

(3,−3)

(4,−3)

(5,−3)

(−5,−4)

(−4,−4)

(−3,−4)

(−2,−4)

(−1,−4)

(0,−4)

(1,−4)

(2,−4)

(3,−4)

(4,−4)

(5,−4)

(−5,−5)

(−4,−5)

(−3,−5)

(−2,−5)

(−1,−5)

(0,−5)

(1,−5)

(2,−5)

(3,−5)

(4,−5)

(5,−5)

This circle as it would be drawn on a Cartesian coordinate graph. The cells (±3, ±4) and (±4, ±3) are labeled.

The 12 cells (0, ±5), (±5, 0), (±3, ±4), (±4, ±3) are exactly on the circle, and 69 cells are completely inside, so the approximate area is 81, and π is calculated to be approximately 3.24 because 81 / 52 = 3.24. Results for some values of r are shown in the table below:

is the power series for arctan(x) specialized to x = 1. It converges too slowly to be of practical interest. However, the power series converges much faster for smaller values of x{\displaystyle x}, which leads to formulae where π{\displaystyle \pi } arises as the sum of small angles with rational tangents, known as Machin-like formulae.

The Gauss–Legendre algorithm or Salamin–Brent algorithm was discovered independently by Richard Brent and Eugene Salamin in 1975. This can compute π{\displaystyle \pi } to N{\displaystyle N} digits in time proportional to Nlog⁡(N)log⁡(log⁡(N)){\displaystyle N\,\log(N)\,\log(\log(N))}, much faster than the trigonometric formulae.

The Bailey–Borwein–Plouffe formula (BBP) for calculating π was discovered in 1995 by Simon Plouffe. Using base 16 math, the formula can compute any particular digit of π—returning the hexadecimal value of the digit—without having to compute the intervening digits (digit extraction).[58]

In 1996, Simon Plouffe derived an algorithm to extract the nth decimal digit of π (using base10 math to extract a base10 digit), and which can do so with an improved speed of O(n3(log n)3) time. The algorithm requires virtually no memory for the storage of an array or matrix so the one-millionth digit of π can be computed using a pocket calculator.[59] However, it would be quite tedious and impractical to do so.

This formula permits one to fairly readily compute the kth binary or hexadecimal digit of π, without having to compute the preceding k − 1 digits. Bailey's website[61] contains the derivation as well as implementations in various programming languages. The PiHex project computed 64 bits around the quadrillionth bit of π (which turns out to be 0).

Pi Hex was a project to compute three specific binary digits of π using a distributed network of several hundred computers. In 2000, after two years, the project finished computing the five trillionth (5*1012), the forty trillionth, and the quadrillionth (1015) bits. All three of them turned out to be 0.[citation needed]

Programs designed for calculating π may have better performance than general-purpose mathematical software. They typically implement checkpointing and efficient disk swapping to facilitate extremely long-running and memory-expensive computations.

y-cruncher by Alexander Yee[1] is the program which Shigeru Kondo used to compute the current world record number of digits. y-cruncher can also be used to calculate other constants and holds world records for several of them.

PiFast by Xavier Gourdon was the fastest program for Microsoft Windows in 2003. According to its author, it can compute one million digits in 3.5 seconds on a 2.4 GHz Pentium 4.[63] PiFast can also compute other irrational numbers like e and √2. It can also work at lesser efficiency with very little memory (down to a few tens of megabytes to compute well over a billion (109) digits). This tool is a popular benchmark in the overclocking community. PiFast 4.4 is available from Stu's Pi page. PiFast 4.3 is available from Gourdon's page.

QuickPi by Steve Pagliarulo for Windows is faster than PiFast for runs of under 400 million digits. Version 4.5 is available on Stu's Pi Page below. Like PiFast, QuickPi can also compute other irrational numbers like e, √2, and √3. The software may be obtained from the Pi-Hacks Yahoo! forum, or from Stu's Pi page.

Super PI by Kanada Laboratory[64] in the University of Tokyo is the program for Microsoft Windows for runs from 16,000 to 33,550,000 digits. It can compute one million digits in 40 minutes, two million digits in 90 minutes and four million digits in 220 minutes on a Pentium 90 MHz. Super PI version 1.1 is available from Super PI 1.1 page.

^Based on the Great Pyramid of Giza, supposedly built so that the circle whose radius is equal to the height of the pyramid has a circumference equal to the perimeter of the base (it is 1760 cubits around and 280 cubits in height). Verner, Miroslav. The Pyramids: The Mystery, Culture, and Science of Egypt's Great Monuments. Grove Press. 2001 (1997). ISBN0-8021-3935-3

^David Gilman Romano, Athletics and Mathematics in Archaic Corinth: The Origins of the Greek Stadion, American Philosophical Society, 1993, p. 78. "A group of mathematical clay tablets from the Old Babylonian Period, excavated at Susa in 1936, and published by E.M. Bruins in 1950, provide the information that the Babylonian approximation of π was 3 1/8 or 3.125."

^See also Beckmann 1971, pp. 12, 21–22 "in 1936, a tablet was excavated some 200 miles from Babylon. ... The mentioned tablet, whose translation was partially published only in 1950, ... states that the ratio of the perimeter of a regular hexagon to the circumference of the circumscribed circle equals a number which in modern notation is given by 57/60+36/(60)2 [i.e. π = 3/0.96 = 25/8]".

"Add four to one hundred, multiply by eight and then add sixty-two thousand. The result is approximately the circumference of a circle of diameter twenty thousand. By this rule the relation of the circumference to diameter is given."

^Sandifer, Edward (2007). "Why 140 Digits of Pi Matter"(PDF). Jurij baron Vega in njegov čas: Zbornik ob 250-letnici rojstva [Baron Jurij Vega and His Times: Celebrating 250 Years]. Ljubljana: DMFA. p. 17. ISBN978-961-6137-98-0. LCCN2008467244. OCLC448882242. We should note that Vega's value contains an error in the 127th digit. Vega gives a 4 where there should be an [6], and all digits after that are incorrect.