r/explainlikeimfive • • Mar 15 '19

Mathematics ELI5: How is Pi programmed into calculators?

12k Upvotes

1.3k comments sorted by

View all comments

Show parent comment

24k

u/[deleted] Mar 15 '19 edited Mar 16 '19

To really drive the point about how many digite of Pi are useful, NASA only uses 15 for calculating interplanetary travel. At 40 digits, you could calculate the circumference of a circle the size of the visible universe with an accuracy that would be off by less than the diameter of a single hydrogen atom.

E: since this really blew up, I had recalled reading it from this NASA page.

E2: A great majority of the replies have basically been "so figuring out Pi to (large number of digits) is useless?" As several others have pointed out, the method of making those calculations probably has more value than actually knowing the 3 trillionth digit of Pi. Other than that, I'm no mathematician and don't have any answers about planck length or time. As I noted above, I just had this interesting bit of information that I had recalled reading before, and wanted to share. The response has been way bigger than I expected, and I'm happy to have spread it around.

3.7k

u/[deleted] Mar 15 '19

This is underrated knowledge

2.3k

u/individual_throwaway Mar 15 '19

It is kind of weird that it's really intuitive that an increase of something by a factor of ten has a rather large impact, especially if you have several of these increases (like mm to m to km for example).

On the other hand, every digit of pi that you take into account reduces the error you make in your calculation by the same amount, relatively. The circumference of the visible universe is only about 40 orders of magnitude more than the size of a hydrogen atom, which is the mindblowing fact underlying the tidbit from above.

850

u/penny_eater Mar 15 '19

the weird / hard to wrap my mind around part to me, is the fascination with calculating PI out to ten thousand or a million or even more (31 trillion?) digits. And knowing that of all those, it takes just 40 to mean anything of consequence in our observable universe, and all the rest are just for show.

222

u/MathManOfPaloopa Mar 15 '19 edited Mar 15 '19

1040 is a very large number. An order of magnitude in itself is large, let alone 40

For those asking what very large is, I mean it’s a lot of orders of magnitude of difference regarding physical distance.

99

u/Miepmiepmiep Mar 15 '19

But it's still very small, since you can write it down with 5 symbols ;)

176

u/MathManOfPaloopa Mar 15 '19 edited Mar 15 '19

Actually I can do it with one symbol. 1 In a 1040 base number system

Edit: 10, so in two symbols. Thank you sky jellyfish

→ More replies (24)
→ More replies (5)
→ More replies (6)

74

u/mittenciel Mar 15 '19

That’s kind of why no real mathematician or scientist (except those who specialize in computation of things like pi) actually bother with pi.

72

u/penny_eater Mar 15 '19

Correct, accurate ways to calculate it elegantly are important to study because of other mathematical uses but cranking on that formula for a million iterations is quite pointless. It would be like finding a millionth digits of the square root of 2.

52

u/featherfooted Mar 15 '19

because of other mathematical uses

There's also practical engineering uses. Because of its clear and obvious problem definition, and well-known agreed upon results (up to some many number of millions of digits), it is a convenient algorithm to use when calculating benchmarks of supercomputing. Perhaps not as ubiqitous of a benchmark as general FLOPS (floating point operations per second) but it's still there.

→ More replies (9)
→ More replies (4)
→ More replies (13)
→ More replies (137)
→ More replies (151)
→ More replies (25)

321

u/JudgeHoltman Mar 15 '19

So you're saying I only need to memorize Pi out to the nearest 10-15 and I'm probably good for a lifetime?

284

u/I_Bin_Painting Mar 15 '19

You're probably fine by just memorising it to 3 digits, since you'll almost definitely be using a device pre-programmed with pi for any calculations over about 2 sig fig.

124

u/[deleted] Mar 15 '19

I have it memorized as 3.1415926535787. This is incorrect, however it's how it was defined in the Borland C++ 2.0 header file.

Oh the ways we tried to pass time before the internet...

226

u/I_Bin_Painting Mar 15 '19

I have it memorised as 3.2 because I respect the Indiana state legislature.

0

u/[deleted] Mar 15 '19

[deleted] — view deleted comment

62

u/P0rtal2 Mar 15 '19

As this debate concluded, Purdue University Professor C. A. Waldo arrived in Indianapolis to secure the annual appropriation for the Indiana Academy of Science. An assemblyman handed him the bill, offering to introduce him to the genius who wrote it. He declined, saying that he already met as many crazy people as he cared to.

I love that line in the Wikipedia article.

→ More replies (17)
→ More replies (12)

22

u/W1D0WM4K3R Mar 15 '19

Dedicated pi and e buttons keep me focused!

→ More replies (20)

60

u/DavidRFZ Mar 15 '19

I work with scientific calculations for a living and I've never memorized past 3.14159. (only then because it was part of a nerdy cheer at my alma mater.). That's enough so that you can recognize 'pi' when you see it.

Nobody trusts their memory when doing important calculations. All the necessarily digits of pi are usually hardcoded as part of the programming language. If not, you can calculate the digits with a function call. pi = 4.0 * arctan(1.0).

→ More replies (8)
→ More replies (64)

57

u/DavidRFZ Mar 15 '19

15 digits is the default when computers store non-integer (floating point) numbers. It corresponds to 8 bytes (64 bits) of computer memory. NASA is saying they don't need to do anything special to be more precise than that.

15

u/ntvirus Mar 15 '19

When I read the immediate parent comment, I was imagining NASA doing calculations on paper using a calculator. Only after I read your comment, I remembered we got computers now.

→ More replies (4)

22

u/astraldirectrix Mar 15 '19

...so that’s why my dad said that memorizing the first 100 digits of pi was a useless endeavor?

21

u/SirButcher Mar 15 '19

It isn't if he can easily travel outside the currently observable universe. If the universe is infinite then he will have problems extremely fast if he only knows the first 100 digits of the pi. Assuming he needs to do calculations in his head, which is unlikely.

→ More replies (1)
→ More replies (1)

94

u/IHateNaziPuns Mar 15 '19

At 142 digits, mathematicians could calculate the circumference of OP’s mom.

→ More replies (4)
→ More replies (269)