Live data from Hacker News

All Rational Approximations of Pi Are Useless

blog.wolfram.com

61–70 of 113 posts

Re: All Rational Approximations of Pi Are Useless

#61
post #59

Earlier quoted context omitted.

I'm confused - he's addressing the point made in the article by Ed Pegg that things are interseting if you allow log and sqrt . Surely that means he's allowed to use log and sqrt , and in particular, to use them in rational expressions. So I don't really understand what your point is.

The point of the exercise is to find a short approximation of pi, no? If you allow the use of e, then you can define pi . What he wrote is not an approximation, it is pi. Surely at that point you've defeated the point of the exercise.

This is more-or-less my point.

Once you allow sqrt and ln (or sqrt, log, and e) the problem is silly. He explicitly allows, see the bottom of the article, sqrt, log, and irrational numbers.

Re: All Rational Approximations of Pi Are Useless

#62

I don't like how he's measuring accuracy, here. Something that produces (3.149) is treated as closer than (3.139). 22/7 looks marginally better, if we compare actual error. It's the same number of characters as 3.14, but about 20% less error. 355/113, meanwhile, is not only better than 3.14159 (same number of characters) but actually even better than 3.141592 (about 60% less error). It's also easier to remember, due…

Yes, Jon's metric for measuring the value of an approximation is wrong and so is his conclusion.

Re: All Rational Approximations of Pi Are Useless

#63
post #27

Earlier quoted context omitted.

How fast can you do 22 * 7 in your head? I get a lot of mileage out of simply approximating pi=3, and optionally adding in a factor of 10% later. For your example, I know 7^2=49 immediately, which I round to 50, 50 * 3=150 which is fairly close to 153.938. (Use more digits of pi!) I can quickly improve my estimate by adding 4.9. (Edit: It's also fairly trivial to get even better estimates quickly from here, but at th…

> optionally adding in a factor of 10% later You're better off not adding anything. If you could add 5% instead, then you'd be much better still.

Ideally you add 14%. Why do you say 5% (or nothing) is better than 10%?

Re: All Rational Approximations of Pi Are Useless

#64
post #46
post #44

Earlier quoted context omitted.

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…

A simple way to look at it is kind of like the pigeon hole principle. If you imagine a binary string of length N. Then there are 2^N possible strings. To be losslessly compressed a string must be mapped uniquely to a string of length of at most 2^N - 1. So trivially, there are not enough strings to losslessly compress a binary string of length N to.

But it is acceptable to talk about compression in terms of Kolmogorov Complexity - roughly, if the shortest program which outputs a particular string is shorter than the length of the string then we have compression. Of course one can also show that KC does not compress most strings by much.

But KC is more interesting than say an entropy coding algorithm for infinite (or big finite) strings which possess a lot of structure, PI say (which by the way is by definition not a random string). The expressed program will be far smaller by far, yielding an impressive compression of the sequence.

Re: All Rational Approximations of Pi Are Useless

#65
My favorite remark from the article: "Anything that I judge to be outside of the spirit of the competition will be disqualified—that includes the use of programs, integrals, sums, inverse trig functions, π-related values of special functions, or π-related constants (such as π).)"

Can't be too careful -- some breathtakingly literal-minded soul might submit π as a candidate for π.

Re: All Rational Approximations of Pi Are Useless

#66
post #10

I think blog.wolfram.com is probably the best company blog I've seen, from a marketing perspective. A large number of the entries are basically of the form "Here is an interesting problem, and here's how I solved it with Wolfram products". They generally let the problem have the spotlight rather than focus on the Wolfram products, so it doesn't feel like you are getting pitched. Here's a related problem, but for e: u…

I can do it with only 9.

9

Re: All Rational Approximations of Pi Are Useless

#67

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)

22/7 is way better than 3.14 for finding the area of a circle with radius sqrt(7).

Re: All Rational Approximations of Pi Are Useless

#68
post #66
post #10

I think blog.wolfram.com is probably the best company blog I've seen, from a marketing perspective. A large number of the entries are basically of the form "Here is an interesting problem, and here's how I solved it with Wolfram products". They generally let the problem have the spotlight rather than focus on the Wolfram products, so it doesn't feel like you are getting pitched. Here's a related problem, but for e: u…

I can do it with only 9. 9

FlipH is not a legal operator.

Re: All Rational Approximations of Pi Are Useless

#69

There are other reasons, though, that a rational approximation can be useful. If you're doing mental arithmetic, for example, multiplying by a fraction can be easier than multiplying by a decimal, but this depends on the specific numerator and denominator. In this way, 22/7 fails horribly, because multiplying by 22 and dividing by 7 are not particularly easy operations. For example, 100/32 is a less accurate represen…

using a rational version is also easier when using a slide rule

Re: All Rational Approximations of Pi Are Useless

#70
post #15

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

If we're on embedded hardware, or can't use floats for some reason, we use 22/7. It's called fixed point arithmetic. Most CPUs have an integer instruction that multiplies into a double-precision integer result, and an instruction that takes a double-precision integer dividend.

So to scale by pi, we multiply by 355, then divide by 113.

Post reply on HN