76 COMPUTER BASED NUMERICAL AND STATISTICAL TECHNIQUES First approximation: The first approximation is given by x 1 = x 0 – 00 0 00 sin cos cos xx x xx + x 1 = π – sin cos cos ππ+π ππ = 2.8233 Similarly successive iterations are x 2 = 2.7986, x 3 = 2.7984, x 4 = 2.7984. Since x 3 = x 4 hence the required root is 2.798 correct to three places of decimal. Example 9. Find the real root of the equation x = e –x using the Newton-Raphson’s method. Sol. We have f(x)= xe x – 1 then f ´(x) = (1 + x)e x Let x 0 = 1 then, First approximation: x 1 = 1 – 11 1 1 22 e e e − =+ = 0.6839397 Now, f(x 1 ) = 0.3553424 and f ′(x 1 ) = 3.337012 So that, Second approximation: x 2 = 0.6839397 – 0.3553424 3.337012 = 0.5774545 Third approximation: x 3 = 0.5672297 Similarly, x 4 = 0.5671433 Hence the required root is 0.5671 correct to 4 decimal places.’ Example 10. Using the starting value 2(1 + i), solve x 4 – 5x 3 – 20x 2 – 40x + 60 = 0 by Newton- Raphson’s method given that all the roots of the equation are complex. Sol. Let f(x)= x 4 – 5x 3 + 20x 2 – 40x + 60 So that f´(x)= 4x 3 – 15x 2 + 40x – 40 Therefore Newton-Raphson method gives, x n+1 = x n – () () n n fx fx ′ x n+1 = x n – 43 2 32 5204060 4154040 nnnn nnn xxxx xxx −+ − + −+− x n+1 = −+− −+− 432 32 31020 60 415404 0 nnn nnn xxx xxx Put n = 0, take x 0 = 2 (1 + i) by trial, we get x 1 = 1.92(1 + i) x 2 = 1.915 + 1.908i ALGEBRAIC AND TRANSCENDENTAL EQUATION 77 Since, imaginary roots occur in conjugate pairs roots are 1.915 ± 1.908i upto 3 places of decimal. Assuming other pair of roots to be α ± iβ, then Sum = 1.915 1.908 1.915 1.908 α+ β+α− β ++ +− ii i i = 2α + 3.83 = 5 ⇒α= 0.585 Also, products of roots are (α 2 + β 2 ) [(1.915) 2 + (1.908) 2 ] = 60 ⇒β= 2.805 Hence other two roots are 0.585 ± 2.805i. Example 11. Apply Newton’s formula to prove that the recurrence formula for finding the nth roots of a is x i+1 = () − −+ n i 1 n i n1x a nx Hence, evaluate (240) 1/5 . Sol. Let x = a 1/n ⇒ x n = a or x n – a = 0 Let f(x)= x n – a = 0 ⇒ f´(x) = nx n–1 . Now, by Newtons’s-Raphson method, we have x i+1 = x i – () () i i fx fx ′ or x i +1 = () 1 1 n i n i nxa nx − −+ (1) Now to find the value of (240) 1/5 We know that (243) 1/5 = (3 5 ) 1/5 = 3 Take a = 240 and n = 5 we get x i+1 = 5 4 424 0 5 i i x x + (2) First approximation: Let i = 0, x i = x 0 = 2.9 (say), then from above equation (2), we get x 1 = () () 5 5 0 44 0 4 2.9 240 4 240 5 52.9 x x + + = = () 4 205.111 240 1060.444 2.99 5 70.7281 353.6403 + == × Second approximation: Let i = 1, x i = x 1 = 2.99 (say), then from above equation (2), we get x 2 = () () ++ = 5 5 1 44 1 424042.9924 0 5 52.99 x x 78 COMPUTER BASED NUMERICAL AND STATISTICAL TECHNIQUES = () 4 238.977 24 0 399.627 + = 2.9925 Hence, the required value of (240) 1/5 correct to three places of decimal is 2.993. Example 12. Determine the value of p and q so that rate of convergence of the iterative method x n +1 = px n + q 2 n N x for computing N 1/3 becomes as high as possible. Sol. We have x 3 = N therefore f(x) = x 3 – N. Let α be the exact root, we have α 3 = N. Substituting x n = α + e n , x n + 1 = α + e n+1 , N = α 3 in x n+1 = px n + q 2 n N x , we have α + e n+1 = p(α + e n ) + q () 3 2 n ae α + = p (α + e n ) + q 3 2 2 1 α α+ α n e = p(α + e n ) + qα 2 1 n e − + α = p(α + e n ) + qα 2 12 3 . nn ee −+ − αα = p(α + e n ) + qα – 2qe n + 3q 2 α n e – ⇒ e n+1 = (p + q – 1) α + (p – 2q) e n + 0 (e n ) 2 + Now for the method to become of order as high as possible i.e., of order 2, we must have p + q = 1 and p – 2q = 0 so that p = 2/3 and q = 1/3. PROBLEM SET 2.4 1. Use Newton-Raphson method to find a root of the equation x 3 – 3x – 5 = 0. (U.P.T.U. 2005) [Ans. 2.279] 2. Find the four places of decimal, the smallest root of the equation e –x = sin x. [Ans. 0.5885] 3. Find the cube root of 10. [Ans. 2.15466] 4. Show that the square roots of N = AB is given by 4 S N N S ≈+ , where S = A + B. 5. Use Newton-Raphson method to obtain a root, correct to three decimal places of following equations: (a) sin x = 2 x [Ans. 1.896] (b) x + log x = 2 [Ans. 1.756] (c) tan x = x [Ans. 4.4934] ALGEBRAIC AND TRANSCENDENTAL EQUATION 79 6. Using N–R method, obtain formula for N and find 2 0 correct to two decimal places. [Ans. 4.47] 7. Find cube root of 3 correct to three decimal places by Newton’s iterative method. [Ans. 1.442] 8. Find the positive root of the equation ex = 1 + x + 2 3 2! 3! x x + e 0.3x correct to 6 decimal places. [Ans. 2.363376] 9. Apply Newton’s formula to find the values of (30) 1/5 .[Ans. 1.973] 10. Prove the Chebyshev formula x 1 = x 0 – () () () () () 2 00 0 3 0 0 . 1 . '2 fx f x fx fx fx ′′ − ′ for the roots of the equation f(x) = 0. 2.8 SECANT METHOD The Secant method is similar to the Regula-Falsi method, except for the fact that we drop the condition that f(x) should have opposite signs at the two points used to generate the next approximation. Instead, we always retain the last two points to generate the next. Thus, if 1 n x − and n x are two approximations to the root, then the next approximation 1 n x + to root is given by − + − − =− = − 1 1 1 () ( ), 1, 2, 3, () ( ) nn nn n nn xx xx fxn fx fx (1) Geometrically, in Secant method we replace the function ( ) f x by a straight line passing through the points (,()) nn xfx and ( 11 ,( )) −−nn xfx and take the point of intersection of the straight line with the x-axis as the next approximation to the root. In contrast to the Regula-Falsi method, the Secant iteration does not bracket the root and it is not even necessary to bracket the root to start the iteration. Hence, it is obvious that the iteration may not always coverage on the other hand, it generally converges faster. Thus, by dropping the necessity of bracketing the root, we improve the rate of convergence, however, in some cases, the iteration may not converge at all. 2.8.1 Procedure for Secant Method to Find the Root of =() 0fx Step 1: Choose the interval [] 01 , xx in which () 0 fx= has a root, where 1 0 xx > . Step 2: Find the next approximation 2 x of the required root using the formula 10 21 1 10 () ( ) () () xx x xfx fx fx − =− − . Step 3: Find the successive approximations of the required root using the formula − + − − =ε − = − 1 1 1 () ( ), 1, 2, 3, () ( ) nn nn n nn xx xfxn fx fx Step 4: Stop the process when the prescribed accuracy is obtained. 80 COMPUTER BASED NUMERICAL AND STATISTICAL TECHNIQUES 2.8.2 Rate or Order of Convergence of Secant Method On substituting îå=+ nn x , etc. in (1) we obtain the error equation as åå îå åå îå îå − + − −+ =− +−+ 1 1 1 ()() ()( ) nn f ff nn n nn (2) On expanding +(îå) n f and − + 1 ( îå ) n f in Taylor’s series about the point î in (2), and using ξ()f = 0, we obtain 1 2 1 1 22 1 1 ( ) () () 2 1 ( ) () ( ) () 2 n nn n n nn nnn ff ff − − + − ′′′ ε−ε ε ξ+ ε ξ+ ε=ε− ′′′ ε−ε ξ+ ε−ε ξ+ On simplifying, and neglecting higher powers of n ε , we get 1 1 nnn c + − ε=εε (3) where, () 1 2() f c f ′′ ξ = ′ ξ Now, we seek a relation of the form 1 p nn k + ε=ε (4) where constants k and p are to be determined. We have from equation (4), 1 p nn k − ε=ε or 1/ 1/ 1 pp nn k − − ε= ε (5) Substituting 1n+ ε from (4), and 1n− ε from (5), into the error equation (3), we get (1 )/ (1 )/ppppp nn ck −+ + ε= ε (6) On comparing the powers of n ε , we have 1 p p p + = or p 2 – p – 1 = 0 Roots of above equation are 15 2 + and 15 2 − . Taking, p = 15 2 + = 1.618 and neglecting the other, we obtain from equation (4), the rate of convergence for the Secant method as p = 1.618. The constant k is determined from (6), and it is given by k = c p/(p+1) . The convergence of the secant method is superlinear The purpose of this document is to show the following theorem: Theorem 2.1: Let {} k k x ∞ be the sequence produced by the secant method. Assume the sequence converges to a root of f (x) = 0, i.e., x k → x ∞ , ()0fx ∞ = . Moreover, assume the root x ∞ is regular: '( ) 0fx ∞ ≠ . Denote the error in the kth step by E k = x k – x ∞ . Under these assumptions, we have /2 (1 5 ) 1.618 1 kk k ECE CE + + ≈≈ , for some constant C. (1) The theorem is implied by three lemmas. ALGEBRAIC AND TRANSCENDENTAL EQUATION 81 Lemma 2.1: Under the assumptions and notations of the theorem: ∞ + − ∞ ′′ ≈ ′ 1 1 () 1 2() kkk fx EEE fx . (2) Proof. Using the definition of x k+1 , we find − ∞∞ ++ − − =−=− − − 1 11 1 () () ( ) kk kk kk kk xx Exxxfx x fx fx . (3) We can replace x k + 1 by x k + E k and x k by x k – 1 + E k – 1 , so that ∞∞− ∞∞ ∞+ ∞∞ − +−− =+− + − +− + 1 1 1 () ()( ) kk kkk kk xExE ExEfxE x fx E fx E . (4) To simplify this expression, we apply the Taylor expansion of f () k xE ∞ + and 1 ( ) k fx E ∞− + about x ∞ : 23 1 ( ) () () () () 2 kkkk fx E fx f x E f x E OE ∞∞∞ ∞ ′′′ += + + + , (5) 23 1111 1 ( ) () () () ( ) 2 kkkk fx E fx f x E f x E OE ∞∞∞∞ −−−− ′′′ +=+ + + . (6) Subtracting 1 ( ) k fx E ∞− + from ( ) k fx E ∞ + : ∞ ∞∞ ∞−− − − − ′′′ +−+= −+ −+ − 22 3 3 11 1 1 1 1 ()()()()()()()() 2 kk kk kkkk fx E fx E f x E E f x E E OE OE (7) Since 33 1 () ( ) kk O EOE − − is of a smaller order than E k and E k–1 we omit this term. Using 22 1− − kk EE = (E k – E k–1 ) (E k + E k–1 ), we organize the above expression as ∞∞ ∞∞ −− − ′′′ +− + ≈− + + 11 1 ()( )( )(()()( ) k k kk kk fx E fx E E E f x f x E E . (8) The left of (8) appears at the right of (4), we derive the following expression: − ∞+ ∞∞−− − ≈−+ ′′′ −++ 1 1 11 () ( )( ( ) ( )( )) kk kk k kk kk EE EEfxE EE fx fxEE . (9) Using a Taylor expansion for ( ) k fx E ∞ + about x ∞ (recall () 0) fx ∞ = we have ∞∞ + ∞∞ − ′′′ + ≈− ′′′ ++ 1 1 1 () () 2 . 1 () ()( ) 2 k kkk kk fx f x E EEE fx f x E E (10) Now we put everything on the same denominator: ∞∞ ∞∞− + ∞∞− ′′′ ′′′ ++−− ≈ ′′′ ++ 1 1 1 11 () ()( ) () () 22 1 () ()( ) 2 kk k kk kk fx fx E E fx f x E EE fx fx E E . (11) which can be simplified as ∞− + ∞∞− ′′ ≈ ′′′ ++ 1 1 1 1 () 2 1 () ()( ) 2 k kk kk fxE EE fx f x E E (12) 82 COMPUTER BASED NUMERICAL AND STATISTICAL TECHNIQUES Because 0 k E → as ∞− ′′ →∞ + 1 1 ,()( ) 2 kk kfxEE is negligible compared to ( ) fx ∞ ′ , so we omit the second term in the denominator, to find the estimate ∞ +− ∞ ′′ ≈ ′ 11 () 1 2() kkk fx EEE fx . (13) Lemma 2.2: There exists a positive real number r such that: 11/ 11 , rr kkk k k E CE E E KE + +− ≈ ⇒≈ for some constants C and K. (14) Proof. Assuming the convergence rate is r, there exists some constant A, so we can write 1 r k k E A E + ≈ and 1 r kk E AE − ≈ or − ≈ 1/ 1 1 . r kk EE A (15) Now we can replace the expressions for E k and E k–1 in the left hand side of (14): + + ≈≈ 1/ 1/ 1 1/ 1 1 . r r r kkkk E CEEBE A (16) Together with the assumption that 1 , r k k E AE + ≈ we obtain 11/r r k k A EE B + ≈ . So, we set A K B = and the lemma is proven. [[ [[ [ Q.E.D.Q.E.D. Q.E.D.Q.E.D. Q.E.D. ]] ]] ] Lemma 2.3: For the r of Lemma 2.1, we have + + ≈ ⇒= 11/ 1 5 . 2 rr kk E CE r (17) Proof. r satisfies the following equation: +=⇒+= ⇒ −−= 22 1 11 10. rr r nr r (18) The roots of n 2 – r – 1 =0 are r = 1 5 2 ± . We take the positive value for r. The constant r = 15 1.618 is the g ol den rat io. 2 + ≈ Example 1. A real root of the equation f(x) = x 3 – 5x + 1 = 0 lies in the interval (0.1). Perform four iterations of the Secant method. Sol. We have x 0 = 0, x 1 = 1, f(x 0 ) = 1, f(x 1 ) = – 3 By Secant method. First approximation: First approximation is given by x 2 = x 1 – () () 10 10 xx fx fx − − f(x 1 ) = 0.25 f(x 2 ) = – 0.234375 ALGEBRAIC AND TRANSCENDENTAL EQUATION 83 Second approximation: Second approximation is given by x 3 = x 2 – () () 21 21 xx fx fx − − f(x 2 ) = 0.186441 f(x 3 ) = 0.074276 Third approximation: Third approximation is given by x 4 = x 3 – () () 32 32 xx fx fx − − f(x 3 ) = 0.201736 f(x 4 ) = – 0.000470 Fourth approximation: Fourth approximation is given by x 5 = x 4 – () () 43 43 xx fx fx − − f(x 4 ) = 0.201640 Example 2. Compute root of the equation x 2 e –x/2 = 1 in the interval [0.2] using Secant method. The root should be correct to three decimal places. Sol. We have, x 0 = 1.42, x 1 = 1.43, f(x 0 ) = – 0.0086, f(x 1 ) = 0.00034 By Secant method, First approximation: First approximation is given by x 2 = x 1 – () () 10 10 xx fx fx − − f(x 1 ) x 2 = 1.43 – 1.43 1.42 0.00034 0.0086 − + (0.00034) = 1.4296 f(x 2 ) = – 0.000011 Second approximation: Second approximation is given by x 3 = x 2 – () () 21 21 xx fx fx − − f(x 2 ) x 3 = 1.4296 – 1.4296 1.42 0.000011 0.00034 − −− (–0.000011) = 1.4292 Since x 2 and x 3 agree up to three decimal places hence the required root is 1.429. Example 3. Find the root of the equation x 3 – 5x 2 – 17x + 20 = 0 by Secant method. Sol. Taking initial approximations as, x 0 = 0, x 1 = 1 and f(x 0 ) = 20, f(x 1 ) = – 1, then by Secant method the next approximation is given by x 2 = x 1 – () () 10 10 xx fx fx − − f(x 1 ) 84 COMPUTER BASED NUMERICAL AND STATISTICAL TECHNIQUES x 2 = 1 – 10 120 − −− (–1) = 1 – 0.04762 = 0.95238 Hence, f(x 2 ) = 0.13824 Now the next approximation can be obtained by using x 1 and x 2 in Secant method. Similarly, other approximations can be obtained by using two recent approximations in Secant method. These are x 3 = 0.95816, f(x 3 ) = 0.00059 x 4 = 0.95818, f(x 3 ) = 0.00011 x 5 = 0.95818. Thus the approximate root can be taken as 0.65818, which is correct up to five decimals. Example 4. Find the root of the equation x 3 – 2x – 5 by Regula-Falsi and Secant method. Sol. Solution by Regula-Falsi method: Here f(x)= x 3 – 2x – 5 then f(2) = – 1, f(3) = 16 and f(2) f(3) < 0 Therefore initial approximations are taken as x 0 = 2, x 1 = 3 and f (x 0 ) = – 1, f (x 1 ) = 16 Then by Regula-Falsi method the next approximation is given by x 2 = x 1 – () () 10 10 xx fx fx − − f(x 1 ) x 2 = 3 – () () 32 16 1 − + 16 = 3 – 0.9412 x 2 = 2.0588 Hence, f(x 2 ) = – 0.3911 and f(x 1 ) f (x 2 ) < 0, therefore the next approximation to the root is obtained by using the values of x 1 and x 2 in Regula-Falsi method as x 3 = x 2 – () () 21 21 xx fx fx − − f (x 1 ) x 3 = 2.0588 – () () 2.0588 3 0.3911 1 6 − −− (–0.3911) = 2.0588 + 0.0225 x 3 = 2.0813 Hence, f(x 3 ) = – 0.1468 and f(x 1 ) f (x 3 ) < 0, therefore the next approximation is obtained by using the values of x 1 and x 3 in Regula-Falsi method. Proceed in similar way to obtain the iterations as follows x 4 = 2.0899, f(x 4 )< 0 x 5 = 2.0928, f(x 5 )< 0 x 6 = 2.0939, f(x 6 )< 0 x 7 = 2.0943, f(x 7 )< 0 x 8 = 2.0945, f(x 8 )< 0 x 9 = 2.0945. Thus, the root can be taken as 2.0945 correct up to four decimals. ALGEBRAIC AND TRANSCENDENTAL EQUATION 85 Solution by Secant method: Taking initial approximations as x 0 = 2, x 1 = 3 and f(x 0 ) = –1, f(x 1 ) = 16, then by Secant method, the next approximation is given by x 2 = x 1 – () () () () 10 1 10 xxfx fx fx − − x 2 = 3 – () () − + 32 16 1 16 = 3 – 0.9412 Hence, x 2 = 2.0588, f(x 2 ) = – 0.3911 Now, the next approximation can be obtained by using the values of x 1 and x 2 in Secant method. Similarly, other approximations can be obtained by using two recent values of approximations. These are x 3 = 2.0813, f(x 3 ) = – 0.1468 x 4 = 2.0948, f(x 4 ) = – 0.0028 x 5 = 2.0945, f(x 5 ) = – 0.0006 x 6 = 2.0945. Thus, the root can be taken as 2.0945 correct to four decimals. Example 5. Find the root of the equation f(x) = 4 sin x + x 2 = 0 by Secant method. Sol. In this method we neglect the condition f(x n ) f(x n−1 ) < 0. Initially, take x 0 = – 1, x 1 = – 2 and f(x 0 ) = – 2.36588, f(x 1 ) = 0.36281, the next approximation to the root by Secant method is given by x 2 = x 1 – () () () () 10 1 10 xxfx fx fx − − x 2 = (–2) – () () 2 1 0.36281 0.36281 2.36588 −+ + x 2 = – 2 + 0.13296 = – 1.86704 Hence, x 2 = – 1.86704, f(x 2 ) = – 0.33992 Now, the next approximation x 3 can be obtained by using the values of x 1 and x 2 in Secant method, which is given by, x 3 = x 2 – () () () () 21 2 21 xxfx fx fx − − x 3 = (–1.86704) – () () 1.86704 2 0.3399 2 0.33992 0.36281 −+− −− x 3 = – 1.86704 – 0.06431 = – 1.93135 Hence, x 3 = – 1.93135, f(x 3 ) = – 0.01269 Now, the next approximation x 4 can be obtained by using the values of x 2 and x 3 in Secant method. Continuing this process and using two recent approximations, to get next approximation, in Secant method, we get x 4 = – 1.93384, f(x 4 ) = 0.00045 x 5 = – 1.93375, f(x 5 ) = – 0.00002 . the root can be taken as 2.0945 correct up to four decimals. ALGEBRAIC AND TRANSCENDENTAL EQUATION 85 Solution by Secant method: Taking initial approximations as x 0 = 2, x 1 = 3 and f(x 0 ). next approximation can be obtained by using the values of x 1 and x 2 in Secant method. Similarly, other approximations can be obtained by using two recent values of approximations. These are x 3 =. log x = 2 [Ans. 1.756] (c) tan x = x [Ans. 4.4934] ALGEBRAIC AND TRANSCENDENTAL EQUATION 79 6. Using N–R method, obtain formula for N and find 2 0 correct to two decimal places. [Ans. 4.47] 7.