Author | Message |
---|---|
mrente12
Posts: 18
|
Posted 22:03 Jan 07, 2014 |
For the homework question R.118 can it go something like this? Square root 100 is 10 and 10/2 is 5 so 5 is our next guess? Last edited by mrente12 at
22:06 Jan 07, 2014.
|
rabbott
Posts: 1649
|
Posted 22:25 Jan 07, 2014 |
The problem is to compute an approximation of the square root of a number. You don't know the square root when you begin. So in your example, if you want the square root of 100, you must assume that you don't know that the answer is 10. The algorithm says: Start with 100/2, which is 50, as your first guess. Then find (a) 100/50, which is 2, and (b) the average of 50 and 2, which is 26. So 26 is your next guess. Then find (a) 100/26, which is 3.8, and (b) the average of 26 and 3.8, which is 14.9. So 14.9 is your next guess. Then find (a) 100/14.9, which is 6.7, and (b) the average of 14.9 and 6.7, which is 10.8. So 10.8 is your next guess. Then find (a) 100/10.8, which is 9.3, and (b) the average of 10.8 and 9.3, which is 10.0. So 10.0 is your next guess. Since 10.0 * 10.0 = 100, we are done. (Actually what we really want is that the guess squared is "close enough" to the original number. "Close enough" means that the difference between the original number and the guess squared is smaller than some predefined constant.) Last edited by rabbott at
23:59 Jan 07, 2014.
|
mrente12
Posts: 18
|
Posted 22:28 Jan 07, 2014 |
This is very helpful! Thank you so much! |