Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

aside: As the Professor points out, the ratio of pi to its evil twin is ~1.198, the arithmetic-geometric mean of sqrt(2) and 1. The geometric part involves a square root, and square roots are expensive. So I was like, well, if the AM converges to GM, then due to AM-GM-HM inequality, it must converge to the harmonic mean as well. And the HM does not need an expensive square root!

https://imgur.com/a/UkxkPzW

Its quite wild that the AM GM convergence is almost immediate - in just 2 steps, whereas to get a decent convergence for the Gauss's constant via HM, you need like 15 steps.You can dispense with expensive operators like square root but you end up paying for it with numerous iterations.



The c value you compute depends on computing the b value, though. It's not a recursion carried out in a way which avoids square roots. It's just carrying out the same AM-GM sequence computation, and then taking a certain weighted harmonic mean over that sequence, which converges just because that original sequence converges anyway.

Note that the arithmetic-harmonic mean I think you were going for is just the geometric mean (not the arithmetic-geometric mean, just the geometric mean simpliciter; see https://mathworld.wolfram.com/Arithmetic-HarmonicMean.html).




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: