# Formula For Roots?

• Dec 11th 2005, 01:28 PM
StunGunn
Formula For Roots?
Hey guys, I'm not sure if I put this in the right subtopic or not, so it can be moved if needed...

Anyways, I just have a question about roots...

When refering to let's say, the square root of 4, that can also be written as 4^(1/2). Ok, so I was just wondering if a calculator can actually do that, or does it do something else.

In general, what goes on behind the scenes of a calculator when you take the square root or cube root of a number.

Thanks!
~Stun
• Dec 11th 2005, 01:50 PM
MathGuru
Cordic
If you enter 4^(1/2) into a calculator it will give you the correct answer of 2. As far as what goes on behind the scenes in a calculator check this out:

Calculators use what is called the CORDIC method to calculate square roots and such. you can probably find something in a google search about the CORDIC method but basically they have a list of stored values and an algorithm that uses these stored values to approximate the answers.

• Dec 11th 2005, 02:20 PM
StunGunn
Thanks for letting me know that. I've tried to look up some definitions for CORDIC, but pretty much all I found was a bunch of math-expert gable-de-gook. lol

Can you possibly give me a quick definition for a newbie?

Thanks!
~Stun
• Dec 15th 2005, 03:39 PM
hpe
Quote:

Originally Posted by StunGunn
In general, what goes on behind the scenes of a calculator when you take the square root or cube root of a number.

The square root of a number x can be computed approximately to any precision as follows. I suspect that that's close to the way it's done in a calculator:

Start with a guess a (a number near $\sqrt{x}$). Then compute $b =\frac{1}{2}(a + \frac{x}{a})$, $c =\frac{1}{2}(b + \frac{x}{b})$ , $c =\frac{1}{2}(b + \frac{x}{b})$ and so on. After a few steps, you will be near $\sqrt{x}$. Note that you only have to be able to add and divide.

There is a bit of theory that allows you to tell when to stop. It can be easly implemented in hardware. This is a special instance of the Newton-Raphson algorithm

Example: To find $\sqrt{23}$, start with a = 5. Then b = 4.80000, c = 4.79583333333333, d = 4.79583152331306, e = 4.79583152331272 which is correct to all 15 digits. Works for any x and can be done also for all other roots.
• Dec 16th 2005, 05:00 AM
CaptainBlack
Quote:

Originally Posted by hpe
The square root of a number x can be computed approximately to any precision as follows. I suspect that that's close to the way it's done in a calculator:

Start with a guess a (a number near $\sqrt{x}$). Then compute $b =\frac{1}{2}(a + \frac{x}{a})$, $c =\frac{1}{2}(b + \frac{x}{b})$ , $c =\frac{1}{2}(b + \frac{x}{b})$ and so on. After a few steps, you will be near $\sqrt{x}$. Note that you only have to be able to add and divide.

There is a bit of theory that allows you to tell when to stop. It can be easly implemented in hardware. This is a special instance of the Newton-Raphson algorithm

Example: To find $\sqrt{23}$, start with a = 5. Then b = 4.80000, c = 4.79583333333333, d = 4.79583152331306, e = 4.79583152331272 which is correct to all 15 digits. Works for any x and can be done also for all other roots.

The actual square root algorithm implemented depends on the hardware that
is available. Often division is costly and is avoided except for division by
a power of the radix.

It came as a surprise :eek: to me to find mention of the "long division"
algorithm (the method that used to be taught in schools that used a tableau
that resembled that used in long division) and methods using the result that
the sum of odd integers is a square (and others too numerous to mention)
when investigating machine implementation of the square root function.

RonL