Are you sure you have the correct recursion?
The method you use looks like it would work better passing 3 numbers.
or else changing

0

mikeregasAuthor Commented:

I need to take a number say 19.7 and then it is suppose to return 4.438 is the example that I was given. I know that I am suppose to take two number the low which would be 0 and the high and which would be 19.7 and recursively bring it down to an approximate square root. So there would be a third number in the equation the mid.

0

Administration of Active Directory does not have to be hard. Too often what should be a simple task is made more difficult than it needs to be.The solution? Hyena from SystemTools Software. With ease-of-use as well as powerful importing and bulk updating capabilities.

I am confused on what is right in my code and what is wrong? can you please give me some direction to go in. my code is return a 1 for any number that I input and I know that is worng.

According to algorithm
x(n+1) = 1/2( x(n) + a / x(n) )

where a is the number for which square root should be calculated.
Change calculation of 'mid' to above formula.

Also, since you are always calling function recursively with low as 1, your answer is always converging to 1.

0

mikeregasAuthor Commented:

x(n+1) = 1/2( x(n) + a / x(n) ) let me make sure that I understand this. if a is the number that I am trying to get the root of then x is a function of what? I am truely lost with recursion

0

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Assume x(0) = 1.

Go thru the link I have posted