There is a class Math . It has a sqrt method. Serve a double input, it will take a root from this number and return the result. How? After all, no such formula exists! (or is my math teacher mistaken?) How does this method work?

  • sqrt(a) is the solution to the equation x^2=a , therefore, to calculate sqrt(a) , you need to solve (in general) the transcendental equation. Then you can see how the equations are solved numerically. Option two: use decomposition of the root in a row. - post_zeew
  • If x = sqrt (y), then y = x ^ 2, and then everything goes into a trivial quadratic equation with one root (because the second will be negative). It is unlikely that your teacher did not know the quadratic equations. In addition, there are a lot of specialized methods , including the fun adaptation of Newton's method, which with each iteration specifies the value until it reaches the specified accuracy. - etki

2 answers 2

For any function that is infinitely differentiable at some point a, there is a Taylor series expansion at this point, this series contains an infinite number of terms, but to calculate the value with some accuracy you can take some finite number of terms. Due to this, it is possible to calculate a lot of things, including, for example, finding numerically "non-unstable" integrals.

Related link: Taylor Series

    After all, no such formula exists!

    But what about the people extracts the roots? on a whim, or what? You can even extract a square root even into a column - it is not much more difficult to divide ...

    How does this method work?

    The processor has a command FSQRT, for example ...