Value Of Pi

The ValueOfPi is irrational (more specifically, transcendental); what follows are either approximations or infinite expressions.

Here, have some digits:

One should memorize the first fifty decimal places. In doing so, it may help to notice the repetition of the consecutive digit pairs '79', '32, and '38'.

BuckminsterFuller was standing a watch at the stern of an aircraft carrier in the second world war. He got to watching the churning wake and traced it all the way to the calm horizon. "What makes that wake?" he asked himself. "Bubbles," he answered himself, "tiny, perfectly round air bubbles. But how many? More than I can count. And each one as near perfectly round as I can imagine. Now to make something round, I'd have to multiply by Pi, which is a transcendental number defined to an infinite number of decimal places. Imagine Pi used to make each of those uncountable bubbles, just for me to see this wake. I don't believe it. I don't believe nature uses Pi!"

So how come we do?

Of course nature doesn't use pi! Nature consists strictly of electrons, protons, and neutrons forming atoms and molecules, which then interact with each other. Those bubbles that in that wake that BuckminsterFuller reference? They are made up of water molecules and air molecules, churned together by iron or aluminum molecules. Nature doesn't need pi, because nature just is. We, however, use mathematics and physics to understand the world around us; if we were to measure each of those bubbles, we would find pi each and every time! That, and pi arises in all sorts of places in mathematics that don't even involve circles! While I have a lot of respect for BuckminsterFuller, he can display a certain amount of "crankiness" every now and then...--Alpheus
Seriously, it does make sense to define "pi" as a defined constant - not because it changes, but because it's tricky to determine the proper source code representation that will give the most accurate value for the number. That's why Java and JavaScript have Math.PI and Math.E final member variables, and FoxPro has the PI() function.

Depending on how you interpret the manual, perhaps they were giving a facetious explanation of a good design pattern (using constants for special values); or perhaps the number genuinely was going to change (slightly) depending on what floating-point hardware it was compiled for.

Just putting an excessive number of digits in the "#define" is not the best strategy, because it doesn't ensure that the number is rounded to the most accurate binary floating point representation.

From GNU's math.h header file (line 309 of 354):
    #define M_PI    3.14159265358979323846
From /usr/include/math.h on the same system (IBM AIX RS6000):
    #define M_PI    3.14159265358979323846264338327950288
-- JeffGrigg

I read of the fraction 355/113, which is very easy to remember, and produces 3.1415929... in other words accurate to 6, almost 7 decimal places. I find this easy to remember and type in, and more fun than the decimal digits. I rarely need 6 decimal places in my calculations, so the fun factor wins :-) -- AlistairCockburn

You can also use 4 * arctan(1.0) (everything in radians). -- ChanningWalton

See for other approximations.

I am confused about this page of approximations. What is the point of approximations that involve the use of trig functions such as tan, when 4.arctan(1) is exact? I understand that approximations like 355/113 might be useful in some places but if trig functions are available you might as well use a formula that yields an exact result. -- ChanningWalton

Mathematicians have attempted for years to find approximations of pi that are "simpler" than merely writing down hundreds of digits.

I agree it is useless to use trig functions to calculate values that are only good to 4 or 5 digits rather than using 355/113 which is good to 6 digits or 4*arctan(1) which is going to be within a bit of the best you can get on a fixed-word-length computer.

When calculating trig functions by hand, one calculates a series of terms until one reaches "enough" accuracy. One soon finds that calculating values of arctan(x) to 20 significant digits (or however many digits you are interested in) takes a lot less work when x is close to zero -- in particular, rather than calculating

pi/4 = arctan(1),

it would take a lot less work to compute

pi/4 = 4*arctan(1/5) - arctan(1/239) (Machin's formula)

to any particular number of digits. Both are exact formulas.

(part of ) for many other exact formulas.

PI is irrational - it would take infinitely long to compute this 'exact result' in base 2 (or any particular base), and it would take infinitely many bits of precision to store it. In practice you're going to be using *some* approximation, whether it's 355/113 or some other one giving you more accuracy.

PiEqualsThree, for small values of Pi, or large values of 3. -- QuentinStaffordFraser

Can't provide a reference to validate this, but I read somewhere long ago that the state legislature of a mid-western state legally defined pi as 3.14. -- KielHodges

Kiel, just found a reference...

Indiana House Bill #246 was introduced on 18 January 1897, and referred to the Committee on Canals "midst general cheerfulness." The text states, "the ratio of the diameter and circumference is as five-fourths to four", which makes pi 3.2 (not 3), but there are internal contradictions in the bill as well as contradictions with reality. The author was a mathematical crank. The bill was passed by the state House on 5 February, but indefinitely tabled by the state Senate, in part thanks to the fortuitous presence on other business of a Purdue professor of mathematics.

For details, including an annotated text of the bill, read the article by D. Singmaster in "The Mathematical Intelligencer" v7 #2, pp 69-72.

"Pi through the ages"

discusses the history of people attempting to calculate pi, including ArchimedesOfSyracuse (287-212 BC). Gives a full modernized version of Archimedes's proof, and other equations.

"a few people were silly enough to devote vast amounts of time and effort to this tedious and wholly useless pursuit."

I believe in Kansas, PiEqualsThree.

For machinists, pi is 4 when they calculate the RPMs to cut a given metal using a lathe or a mill; of course, this approximation works out, in part, because lathes generally only give you a selection of RPMs you can choose from, so it's generally impossible to choose an exact RPM. (Having said that, I have no idea why "4" was chosen over "3". Perhaps because it's easier to double and then double again a number in your head, rather than triple it...)
You can find that paper and many others in Pi: A Source Book, edited by Lennart Berggren, Jonathan Borwein, and Peter Borwein, published by Springer-Verlag (August 1997), ISBN 0387949240 . Look for van der Poorten's paper, A Proof that Euler Missed... Ap�ry's Proof of the Irrationality of $\zeta(3)$, there for one of the most amusing true mathematical stories of all time.

