Live data from Hacker News

All Rational Approximations of Pi Are Useless

blog.wolfram.com

41–50 of 113 posts

Re: All Rational Approximations of Pi Are Useless

#41
post #34
post #30

Earlier quoted context omitted.

ln(-1)/sqrt(-1)

The natural log - ln - is not rational, as it is the logarithm with base e . That is, ln(x) answers the question, to what power would we have to raise e in order for it to equal x ?

Two points:

1. As soon as you allow square roots, you allow irrational numbers. (This sqrt(2).)

2. "The natural log - ln - is not rational" is a different statement than "e is irrational". A rational function is one that can be written as the ratio of two polynomials.

Re: All Rational Approximations of Pi Are Useless

#42
post #15

What if you are on embedded hardware and/or can't use floats for some reason?

Use integers, calculate in pennies. So Pi=314 if your internal math is in hundredths or "pennies". Or if you use millimeters instead of meters, pi=3141 What we did 30 years ago on desktops is what embedded hardware still does today... The endless wheel of IT eternally rotates the same concepts back to the top, if you wait long enough.

Another classic is the old hard science error analysis. Lets say you're squaring the radius and multiplying by pi, turns out you need to measure the radius much more accurately than you measure pi, so pi=4 might not be the limiting factor if R is a 8 bit A/D converter and you're not taking full advantage of the entire 8 bit range (so its really a 4 bit a/d or whatever)

Another is systemic effects. Some weird hydraulic PLC thing I was messing with probably 20 years ago basically needed the ratios of areas of circles, and it turns out that any approximation of pi divided by itself always equals 1. The puzzler is for diagnostic purposes they used pi=4 so the numbers kinda made sense in the debugger before the ratio was calculated. I must have thought about that 4 for an hour trying to reverse engineer what they were trying to do before I realized that "4" was their pi approximation and it didn't matter anyway.

Re: All Rational Approximations of Pi Are Useless

#43
post #33
post #31

Earlier quoted context omitted.

((8^(5/4))^(((2/(0-(7+1)))^9)^(3-6))) = 2.718281848685499 ~ e +/- 2.0226453845140213e-08 That was fun. Although I'm having trouble confirming the answer... - Also I'm meant to be packing. http://play.golang.org/p/G_Y5SblSuv for some brute force eval :) Edit: This could be a nice demonstration for a genetic algorithm: A clearly defined fitness function yet an unknown (unknowable?) goal, and a distinct representation o…

You beat me by about 5 orders of magnitude, but it is possible to do better, by another 200000 orders of magnitude or so! :-) Best I've seen is given in this discussion: http://www.reddit.com/r/math/comments/zakqh/using_the_number...

Oh well, I'm sure it would have got there eventually...

Interesting problem nonetheless.

Re: All Rational Approximations of Pi Are Useless

#44
post #38

This is expected behavior. The best fractions are tied to the http://en.wikipedia.org/wiki/Continued_fraction representation of pi. The ones which have a chance of giving you several "free" digits are going to be tied to large terms in the representation. Glancing at http://oeis.org/A001203/b001203.txt gives you a sense that large terms are kind of rare. http://mathworld.wolfram.com/Gauss-KuzminDistribution.html quan…

This also makes sense from data compression theory. If the digits of an irrational / transcendental number share some of the properties of a random string, then you shouldn't be able to compress it. And finding a fractional representation with fewer total digits is a form of data compression.

Re: All Rational Approximations of Pi Are Useless

#46
post #44
post #38

This is expected behavior. The best fractions are tied to the http://en.wikipedia.org/wiki/Continued_fraction representation of pi. The ones which have a chance of giving you several "free" digits are going to be tied to large terms in the representation. Glancing at http://oeis.org/A001203/b001203.txt gives you a sense that large terms are kind of rare. http://mathworld.wolfram.com/Gauss-KuzminDistribution.html quan…

This also makes sense from data compression theory. If the digits of an irrational / transcendental number share some of the properties of a random string, then you shouldn't be able to compress it. And finding a fractional representation with fewer total digits is a form of data compression.

Nitpick: data compression theory says you can't have a general-purpose algorithm that on average compresses random strings. The best any algorithm can do is make some strings shorter and some strings longer, which is why compression is only useful on strings with known properties. But given a particular random finite string (such as N digits of pi) you can very likely (certainly?) find an algorithm that compresses it -- which is why people are able to offer a number of compression algorithms for approximations of pi in the post.

Re: All Rational Approximations of Pi Are Useless

#47
post #14

Earlier quoted context omitted.

I think the point is that McLoone is using two different notations and measuring an artifact of this. There's nothing special about base-10 denominators.

He's comparing apples to apples. Kolmogorov complexity for different ways to approximate п is more or less flat at bang for the buck.

Kolmogorov complexity requires a standard Turing machine to measure -- switching notations isn't allowed. Rational approximations to Pi (or any other irrational number) vary substantially in terms of accuracy/size, which is why many standard libraries include functions for computing convergents.

Re: All Rational Approximations of Pi Are Useless

#48
post #6

Ok, I'm confused, what exactly is the point here? If you don't care, 3.14 is sufficient, if you do care then you use π, and if you really care you use τ[1]. [1]( http://tauday.com/tau-manifesto ) (And if you really really really care, you use a different font then the one HN defaults too.)

The point is that you should just memorize whatever precision decimal you need. There's no shortcut like 22/7 that will magically give you more accuracy and be easy to memorize.

(pi - 22/7) < (pi - 3.14). 22/7 is closer to pi than 3.14.

Re: All Rational Approximations of Pi Are Useless

#49

Agreed 22/7 is the worse. Too much trouble for too little benefit If you need the value of pi to do a hand calculation, 3.14 is more than enough And if you need to "produce" pi just remember pi/4 = 1 - 1/3 + 1/5 - 1/7... (there are formulas that are better, sure, but less memorizable)

>And if you need to "produce" pi just remember pi/4 = 1 - 1/3 + 1/5 - 1/7...

This converges too slowly to be practically useful.

If you group the consecutive terms in pairs you get that the nth pair sums to 1/(2n + 1) - 1/(2n + 3) = (2n+3 - (2n+1))/(2n+1)(2n+3) = 2/(2n+1)(2n+3) = Theta(1/n^2). Thus it has the same asymptotic growth order as sum 1/n^2. That has has monotone terms and so it's easy to estimate how many terms we need to get k correct fractional digits by solving 10^(-k) = 1/n^2, giving n = 10^(k/2).

This is off by a big constant factor but it gives you the right idea that you need an exponential number of terms relative to the desired number of significant digits. From Wikipedia: "After 500,000 terms, it produces only five correct decimal digits of pi."

So, this series for pi has only theoretical relevance.

Re: All Rational Approximations of Pi Are Useless

#50
22/7 is a better approximation of pi than 3.14 because 22/7 is closer to pi than 3.14. The hypothesis of the article is wrong.

I believe Colin [EDIT: I meant Jon McLoone, the author of the article. Sorry Colin!] is counting only full digit matches. It is this metric that is useless.

Post reply on HN