Hacker News new | ask | show | jobs
by lmm 386 days ago
Well, sure, but you should still be able to ask and answer questions like "Is pi + sqrt(2) less than or greater than 4.553?"
3 comments

It's important to understand that this was a non-trivial question for thousands of years. The ancient Babylonians would have probably believed this to be false (their best known approximation had pi ≈ 25/8, which is too small). The right way to approach this problem from first principles would be to construct some geometrical objects that have these lengths and try to compare them (for example by taking the perimeter of a square inscribing a unit circle and a square inscribed in a unit circle as the upper and lower bounds for pi, though that may not be good enough for this particular problem).

When you're doing something like pi + sqrt(2) ≈ 3.14159 + 1.41421 = 4.5558, you're taking known good approximations of these two real numbers and adding them up. The heavy lifting was done over thousands of years to produce these good approximations. It's not the arithmetic on the decimal representations that's doing the heavyh lifting, it's the algorithms needed to produce these good approximations in the first place that are the magic here.

And it would be just as easy to compute this if I told you that pi ≈ 314159/100000, and sqrt(2) ≈ 141421/100000, so that their sum is 455580/100000, which is clearly larger than 4553/1000.

> their best known approximation had pi ≈ 25/8, which is too small

I'm curious if they had a better one that we don't know of yet—their best known approximation of sqrt(2) is significantly more accurate.

When you have those sorts of problems the best way is to approach them using inequalities.

   3.1415<pi<3.1416 and 1.4142<sqrt(2)<1.4143, => 4.5557<pi + sqrt(2)<4.5559
   => 4.553 < 4.5557 < pi + sqrt(2) => 4.553 < pi + sqrt(2)
Finite decimal representations being of course the most convenient notation for inequalities like this.
In that case you know how many decimal places you want to expand them to, in order to compare.
Note that "expanding them to some number of decimal places" gives a somewhat misleading idea about how this works. What you're actually doing is computing a good enough approximation of pi, and expressing that as a decimal. But this is not the same kind of simple process that naturally gives decimals as it is for a rational fraction. Instead, you have to find some series with rational elements which converges to pi, and then compute enough terms of that series that you have a good enough approximation of pi for your purpose. Ideally, since you're interested in an inequality, you'd pick a series which is monotoniclaly increasing or decreasing, so that you know that computing more terms can't put you below or above the target number after you've reached a conclusion. But there is no canonical answer, there are numerous series which converge to pi that you could use, and they would givw you different decimal expansions as you are computing them.