Methods and complexity for computing square roots

Click For Summary

Discussion Overview

The discussion revolves around methods and complexity for computing square roots, specifically focusing on the computational cost in big O notation and the algorithms commonly used in computers and calculators. Participants explore various algorithms and their complexities, including Newton's method and a long division-like algorithm.

Discussion Character

  • Exploratory
  • Technical explanation
  • Debate/contested
  • Mathematical reasoning

Main Points Raised

  • Yiorgos inquires about the computational cost of calculating sqrt(x) in big O notation, where x is an integer of n digits.
  • Some participants suggest that Newton's method is commonly used for finding square roots, although it is not confirmed as the most prevalent method.
  • Another participant mentions an algorithm resembling long division for square roots, suggesting it has a similar time complexity to long division.
  • There is a request for the computational cost of Newton's method, specifically in relation to the number of digits in the result.
  • A participant proposes calculating sqrt(2) to n-digits precision as a simpler starting point for understanding complexity.

Areas of Agreement / Disagreement

Participants express differing views on the most commonly used algorithm for computing square roots and the associated complexities. No consensus is reached regarding the exact computational costs or the best method to use.

Contextual Notes

The discussion includes assumptions about the number of digits in the result and the nature of the input (e.g., whether A is a square of an integer). The complexity of Newton's method is not fully resolved, and the implications of precision in calculations are noted but not detailed.

Who May Find This Useful

Individuals interested in numerical methods, algorithm complexity, and computational mathematics may find this discussion relevant.

geor
Messages
35
Reaction score
0
Hello everybody,

Let's say we want to compute sqrt(x), where x is an integer
of n digits. Then what is the cost of the computation, in
terms of big O notation and n?

And a second question: what is the algorithm for finding the
square root that is most commonly used in computers and
calculators (just a name or a link will do)?

Thanks a lot in advance!

Yiorgos
 
Mathematics news on Phys.org
what is the algorithm for finding the
square root that is most commonly used in computers and
calculators (just a name or a link will do)?

I don't know if it's the most commonly used, but Newton's method is used a lot.
 
There is an algorithm which resembles long division (I learned it in 4th grade) for taking square roots. It should take about the same time as long division.
 
Thanks for taking the time to reply.

Do you know how much Newton's method cost?
 
Hi,
Here's link that myght help:

http://numbers.computation.free.fr/Constants/Algorithms/inverse.html"
 
Last edited by a moderator:
BobMonahon said:
Hi,
Here's link that might help:

http://numbers.computation.free.fr/Constants/Algorithms/inverse.html"

Thanks, that is helpful, indeed..
So, to compute [tex]\sqrt{A}[/tex] with Newton's method, we will use the iterations:

[tex]x_{n+1} =\frac{3}{2}x_n-\frac{1}{2}A{x_n}^3[/tex]

Can you help me compute the complexity of this one?
Let's say that A has n digits and let's also say it is a square
of an integer...
 
Last edited by a moderator:
The complexity of the calculation depends on the number of digits you want in the result, I think. This might be a simpler way to get started: Calculate [tex]\sqrt{2}[/tex] to n-digits precision.

See if that helps.
 

Similar threads

  • · Replies 23 ·
Replies
23
Views
2K
  • · Replies 1 ·
Replies
1
Views
1K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 13 ·
Replies
13
Views
3K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 13 ·
Replies
13
Views
6K
  • · Replies 18 ·
Replies
18
Views
5K
  • · Replies 1 ·
Replies
1
Views
6K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K