{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

ALG3.3

ALG3.3 - 1 2 Taylor Expansion(x x 0 f(x = f(x 0(x x 0)f(x 0...

This preview shows pages 1–5. Sign up to view the full content.

1 Algorithms Professor John Reif ALG 3.3 Newton Iteration a n d Polynomial Computation: ( a ) Newton Iteration: application to d i v i s i o n ( b ) Polynomial Evaluation and Interpolation (Chinese R e m a i n d e r i n g ) Reading Selection: AHU-Data Chapter 8 2 Taylor Expansion f ( x ) = f ( x 0 ) + ( x - x 0 ) f ¢ ( x 0 ) + ( x - x 0 ) 2 2 f ( x 0 ) + . . . ( x - x 0 ) f ( x 0 ) x 0 x f( x ) f ( x 0 ) To find root of f(x), use Newton iteration: x i + 1 = x i - f ( x i ) f ¢ ( x i ) Example: To find reciprocal of x choose f(y) = 1- x y 1 find root y = x 1 y i + 1 = y i - f ( y i ) f ¢ ( y i ) = y i (2 - y i x )

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
3 Application of Newton Iteration to Reciprocal of an Integer input integer x, accuracy bound k initialize y 0 = 2 - n if x has n bits for i=1 to k d o y i + 1 ¨ y i (2 - y i x ) o u t p u t y k where 1 - y k x £ 2 2 k 1 proof let error e k = 1 - y k x t h e n e k+1 = 1 - y k+1 x = 1 - x y k (2 - y k x ) = ( e k ) 2 = ( e 0 ) 2 k = 2 -2 k since e 0 £ 2 1 Theorem Integer Reciprocal can be computed to accuracy 2 -n in O(log n) integer mults and additions. 4 Steven Cook's Improvement (his Harvard Ph.D. thesis) observe that since 1 - y k x £ 2 2 k 1 we need only compute y k up to 2 k + 1 bit accuracy. Total Time Cost c k = o l o g n Â M (2 k + 1 ) £ O ( M ( n )) where M(n) is time cost to multiply two n bit integers.
5 Other Applications of Newton Iteration on Integers O(M(n)) time algorithms: - quotent + divisor of integer division - square root - sin, cosine, etc. used in practice! 6 Algorithm: Reciprocal (P(x)) input polynomial P(x) = Â i = 0 n - 1 a i x i degree n-1, n is power of 2 [1] if n=1 then return a 0 1 e l s e [2] q(x) ¨ Reciprocal (P 1 (x)) where P 1 (x) = Â i = 2 n n - 1 a i x i- 2 n [3] R x r x x r x P x n ( ) ¨ ( ) - ( ) ( ) ( ) - 2 1 2 1 2 3 2 [4] return Î x n - 2 R(x) ˚

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
7 Theorem: The algorithm computes reciprocal (P(x)) = Î P ( x ) x 2 n - 2 ˚ = r(x) where r ( x ) p ( x ) = x 2 n - 2 + e ( x ) and e (x) has degree < n-1 proof by induction b a s i s n=1 fi P(x) = a 0
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}