square root (eventually) = ½ * ((number /guess) + guess)
A straightforward “guess” is simply to divide the number by two. Let me demonstrate this formula by iteration. Let’s say that we want the square root of 3.13. That will be our number. Half of that is 1.565. That will be our guess.
| Iteration | Result of Equation | Result x Result |
| 1 | 1.7825 | 3.1773062500 |
| 2 | 1.7692303647 | 3.1301760832 |
| 3 | 1.7691806020 | 3.1300000025 |
| 4 | 1.7691806013 | 3.13 |
In the first iteration, the guess is 1.565. In each successive iteration, the guess used is the result of the last operation. Thus in Iteration 2 the guess is 1.7825. And so on. We stop as soon as result times result is our number.
The bigger the number, the more iterations. The square root of my year of birth (1936) is 44. That took 9 iterations. The square root of 9,876,543.21 is 3142.696804—and that took 15 rounds of what are simply three of the four basic arithmetic operations of multiplication, division, addition, and subtraction.
If you absolutely insist on doing things by hand, it is easy to automate square root pulling in Visual Basic or whatever language you prefer. And such a subroutine could be built into the code I’ve devised (and point to in the earlier posting) to make the operation as “pure” as possible.
0 comments:
Post a Comment