Questions about pi

“3.14” is enough to accurately estimate the circumference of the universe based the distance you’ve given (your estimate has only 3 significant figures! ;)).

BTW, a good way to obtain best rational approximations for real numbers is by use of Continued fractions.

For instance a couple continued fraction expansions of pi with lengths 2 and 3 give you those first two approximations:

[3;7] = 22/7
[3;7,16] = 355/113

I didn’t care to use enough significant digits of pi to calculate length 5 (If you calculate length 4 it comes out even at the 4th place and gives you [3;7,16] again).

Yup.

Donald Knuth, who more recently has written a serious set of computer manuals, devised the Potrzebie System of Weights and Measures for MAD Magazine in the late 1950s. It includes this sentence (which looks like this, depending how you read it):
“Halvah is a form of pie, 3.1416 and a specific heat.
And it has a specific gravity of of .31416.” :smiley:

Yep, continued fractions are interesting. Pi’s first few terms are:
3, 7, 15, 1, 292, 1, 1, 1, 2, 1, 3, 1, 14, 2, 1, 1, 2, 2, 2, 2, 1, 84, 2, 1, 1, 15, 3 …

Truncating anywhere gives you a good approximation. But the *really *good approximations come from truncating just before a very large term. That 292 is large, and so truncating to [3, 7, 15, 1], which reduces to [3, 7, 16], gives us the 355/113 fraction.

The next term over 10 (an arbitrary threshold I chose) shows that the next good truncation point is at 14, and so the reduced continued fraction becomes [3, 7, 15, 1, 292, 1, 1, 1, 2, 1, 4]. As it happens, that’s the same 5419351/1725033 fraction that I mentioned (and “discovered” by eyeballing the rate of denominator increase).

Next one after that is [3, 7, 15, 1, 292, 1, 1, 1, 2, 1, 3, 1, 14, 2, 1, 1, 2, 2, 2, 3] = 21053343141/6701487259 (stops just before that 84; 22 good digits).

For engineering purposes, we use whatever precision is required by the application.

For most cases, we use a 24-bit significand (single precision) or 53-bit significand (double precision), without even thinking about it, since we rarely need more.

For special purpose applications where we have reason to suspect we might need more accuracy, we do an error analysis to show what the error term is based on the precision of various variables and constants, and choose the appropriate precision to provide the desired resulting precision, using partial differentials or other techniques. I learned how to do this in calc 3, but never applied it in the real world, being a software engineer rather than a real engineer. :slight_smile:

Wouldn’t it be true that pi is not the ratio of circumference to diameter, but rather only an upper limit on that ratio, because of whatever mass is within the circle? There would be a different general relativistic effect on the diameter dimension as opposed to the circumference dimension. Given that pi is available to large numbers of digits from a great many sources, this distinction will often be the limiting one for accuracy if we define pi as circumference over diameter.

I’m not buying this. By definition, the diameter distance is that between two opposing points on the circumference. You’re trying to make it an actual line through the center instead of a virtual one.

I don’t know anything about physics, but it’s certainly true that curvature can lessen the ratio between “The arclength around the locus of points at a fixed straight-line distance from a center” (circumference of a circle) and “The straight-line distance between two opposite points on that locus” (diameter of that circle).

Consider the Earth, where lines of lattitude form circles with the North pole as their center, and twice the distance (along a line of longitude) from the North pole as their diameter. For lines of lattitude close to the North pole, we get ratios close to pi, but as we approach the Equator, we get ratios approaching 2. And then as we approach the South pole but continue to consider the North pole the center, the circumference-to-diameter ratio further approaches 0.

This is the cite I usually toss out for this. Basically the author does some GR calculations to determine how far pi is “off” for circles around the Earth and the Sun due to relativistic effects.

For a circle around the Earth the paper gets that the diameter is 4.4mm larger than its circumference divided by pi, and for a circle around the Sun, the diameter is 4.1km larger than C/pi.

This is a pretty overlooked point. Your answer is only ever as accurate as the least accurate input to the calculation. So the answer to ‘how many digits of pi do you need’ is pretty much always 'one more significant digit than your least accurate measurement. If your software has pi defined to a bunch of digits, sure, why not use them, but they won’t make your answer any more accurate if you’ve only measured the radius of the circle to an accuracy of one part in fifty anyway. And since there are very very few real-world measurements accurate to much more than one part in a thousand or so, 3.1415 is plenty for nearly any calculation.

So, I’m curious, have you ever had an application where you needed more than 53 bits of precision in anything, let alone pi?

Well, we define pi as circumference over diameter of a circle on a flat plane, which we can calculate to arbitrary precision. What’s inaccurate is saying that for a circle in warped space the ratio of the circumference and diameter is going to be exactly pi; depending on the geometry of the curvature, the ratio could be very different.

I once wrote a program that calculated pi to a few million digits, so yes, I needed the extra precision for that :).

There are problems where error can diverge exponentially. Just as a simple example, I had a problem where I wanted to repeatedly (trillions of times) rotate a 2D unit vector around an axis by a specific angle. Using sines/cosines was too expensive, so instead I precomputed a 2x2 matrix that I repeatedly multiplied by. But after many iterations the error diverges and you no longer have a unit vector.

My solution was to renormalize the vector every so often, but I can put that off longer the more precision bits I have. Even so, there’s no number of bits that would be sufficient to last even modest lengths of time without renormalization.

I don’t think I follow you. Space is space, right? There’s only one line between two diametrically opposed points on this circle.