lolamegananne
lolamegananne
06.03.2020 • 
Mathematics

You have seen that the math library contains a function that computes the square root of numbers. In this exercise, you are to write your own algorithm for computing square roots. One way to solve this problem is to use a guess-and -check approach. You first guess what the square root might be, and then see how close your guess is. You can use this information to make another guess and continue guessing until you have found the square root (or a close approximation to it). One particularly good way of making guesses is to use Newton's method. Suppose x is the number we want the root of, and guess is the current guessed answer. The guess can be improved by using computing the next guess as:

Solved
Show answers

Ask an AI advisor a question