Also, see History of Pi, by Petr Beckman, published by St. Martin's Press (August 1976), ISBN 0312381859 . It is a very opinionated view of pi, mathematicians, and politics. It's fun to read, and is quite reminiscent of WikiStyle.

Has anyone gotten to the circle bitmap yet? ;)

Doesn't the ValueOfPi change in a strong gravitational field?


I think that deserves a little amplification. The following is a little picky, but there are no surprises so it can be read fairly quickly.

The usual definition of Pi is "the ratio of a circle's diameter to its circumference". This assumes that we know what a circle is, what the diameter of a circle is, and what the circumference of a circle is. It also assumes that the ratio is the same for all sizes and positions of circles.

Let's assume we know what a point is, and define a straight line as being the path taken by a ray of light. Let's also assume we know what distance is, or at least, let's assume that we can compare distances. We can now define a circle of radius R centered at O as being all the points whose distance from O is R. The diameter D can now be defined as twice the radius.

Defining what we really mean by the circumference is tricky and I'll ignore that for now.

In Euclidean geometry, which is the best model we have for small pieces of space, or for large pieces of space without gravitational fields, we find that the ratio of the diameter to the circumference is the same for all circles no matter how big they are and no matter where they are. However, in hyperbolic geometries, which give the best models for space in a gravitational field, we find that the ratio increases as our circles get bigger, and it also depends on where you are in the gravitational field. In other words, the original definition of Pi doesn't give a constant, it gives a value that depends on the circle chosen. The same is true of elliptic geometries (good models of the surface of a sphere, for example), except that the ratio gets smaller as the circle gets bigger.

In both cases, however, provided the space is smooth there is a well-defined number that arises. For every point, take a succession of circles that get ever smaller (without bound) and take the ratios. The result is an infinite sequence of numbers, and the amazing thing is that every time you do this the sequence converges to a limit.

That limit is always Pi.

That's why we say that the value of Pi doesn't change in gravitational fields, or in other geometries in general. The only definition that makes sense in those cases gives the same value.

If the space in question isn't smooth at certain points, the ratio can be different. Don't mind whether such points occur in spacetime. The thing about pi is that although it originally arose as a geometric constant, we now find that it is intrinsic to the real numbers. It is, for instance, half the period of exp(ix), (6/1 + 6/4 + 6/9 + ...)^(1/2), and so forth - all sorts of expressions that don't involve geometry can be made.

There are some very interesting expressions for deriving pi. Here are some:

Viete's infinite product:

Let A = sqrt(1/2) then

2/PI = A.sqrt((1 + A)/2).sqrt((sqrt((1 + A)/2))).sqrt(etc)...

(write it out to see the beauty of it)

Wallis' infinite product:

 PI   2 x 2 x 4 x 4 x 6 x 6 x ... 
 -- = ---------------------------
 2    1 x 3 x 3 x 5 x 5 x 7 x ...

2 x 2 x 4 x 4 x 6 x 6 x ... = --------------------------- 3 x 3 x 5 x 5 x 7 x ...
(If you shift the entire lower row over in the second fraction, the number of factors shown should be unchanged so as to preserve the pattern.)

Leibniz's series (GottfriedWilhelmLeibniz)

 PI     1       1       1
 -- = ----- + ----- + ------ + ...
 8    1 x 3   5 x 7   9 x 11

-- ChanningWalton

From a mad attempt to scrape extra marks from a physics exam I did years ago after forgetting my calculator... pi squared is approximately g (in m/s^2) - BrianEwins

Now that's bizarre!

