# Square Root Algorithm

The recursive Square Root algorithm from a Digital Signal Processing book.

Recursion means each answer depends on the previous answer...

How do you get an answer when you don't have an answer to start with?

Start with an arbitrary initial condition y(-1) = 1 and repeat the equation until you meet the return condition:

In this case when the resulting y(n) = y(n-1)

y(n) = 0.5(y(n-1) + NUMBER/y(n-1))

Repeating the equation by hand is tedious... Computers are designed to do repetitive tasks...

Excel is a great tool for testing algorithms without writing a formal program.

Do not be afraid of the notation... y(n) just means "This time through" y(n-1) means "Last time through" y(n-2) "two answers ago" y(n+1) next answer(not possible in a real time system, but possible with recorded data)

For people familiar with programming arrays the y(n) notation is referring to the nth location in the array.

As the array is filled, the pointer n will be incremented to point to the current location