28. Computing the square root of a number using the Babylonian method
Believe it or not, the ancient Babylonians (around 1500 BC) knew how to estimate square roots long before the popular method discovered by Newton.
Mathematically speaking, the Babylonian approach for estimating the square root of v > 0
is the recurrence relation from the following figure:
Figure 1.23: The recurrence relation of Babylonian square root approximation
The recurrence formula starts with an initial guess of x0. Next, we calculate x1, x2, …, xn by substituting xn-1 in the formula on the right-hand side and evaluating the expression.
For instance, let’s try to apply this formula to estimate the square root of 65 (the result is 8.06). Let’s start with x0 as 65/2, so x0 =32.5, and let’s calculate x1 as:
Having x1, we can calculate x2 as follows:
Having x2, we can calculate x3 as follows:
We are getting closer to the final result...