Not really, there are similar coincidences all over the place. e^3 is more-or-less 20 (0.4% error), the speed of light is about 1 foot per nanosecond (1.6% error), sound travels roughly a million times slower than light (air pressure dependent), 1 atmosphere of pressure is around 10 N/cm^2, and so on.

To within half a percent, pi seconds is a nanocentury...

Sun light takes 8 minutes to arrive to the earth surface. Light would surround earth 7 times in a second... Small world...

The Washington Park station on the PortlandOregon light rail system is (unlike all other stops in the system) located underground (in fact, it's the deepest subway station in the UnitedStates--the line tunnels under the West Hills rather than attempt to climb the 6% grade that the nearby freeway uses to get over them). The architects decided, for some reason, to give this station a "science" theme, which includes a big granite statue with the first 100 or so digits of pi.

Except that they got one of the digits wrong.

AFAIK, the wrong representation of pi is still there - it being too expensive to replace the statue with a mathematically-correct one.

What precision of Pi is absolutely necessary? I seem to recall that something like 10 digits is enough to actually measure the circumference of a circle the size of Earth to the nearest millimeter.

Well then, if you need 1 millimeter resolution to measure earth sized bodies, ten digits is the answer. If you need to know if 3*Pi is greater or less than 9, one decimal place is the answer.

61 digits is enough to calculate the circumference of the observable universe to within the PlanckLength. You can compute this through fairly simple order-of-magnitude approximation:

 Planck length ~= 10^-35 meters
 Speed of light ~= 10^16 meters/year
 Age of universe ~= 10^10 years

Multiply them together and you get about 10^61. Give it an extra digit or so to take care of constant factors.

If you're willing to ignore the 20 orders of magnitude between the diameter of a proton and the Planck length, you can get away with 40 or so digits.

In silicon crystals, the Si atoms are spaced about 0.117 nm apart. Earth has a circumference of 40 Megameters (by the original definition of "meter"). So if you need atomic-scale resolution of earth sized bodies, 18 decimal digits is enough.

"the roundest object in the world":
Some mnemonics for remembering the digits are available at

The poem below, which bears an uncanny similarity to a certain famous poem by Edgar Allen Poe, is my latest and most difficult attempt at constrained writing. Constrained writing is the art of constructing a work of prose or poetry that obeys some artificially-imposed constraint. For example, there are two published novels from which the letter 'e' is absent - Gadsby, by Ernest Vincent Wright (1938), and La Disparition by George Perec (still in print, and even available in a very recent English translation (A Void, translated by Gilbert Adair) that also obeys the constraint!).

Your mission, should you decide to accept it, is to figure out the constraint imposed on this poem. The answer is given after the end, so if you want to try to figure it out, just look at the beginning of the poem.

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".

Perfectly, the intellect remembers: the ghostly fires, a glittering ember. Inflamed by lightning's outbursts, windows cast penumbras upon this floor. Sorrowful, as one mistreated, unhappy thoughts I heeded: That inimitable lesson in elegance - Lenore - Is delighting, exciting...nevermore.

Ominously, curtains parted (my serenity outsmarted), And fear overcame my being - the fear of "forevermore". Fearful foreboding abided, selfish sentiment confided, As I said, "Methinks mysterious traveler knocks afore. A man is visiting, of age threescore."

Taking little time, briskly addressing something: "Sir," (robustly) "Tell what source originates clamorous noise afore? Disturbing sleep unkindly, is it you a-tapping, so slyly? Why, devil incarnate!--" Here completely unveiled I my antedoor-- Just darkness, I ascertained - nothing more.

While surrounded by darkness then, I persevered to clearly comprehend. I perceived the weirdest dream...of everlasting "nevermores". Quite, quite, quick nocturnal doubts fled - such relief! - as my intellect said, (Desiring, imagining still) that perchance the apparition was uttering a whispered "Lenore". This only, as evermore.

Silently, I reinforced, remaining anxious, quite scared, afraid, While intrusive tap did then come thrice - O, so stronger than sounded afore. "Surely" (said silently) "it was the banging, clanging window lattice." Glancing out, I quaked, upset by horrors hereinbefore, Perceiving: a "nevermore".

Completely disturbed, I said, "Utter, please, what prevails ahead. Repose, relief, cessation, or but more dreary 'nevermores'?" The bird intruded thence - O, irritation ever since! - Then sat on Pallas' pallid bust, watching me (I sat not, therefore), And stated "nevermores".

Bemused by raven's dissonance, my soul exclaimed, "I seek intelligence; Explain thy purpose, or soon cease intoning forlorn 'nevermores'!" "Nevermores", winged corvus proclaimed - thusly was a raven named? Actually maintain a surname, upon Pluvious seashore? I heard an oppressive "nevermore".

My sentiments extremely pained, to perceive an utterance so plain, Most interested, mystified, a meaning I hoped for. "Surely," said the raven's watcher, "separate discourse is wiser. Therefore, liberation I'll obtain, retreating heretofore - Eliminating all the 'nevermores' ".

Still, the detestable raven just remained, unmoving, on sculptured bust. Always saying "never" (by a red chamber's door). A poor, tender heartache maven - a sorrowful bird - a raven! O, I wished thoroughly, forthwith, that he'd fly heretofore. Still sitting, he recited "nevermores".

The raven's dirge induced alarm - "nevermore" quite wearisome. I meditated: "Might its utterances summarize of a calamity before?" O, a sadness was manifest - a sorrowful cry of unrest; "O," I thought sincerely, "it's a melancholy great - furthermore, Removing doubt, this explains 'nevermores' ".

Seizing just that moment to sit - closely, carefully, advancing beside it, Sinking down, intrigued, where velvet cushion lay afore. A creature, midnight-black, watched there - it studied my soul, unawares. Wherefore, explanations my insight entreated for. Silently, I pondered the "nevermores".

"Disentangle, nefarious bird! Disengage - I am disturbed!" Intently its eye burned, raising the cry within my core. "That delectable Lenore - whose velvet pillow this was, heretofore, Departed thence, unsettling my consciousness therefore. She's returning - that maiden - aye, nevermore."

Since, to me, that thought was madness, I renounced continuing sadness. Continuing on, I soundly, adamantly forswore: "Wretch," (addressing blackbird only) "fly swiftly - emancipate me!"

"Respite, respite, detestable raven - and discharge me, I implore!" A ghostly answer of: "nevermore".

" 'Tis a prophet? Wraith? Strange devil? Or the ultimate evil?" "Answer, tempter-sent creature!", I inquired, like before. "Forlorn, though firmly undaunted, with 'nevermores' quite indoctrinated, Is everything depressing, generating great sorrow evermore? I am subdued!", I then swore.

In answer, the raven turned - relentless distress it spurned. "Comfort, surcease, quiet, silence!" - pleaded I for. "Will my (abusive raven!) sorrows persist unabated? Nevermore Lenore respondeth?", adamantly I encored. The appeal was ignored.

"O, satanic inferno's denizen -- go!", I said boldly, standing then.

"Take henceforth loathsome "nevermores" - O, to an ugly Plutonian shore! Let nary one expression, O bird, remain still here, replacing mirth.

Promptly leave and retreat!", I resolutely swore. Blackbird's riposte: "nevermore".

So he sitteth, observing always, perching ominously on these doorways. Squatting on the stony bust so untroubled, O therefore. Suffering stark raven's conversings, so I am condemned, subserving, To a nightmare cursed, containing miseries galore. Thus henceforth, I'll rise (from a darkness, a grave) -- nevermore!

-- Original: E. Poe -- Redone by measuring circles.


Despite the rather difficult constraint (to be revealed shortly), observe how this revised version of "The Raven" duplicates the story, tone, and rhyme scheme of the original fairly closely (including the internal rhymes in the first and third line of each stanza). The only major concession to the form is that the original has six lines per stanza, with the fourth and fifth lines usually being very similar. Due to the nature of the constraint I imposed (revealed in the next paragraph), this would have been nearly impossible to do. Therefore, this version eliminates the similar line in each stanza.

Give up? Hint: Start at the very beginning (with the word 'Poe') and write next to each word the number of letters it contains. Put a decimal point after the first digit. Look at the first few digits (or more if, like me, you know the first several hundred by heart). Are you impressed yet?

Even given the rather difficult constraint, I was able to match the original very closely in spots. The very first line, although its meter is wrong, is surprisingly close. Others which are very close, even to the point of using many of the same words, are stanza 4 line 5, stanza 6 line 3, stanza 7 line 4, and stanza 15, line 1.

Note the use of the term "blackbird" a couple of times. Though not, strictly speaking, correct (a raven is a black bird, not a blackbird), the term is particularly appropriate. It is a subtle reference to George Perec's La Disparition, which contains another written-with-constraints version of "The Raven" - in this case the constraint being "write it in French without using the letter 'e'". In the English translation of La Disparition by Gilbert Adair, the poem is faithfully translated into English, also without using letter 'e'. The English version of the poem is titled (wait for it...) Black Bird!

The poem encodes the first 740 decimals of pi. The encoding rule is this: a word of N letters represents the digit N if N<9, the digit 0 if N=10, and two adjacent digits if N>10 (e.g., a 12-letter word represents the digit '1' followed by '2').

And lest we forget, pi^4 + pi^5 = e^6

hmmm, so how does that happen ?!?

(well, approximately. Still kind of weird though)

Ahem? Have we all forgotten XkCd? 19.9 < e^pi - pi < 20

See also: RationalApproximationsOfPi, ContinuedFractions, FindMeaCircle

View edit of December 2, 2013 or FindPage with title or text search