Question: Let N be the number whose square root is to be computed. Guess that some integer n 0 is the square root of N .

Let N be the number whose square root is to be computed. Guess that some integer n0 is the square root of N. Calculate the following:
n1=n0+Nn02
and n1 will be a better approximation. You can keep iterating by having a function that computes:
ni+1=ni+Nni2
Until ni+1-nilon, where lon is some suitably small number.
Implement your own function, called my_sqrt, that calls itself recursively until the square root is computed. Print the answer to the precision of your tolerance. That is, if you have lon=0.01, then only print 2 places past the decimal point.
 Let N be the number whose square root is to be

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!