I don't get what this is asking me to do...

I have an assignment out of my Java book and I'm not asking for anyone to code anything for me but I am asking if anyone can clarify what the book is trying to have me accomplish:

20. The following defines a function that calculates an approximation of the square root of a number, starting with an approximate answer(approx), within the specified tolerance(to1).

{approx | if|approx^2 - number| <= tol

sqrRoot(number,approx,tol) = {sqrRoot(number,(number^2 + number) / (2* approx), tol) | if|approx^2 - number | > tol

Write a recursive and non-recursive method of the sqrRoot method.

Re: I don't get what this is asking me to do...

Are you sure you copied this code correctly? Please use proper indentation to make it easier for us to read. It looks like they want you to write two methods on calculating a method which finds the square root of some number.

Re: I don't get what this is asking me to do...

Quote:

Originally Posted by

**colerelm** Code:

` {approx | if|approx^2 - number| <= tol `

sqrRoot(number,approx,tol) = {sqrRoot(number,(number^2 + number) / (2* approx), tol) | if|approx^2 - number | > tol

Cute; what language is this? It doesn't mind unbalanced brackets ...

kind regards,

Jos