3 ms·
This seems like a really hard way to calculate square roots. Why not just use bracketing? 1. Pick a number HI whose square is obviously higher than N.
by SeanLuke 9y ago
This seems like a really hard way to calculate square roots. Why not just use bracketing?
1. Pick a number HI whose square is obviously higher than N.
2. Pick a number LO whose square is obviously lower than N.
3. Choose a number MED which is roughly (HI+LO)/2.
4. If MED * MED > N, replace HI with MED, else replace LO with MED.
5. Go to 3.
6. MED converges to your answer.
Doesn't converge quite as fast maybe, but a million times easier to grok. I got to where the author got, ~87.8, in 8 iterations even with terrible initial HI and LO guesses (100 and 50 respectively).
- dozzie 9y ago> Doesn't converge quite as fast maybe, but a million times easier to grok. What didn't you understand about manually calculating square roots? Because your method requires tons of troublesome multiplication of numbers that get longer with each step.
- BoiledCabbage 9y ago> What didn't you understand about manually calculating square roots? Why would you be both insulting and wrong in the same post? Or did you think that multiplication somehow isn't manual? Next time work on phrasing your comment a bit better. It makes the world a better place.
- SeanLuke 9y agoI did it manually.
- sevensor 9y agoI think faster convergence is the answer. Also, I like the geometric argument in the post. But you're right, bracketing is pretty obvious, and it's the way I approximate square roots in my head.