Today, technologies make everything easy and fast for us. Sometimes, when we see the ancient marvels of engineering, we wonder: “How they designed this without computers”? And the answer is: “with knowledge, inspiration and hard work”.
However, being almost irreplaceable, computers makes us more and more adjective. Our brains become lazy and we are losing some knowledge and skills. Such is the manual calculation of root. It is so easy and elegant, so I will share it here for the sake of the good old math science.
Lets calculate x = √a first.
By squaring both sides and moving a to the left side, we obtain the following equation:
x2 − a = 0
This is an equation of type f(x) = 0 and we can solve numerically it using the Newton’s method:
- Start with initial guess: x0. It is good to be close to the solution, so you can use the nearest exact root.
- Calculate the next approximation of the root by the equation: x1 = x0 − f(x0)/f′(x0)
- Continue the iterations by using the previous result to estimate a new one:
xn+1 = xn − f(xn)/f′(xn).
- Stop when you reach the desired precision.
In the above formulas, f(x) is the function and f′(x) is the first derivative. In our case:
f(x) = x2 − a
f′(x) = 2x
If we substitute the above equations into the Newton’s iterative formula, we get:
xn+1 = xn − (xn2 − a)/2xn
xn+1 = (xn + a/xn)/2
Now, lets use it to calculate √a = ?, for a = 5.
We will start with an initial guess of x0 =√4 = 2.
1st iteration: x1 = (x0 + a/x0)/2 = (2 + 5/2)/2 = 2.25
2nd iteration: x2 = (x1 + a/x1)/2 = (2.25 + 5/2.25)/2 = 2.2361
3rd iteration: x3 = (x2 + a/x2)/2= (2.2361 + 5/2.2361)/2 = 2.2361
After the second iteration, we have 5 correct significant digits, which is quite sufficient for most cases.
We will use the same approach, as follows:
f(x) = x3 − a
f′(x) = 3x2
xn+1 = xn − (xn3 − a)/3xn2
xn+1 = (2xn + a/xn2)/3
Lets see how it works for 3√7. Our initial guess is: x0 = 3√8 = 2.
1st iteration: x1 = (2x0 + a/x02)/3 = (2·2 + 7/22)/3 = 1.9167
2nd iteration: x2 = (2x1 + a/x12)/3 = (2·1.9167 + 7/1.91672)/3 = 1.9129
3rd iteration: x3 = (2x2 + a/x22)/3 = (2·1.9129 + 7/1.91292)/3 = 1.9129
Again, we managed to find it after two iterations. We can also use Calcpad to create a tiny program for that:
It is interesting that just after 4 iterations, the Newton’s method finds 16 correct significant digits which is the limit precision for most computers. We also calculated the root by three different methods which give the same result.