Introduction to Algorithms (Square Roots, Newton's Method)

Error Analysis of Newton's Method

Suppose X_{n} = \sqrt{a}(1 +\varepsilon _{n})

Then, X_{n+1} = \sqrt{a}(1+\frac{\varepsilon _{n}^{2}}{2(1+\varepsilon _{n})} )

Therefore, \varepsilon _{n+1} = \frac{\varepsilon _{n}^{2}}{2(1+\varepsilon _{n})}

Multiplication Algorithms

  1. Naive Divide & Conquer method: Θ(d^2) time
  2. Karatsuba: Θ(d^1.584...)
  3. Toom-Cook generalizes Karatsuba (break into k ≥ 2 parts), Θ(d^1.465...)
  4. Schönhage-Strassen - almost linear! Θ(d lgd lglgd) using FFT.

High-Precision Division

We want high precision rep of a/b

  • Compute high-precision rep of 1/b first
  • High-precision rep of 1/b means, \left \lfloor \frac{R}{b} \right \rfloor where R is large value s.t. it is easy to divide by R

Division

Newton's Method for computing R/b

 f(x) = \frac{1}{x} - \frac{b}{R}

{f}'(x) = \frac{-1}{x^{2}}

x_{i+1} = x_{i} - \frac{f(x_{i})}{f'(x_{i})}

x_{i+1} = x_{i} + x_{i}^{2}(\frac{1}{x_{i}} - \frac{b}{R}) = 2x_{i} - \frac{bx_{i}^{2}}{R}

Quadratic convergence; # digits doubles at each step

c\cdot 1^{\alpha }+c\cdot 2^{\alpha }+c\cdot 4^{\alpha }+ \cdot \cdot \cdot +c\cdot d^{\alpha } < 2c\cdot d^{\alpha }

 

你可能感兴趣的:(Introduction to Algorithms (Square Roots, Newton's Method))