Use of Iteration Technique to Find Zeros of Functions and Powers of Numbers
Total Page:16
File Type:pdf, Size:1020Kb
USE OF ITERATION TECHNIQUE TO FIND ZEROS OF FUNCTIONS AND POWERS OF NUMBERS Many functions y=f(x) have multiple zeros at discrete points along the x axis. The location of most of these zeros can be estimated approximately by looking at a graph of the function. Simple roots are the ones where f(x) passes through zero value with finite value for its slope while double roots occur for functions where its derivative also vanish simultaneously. The standard way to find these zeros of f(x) is to use the Newton-Raphson technique or a variation thereof. The procedure is to expand f(x) in a Taylor series about a starting point starting with the original estimate x=x0. This produces the iteration- 2 df (xn ) 1 d f (xn ) 2 0 = f (xn ) + (xn+1 − xn ) + (xn+1 − xn ) + ... dx 2! dx2 for which the function vanishes. For a function with a simple zero near x=x0, one has the iteration- f (xn ) xn+1 = xn − with x0 given f ′(xn ) For a double root one needs to keep three terms in the Taylor series to yield the iteration- − f ′(x ) + f ′(x)2 − 2 f (x ) f ′′(x ) n n n ∆xn+1 = xn+1 − xn = f ′′(xn ) To demonstrate how this procedure works, take the simple polynomial function- 2 4 f (x) =1+ 2x − 6x + x Its graph and the derivative look like this- There appear to be four real roots located near x=-2.6, -0.3, +0.7, and +2.2. None of these four real roots equal to an integer, however, they correspond to simple zeros near the values indicated. Look at the zero near x=2.2. Starting with x0=2.2, we find, using the first iteration procedure above, that- x[0] := 2.2 x[1] := 2.211 x[2] := 2.2116138 x[3] := 2.21161381622825 x[4] := 2.2116138162282563591881310847 So that after four iterations we have a 28 digit accurate result. The remaining three zeros are found at -2.574111055, -0.275377309, and 0.637874548. Next look at the non-linear function f(x)=exp(-x)-x. It has just one zero near x0=0.6. The zero is simple and so can again be obtained to any degree of accuracy by using just the two term Taylor series approximation. We find after three iterations, that- x[3] :=0.5671432904097838 a number with 16 digit accuracy. If one instead uses the more complicated quadratic iteration given above, one finds the more accurate 56 digit approximation- x[3]:=.5671432904097838729999686622103555497538157871865125081 at the third iteration. Clearly the quadratic iteration converges faster than the standard linearized version of the Newton-Raphson approach, but one pays for it by having a more complicated expression required in the iteration. Consider next the function- 2 3 2 f (x) = x(x −1) = x − 2x + x which has a simple zero at x=0 and a double zero at x=1. To find the root by iteration near x=1 clearly presents a problem when using the Newton-Raphson approach since df(1)dx vanishes causing f(1)/[df(1)/dx] to become indeterminate. However the quadratic iteration will work fine. We there have- xn+1(x) = 2 2 2 3 2 [3xn − 4xn +1] (3xn − 4xn +1) − 2(xn − 2xn + xn )(6xn − 4) xn (x) − + [6xn − 4] [6xn − 4] So taking x0=1, we find x1=1. Hence the unique double root is x∞=1. Next let us consider finding the pth power of a number N. This time our iteration is not dealing with the zero of a function but rather with the series expansion about a p known power N0 . The binomial expansion reads- p (N − N ) N p = N p 1+ 0 = 0 N 0 pN p−1 p( p −1)N p−2 N p + 0 (N − N ) + 0 (N − N )2 + .. 0 1! 0 2! 0 Keeping just the first two terms in this expansion, one has the iteration- p p p−1 [Nn+1 ]= []Nn + p []Nn (Nn+1 − Nn ) with N0 given One can simplify things somewhat by replacing Nn+1 in the second term on the right p by N∞and letting x=N . This produces the iteration formula- [1−(1/ p)] 1/ p 1/ p xn+1 = xn + p(xn ) [x∞ − xn ) Let us demonstrate this approach for the square root of two starting with x0=1.We find- x[0] := 1 x[1] := 1.5 x[2] := 1.41 x[3] := 1.41421 x[4] := 1.41421356237 x[5] := 1.41421356237309504880168 x[6] := 1.41421356237309504880168872420969807856967187537 To find the square of 63 we choose x0=3600 and get on iteration- x[0] := 3600 x[1] := 3960. x[2] := 3968.99 x[3] := 3968.99999 x[4] := 3968.99999999999999 x[5] := 3968.999999999999999999999999999 x[6] := 3969.000000000000000000000000000000000000000000 so that 632=3969 exactly. December 2010 .