I am trying to write this recursive function for my class. We are to use Newton's method to find the square root of a nonnegative real number.
Here is the meat of the question.
If the absolute value of a^2-x <= epsilon, then a is the square root of x within the tolerance;
otherwise:
Replace a with (a^2+x)/(2a) and repeat step a where the abs(a^2 - x) denotes the absolute value of a^2-x