How do calculators find the square-root of a #?

If there isn’t a formula for finding a
square-root of a number, how do calculators
find them so efficiently?

There is a formula, which some of us are old enough to have been taught in elementary school.

I think, though, that calculators use an method of successive approximations using a technique known as the Newton-Raphson method. You make a guess and then make your next guess based on the results of the previou one. Newton-Raphson guarantees your guesses get better and better and it converges very quickly. You stop guessing when you have enough digits in your answer.

Your statement that calculators do things efficiently is a little over-confident. They do things pretty quickly, but they are not necessarily all that efficient.


That’ll do, pig. That’ll do.

There are two ways for a calculator to find a square root.[list=1][li]Find the natural log, divide that by two, then raise e to that result. The new number is the square root.[/li]
[li]An algorithm:[/li]
Let n be then number you want the square root of
r[sub]1[/sub] be a first guess (half of n is a good start)

r[sub]1[/sub] * n/r[sub]1[/sub] = n

If r[sub]1[/sub] is greater than sqrt(n), then n/r[sub]1[/sub] is less than, and vice versa. The average of them is closer to sqrt(n) than either of them were. So let the second guess r[sub]2[/sub] be (r[sub]1[/sub]+n/r[sub]1[/sub])/2

In general, then, repeat r[sub]j[/sub]=(r[sub]j-1[/sub]+n/r[sub]j-1[/sub])/2 until the new r[sub]j[/sub] isn’t significantly different than r[sub]j-1[/sub].[/list=1]


The Canadians. They walk among us. William Shatner. Michael J. Fox. Monty Hall. Mike Meyers. Alex Trebek. All of them Canadians. All of them here.

Magic math pixies.

Mine has a button.

Easy! Just raise the number to the 1/2 power!
There are some “cheap and dirty” methods to be done by hand…sounds kinda kinky! Newton didn’t run and get his HP or his slide-rule!

Maybe that’s why all these recent questions about Newton’s sexlife!


The scary thing is that 90% of the people think they’re above average! - unknown

That’s what I thought.

Jinx wrote:

The scary thing is that some people believe this to be mathematically impossible!

The scary thing is, 90% of people think they are above the median!

Actually, I hate to say this, but everybody is wrong so far. You have to keep in mind all a calculator is, is a small computer. As a Computer Systems Technology student, one of the dreadfully fun classes we got to take was Computational Mathematics… and you guessed it, one of the things we learned was square rooting.

Now, it’s 1 in the morning and I don’t have the energy to explain it, rather I’ll let y’all hang for a while. But keep this in mind: Because a calculator is simply a small computer, calculators must make calculations according to the “laws and rules” of binary.

In other words: Computers CAN NOT multiply or divide, they can only ADD and SUBTRACT. Ahhhhh, the beauties of binary.

I’ll be back tomorrow after sleeping and I’ll tell you guys how it’s done… hell, maybe I’ll even give you guys the algorithm. =)


Mc[Ph|st]Y Cheesehead

“Software is like sex, it’s better when it’s free.” -Linus Torvalds on the software industry.

Four words: Math co-processors.

.

In general, yes, but since modern calculators work in floating point, the number is normally held as some fraction times a power of two. You can get a much better initial guess by dividing the power of two by two.


Sample:  Square root of 10:

10 = .625 times 2^4

Initial guess:  .625 times 2^(4/2) = 2.5.

1. 10 / 2.5 = 4.
   (2.5 + 4) / 2 = 3.25
2. 10 / 3.25 =  3.076923076923
   (3.25 +  3.076923076923) / 2 =  3.163461538462
3. 10 / 3.163461538462 = 3.161094224924
   (3.163461538462 + 3.161094224924) / 2 = 3.162277881693
4. 10 / 3.162277881693 =  3.162277438644
   (3.162277881693 + 3.162277438644) / 2 = 3.162277660168
5. 10 / 3.162277660168 = 3.162277660169

In just 5 steps, we get the answer.


John W. Kennedy
“Compact is becoming contract; man only earns and pays.”
– Charles Williams

Computers can definately multiply. The chip I am working now on has serveral multipliers of
vaious sizes.

Don’t mistake the trees for the forest.

Computers may break down all operations to an addition or a subtraction at the lowest level - but I don’t think its necessary to explain that to answer the question. For all practical purposes, computers do multiply and divide.