2007-03-12 More About Square Roots
Another easy way to compute the square root of any number a has been introduced by Heron of Alexandria long before our time. It is an iterative method which is based on the idea that one may very well guess the result, as long as there is a way to make sure the guessing error gets smaller with every new guess.
Let x0 be an initial guess for the square root of a, and let d0 be the guessing error. Hence
( x0 + d0 )2 = a,
and therefore
x02 + 2x0d0 + d02 = a.
We assume that d0 is small, and so d02 will be much smaller than 2d0. In fact, we assume that it is so small that we can safely ignore it.
x02 + 2x0d0 ≈ a
⇒ d0 ≈ ( a - x02 ) / 2x0.
Now we have an approximation of the error we made in the first place. We can use this approximation to correct our first guess and start over again:
x1 = x0 + d0 = ( x0 + a/x0 ) / 2
The complete iteration formula reads
xi+1 = ( xi + a/xi ) / 2.
We can start off with any value x0 ≠ 0. It's easy, isn't it?
***
Addendum:
Oh my god. Starbuck just died. Or at least her Viper exploded and she had no way to get out. There won't even be a search and rescue mission. Rumor has is she might be one of the Final Five, but Katie Sackhoff has signed an NDA, so we can only speculate. That spoiled the day for me.

No comments:
Post a Comment