Numerical Methods
Introduction By numerical methods we mean certain special type of algebraic methods which give approximate solution to the scientific, engineering and mathematical problems by arithmetic operation on numbers. They involve a large number of arithmetic calculations and need fast and efficient computing devices like, calculators, computers and micro electronic machines in their applications.
They are, generally of iterative nature in which certain mathematical formula are repeatedly applied under similar mathematical conditions to generate a sequence of numbers which are successive approximates to the solution of a problem. These methods are, affected by three types of errors:- 1 Round off errors. 2 Truncation errors. 3 Errors due to finite representation of numbers such as 1/3, 3/7, 5/9 etc.
Types of Numerical Methods There are many types of numerical methods. Of them the most commonly used ones may be cited as under; Methods of finding the roots of an equation. They include, bisection method, Regula Falsi method, Secant method, Newton’s method & Fixed-point iteration method. Methods of solving the system of linear algebraic equations. Interpolation and regression Analysis. Numerical Differentiation. Numerical Integration. Solution of differential equation. Solution of matrix problems. Solution of boundary value problem.
Numerical Methods Vs Numerical Analysis Numerical method is a special type of method that is used to obtain an approximate solution to a mathematical problem, while a numerical analysis is the application of an appropriate numerical method to a physical problem in a systematic manner to arrive at a solution and to make interpretation of the said solution with the help of the various fast and efficient computing devices like, algorithms, programs, and computers etc.
Equations 1. Linear Equations Dy/dx+Py=Q Order and Degree = 1 2 Equations 1. Linear Equations Dy/dx+Py=Q Order and Degree = 1 2. Non Linear Equations (Equation whose graph does not form a straight line (linear) is called a Nonlinear Equation. In a nonlinear equation, the variables are either of degree greater than 1 or less than 1, but never 1.) (D2y/dx2)3+Py=Q Order=2 and Degree = 3 3. Homogenous Equations D2y/dx2+dy/dx + P=0 4. Non Homogenous Equations ex
Methods of finding solutions of non-linear equations
Choosing initial approximation The best way to choose an initial approximation to the root of equation f(x)=0 is either to plot the function f(x) or to tabulate it. The roots of the equation are the points where the curve representing the function f(x) intersects the x-axis. Therefore, any point in the interval where the function changes its sign can be taken as the initial approximation. However, if the equation f(x)=0 Can be written as f1(x) = f2(x) Then the points of intersection of the graphs of equations Y= f1(x) and y = f2(x) Give the root of the equation f(x) = 0. Therefore, any value in the neighborhood of this intersection point can be taken as the initial approximation.
Bisection Method If f(x3) = 0, then we have a root at x3. if f(x1) and f(x3) are of opposite sign, then the root lies in the interval (x1,x3). Thus x2 is replaced by x3, and the new interval, which is half of the current interval, is again bisected. if f(x1) and f(x3) are of same sign, then the root lies in the interval (x3,x2). Thus x1 is replaced by x3, and the new interval, which is half of the current interval, is again bisected.
Example: Given that one root of the non-linear equation x3- 4x - 9 = 0 lies between 2.625 and 2.75. Find the root correct to four significant places. Iteration 1: Sol: Starting with x1 = 2.625 and x2 = 2.75 f(x1) = f(2.625) = 2.6253- 4x2.625-9 = -1.4121 f(x2) = f(2.75) = 2.753 – 4x2.75-9 = 0.7969 Find x3 = (2.625+2.75)/2 = 2.6875 f(x3) = f(2.6875) = 2.68753-4x2.6875-9 = -0.3391 Replace x1 by x3. The new search interval becomes (2.6875, 2.75)
Sol: Starting with x1 = 2.6875 and x2 = 2.75 Iteration 2: Sol: Starting with x1 = 2.6875 and x2 = 2.75 f(x1) = f(2.6875) = 2.68753-4x2.6875-9= -0.3391 f(x2) = f(2.75) = 2.753 – 4x2.75-9 = 0.7969 Find x3 = (2.6875+2.75)/2 = 2.7186 f(x3) = f(2.7186) = 2.71863-4x2.7186-9 = 0.2182 Replace x2by x3. The new search interval becomes (2.6875, 2.7186)
Sol: Starting with x1 = 2.6875 and x2 = 2.7186 Iteration 3: Sol: Starting with x1 = 2.6875 and x2 = 2.7186 f(x1) = f(2.6875) = 2.68753-4x2.6875-9 = -0.3391 f(x2) = f(2.7186) = 2.71863-4x2.71865-9 = -0.2182 Find x3 = (2.6875+2.7186)/2 = 2.7031 f(x3) = f(2.7031) = 2.70313-4x2.7031-9= -0.0615 Replace x1 by x3. The new search interval becomes (2.7031, 2.7186)
FALSE POSITION METHOD
Though the bisection method guarantees that iterative process will converge, but convergence is slow. The false position method, also known as regula-falsi or method of linear interpolation, is similar to the bisection method but faster than it. It also starts with two initial approximations to the root say x1 and x2, for which f(x) has opposite signs, and then by linear interpolation the next approximation is determined. To describe its working assume that x1 and x2 are two initial approximations to root for which f(x) has opposite signs. Join the points (x1, f(x1)) and (x2, f(x2)) by a straight line. The point where this line intersects the x-axis is the next approximations to the root. Let us suppose that the line intersects the x-axis at x3. Note:- 1. interpolation is a method of constructing new data points within the range of a discrete set of known data points 2. Convergence A numerical method to solve equations will be a long process. We would like to know, if the method will lead to a solution (close to the exact solution) or will lead us away from the solution. If the method, leads to the solution, then we say that the method is convergent. Otherwise, the method is said to be divergent.
There are 3 possibilities; If f(x3)= 0, then we have a root at x3. If f(x1) and f(x3) are of opposite sign, then the root lies in the interval (x1,x3). Thus x2 is replaced by x3 and the iterative procedure is repeated. If f(x1) and f(x3) are of same sign, then the root lies in the interval (x3,x2). Thus x1 is replaced by x3 and the iterative procedure is repeated.
The iterative procedure terminates when the size of the search of the search interval becomes less than the prescribed tolerance. For derivation of the computational formula to find the intersection point, refer to figure. Slope of the joining the points(x3,0) and (x2, f(x2)) is given by tanθ = f(x2)/x2-x3 Slope of the line joining the points (x1, f(x1)) and (x2, f(x2)) is given by tanθ = f(x2)-f(x1)/x2-x3 Since the line joining the points (x3,0) and (x2, f(x2)) is a part of the line joining the points (x1, f(x1)) and (x2, f(x2)), therefore f(x2)/x2-x3 = f(x2)-f(x1)/x2-x3 Solving for x3, we get X3= x1f(x2)-x2f(x1)/f(x2)-f(x1) Which gives the next approximation to the root. In general, the (i+1)th approximation to the root is given by the formula. xi+1 = xi-1 f(xi)-xi f(xi-1) f(xi)-f(xi-1)
The expression f(xi)-f(xi-1) represents the slope of the curve in current interval. And if the value of this expression becomes very small, it will introduce a large amount of error in the new approximation. Therefore, for computer implementation, we must put a limit on the permissible slope of the curve so that the iteration procedures does not fall in an endless loop.
Example:- Given that one of the root of a non-linear equation X3-2x-5=0 Lies in the interval (1.75 , 2.5). Find the root correct to four significant digits. Sol: Since we want the solution correct to four significant digits, the iterative process will be terminated as soon as the successive iterations produces no change at first four significant positions or the function vanishes at new approximation. Iteration 1: Starting with x1=1.75 and x2=2.5 f(x1) = f(1.75) = 1.753 - 2x1.75 - 5 = -3.1406 f(x2) = f(2.5) = 2.53 - 2x2.5 - 5 = 5.625 x3 = x1f(x2) – x2f(x1)/f(x2) – f(x1)= 1.75 x 5.625-2.5 x (-3.1406)/ 5.625 – (-3.1406)= 2.0187 f(x3) = f(2.0187) = 2.01873-2 x 2.0187 – 5 = -0.8109 Since f(x1) x f(x3) = -3.1406 x (-0.8109) > 0 Therefore replace x1 by x3 . The new search interval becomes (2.0187, 2.5).
Iteration 2: Now we take x1 = 2.0187 and x2= 2.5 f(x1) = f(2.0187) = 2.01873 – 2 x 2.0187 - 5 = -0.8109 f(x2) = f(2.5) = 2.53 - 2x2.5 - 5 = 5.625 x3 = x1f(x2) – x2f(x1)/f(x2) – f(x1) = 2.0187 x 5.625-2.5 x (-0.8109)/ 5.625 – (-0.8109)= 2.0793 f(x3) = f(2.0793) = 2.0793 3-2 x 2.0793 – 5 = -0.1688 Since f(x1) x f(x3) = -0.8109 x (-0.1688) > 0 Therefore replace x1 by x3 . The new search interval becomes (2.0793, 2.5).
Iteration 3: Now we take x1 = 2. 0793 and x2= 2. 5 f(x1) = f(2 Iteration 3: Now we take x1 = 2.0793 and x2= 2.5 f(x1) = f(2.0793) = 2.07933 – 2 x 2.0793 - 5 = -0.1688 f(x2) = f(2.5) = 2.53 - 2x2.5 - 5 = 5.625 x3 = x1f(x2) – x2f(x1)/f(x2) – f(x1) = 2.0793 x 5.625-2.5 x (-0.1688)/ 5.625 – (-0.1688)= 2.0916 f(x3) = f(2.0916 ) = 2.09163-2 x 2.0916 – 5 = -0.0329 Since f(x1) x f(x3) = -0.1688 x (-0.0329) > 0 Therefore replace x1 by x3 . The new search interval becomes (2.0916, 2.5).
Iteration 4: Now we take x1 = 2. 0916 and x2= 2. 5 f(x1) = f(2 Iteration 4: Now we take x1 = 2.0916 and x2= 2.5 f(x1) = f(2.0916 ) = 2.09163 – 2 x 2.0916 - 5 = -0.0329 f(x2) = f(2.5) = 2.53 - 2x2.5 - 5 = 5.625 x3 = x1f(x2) – x2f(x1)/f(x2) – f(x1) = 2.0916 x 5.625-2.5 x (-0.329)/ 5.625 – (-0.329)= 2.0940 f(x3) = f(2.0940) = 2.09403-2 x 2.0940 – 5 = -0.0062 Since f(x1) x f(x3) = -0.03299 x (-0.0062) > 0 Therefore replace x1 by x3 . The new search interval becomes (2.0940, 2.5).
Iteration 5: Now we take x1 = 2. 0940 and x2= 2. 5 f(x1) = f(2 Iteration 5: Now we take x1 = 2.0940 and x2= 2.5 f(x1) = f(2.0940) = 2.09403 – 2 x 2.0940 - 5 = -0.0329 f(x2) = f(2.5) = 2.53 - 2x2.5 - 5 = 5.625 x3 = x1f(x2) – x2f(x1)/f(x2) – f(x1) = 2.0940 x 5.625-2.5 x (-0.0062)/ 5.625 – (-0.0062)= 2.0944 f(x3) = f(2.0944) = 2.09443-2 x 2.0944 – 5 = -0.0017 Since f(x1) x f(x3) = -0.0062 x (-0.0017) > 0 Therefore replace x1 by x3 . The new search interval becomes (2.0944, 2.5).
Iteration 6: Now we take x1 = 2. 0944 and x2= 2. 5 f(x1) = f(2 Iteration 6: Now we take x1 = 2.0944 and x2= 2.5 f(x1) = f(2.0944) = 2.09443 – 2 x 2.0944 - 5 = -0.0017 f(x2) = f(2.5) = 2.53 - 2x2.5 - 5 = 5.625 x3 = x1f(x2) – x2f(x1)/f(x2) – f(x1) = 2.0944 x 5.625-2.5 x (-0.0017)/ 5.625 – (-0.0017)= 2.0945 f(x3) = f(2.0945) = 2.09453-2 x 2.0945 – 5 = -0.0006 Since f(x1) x f(x3) = -0.0017 x (-0.0006) > 0 Therefore replace x1 by x3 . The new search interval becomes (2.0945, 2.5). Observe that iteration 4,5, and 6 produce no change at four significant positions in the successive approximations to the root. Therefore, we take x=2.094 as the desired solution correct to four significant digits.
Example:- Find the root of equation Cos x -3x+1=0 Correct to three decimal positions using False position method. Sol: Since we want the solution correct to three decimal positions, the iterative process be terminated as soon as the successive iterations produce no changes at first three decimal positions or the function vanishes at new approximation.
Now f(0) = cos (0) – 3X0+1 = 2. 0 f(1) = cos (1) – 3X1+1 = -1 Now f(0) = cos (0) – 3X0+1 = 2.0 f(1) = cos (1) – 3X1+1 = -1.4597 Since f(0) is +ve and f(1) is –ve, therefore one root lies between 0 and 1. Iteration 1: Now we take x1 = 0 and x2= 1 f(0) = cos (0) – 3 x 0 +1 = 2.0 f(1) = cos (1) - 3x1 +1 = -1.4579 x3 = x1f(x2) – x2f(x1)/f(x2) – f(x1) = 0x (-1.4579)-1 x 2.0/-1.4597 – 2.0= 0.5781 f(x3) = f(0.5781) = cos (0.5781)-3 x 0.5781+1 = 0.1033 Thus, the first approximation to the root is 0.5781 Since f(x1) x f(x3) = 2.0 x 0.1033 > 0 Therefore replace x1 by x3 . The new search interval becomes (0.5781, 1.0).
Iteration 2: Now we take x1 = 0. 5781 and x2= 1 f(x1)=f(0 Iteration 2: Now we take x1 = 0.5781 and x2= 1 f(x1)=f(0.5781) = cos (0.5781) – 3 x 0.5781 +1 = 0.1033 f(x2)=f(1) = cos (1) - 3x1 +1 = -1.4579 x3 = x1f(x2) – x2f(x1)/f(x2) – f(x1) = 0.5781 x (-1.4579)-1 x 0.1033/-1.4597 – 0.1033= 0.6060 f(x3) = f(0.6060) = cos (0.6060)-3 x 0.6060+1 = 0.0041 Thus, the second approximation to the root is 0.6060 Since f(x1) x f(x3) = 0.1033 x 0.0041 > 0 Therefore replace x1 by x3 . The new search interval becomes (0.6060, 1.0).
Iteration 3: Now we take x1 = 0.6060 and x2= 1 f(x1)=f(0.6060) = cos (0.6060) – 3 x 0.6060 +1 = 0.0041 f(x2)=f(1) = cos (1) - 3x1 +1 = -1.4579 x3 = x1f(x2) – x2f(x1)/f(x2) – f(x1) = 0.6060 x (-1.4579)-1 x 0.0041/-1.4597 – 0.0041= 0.6071 f(x3) = f(0.6071) = cos (0.6071)-3 x 0.6071 + 1 = 0.0002 Thus, the third approximation to the root is 0.6071 Since f(x1) x f(x3) = 0.0041 x 0.0002 > 0 Therefore replace x1 by x3 . The new search interval becomes (0.6071, 1.0).
Iteration 4: Now we take x1 = 0. 6071 and x2= 1 f(x1)=f(0 Iteration 4: Now we take x1 = 0.6071 and x2= 1 f(x1)=f(0.6071) = cos (0.6071) – 3 x 0.6071 +1 = 0.0002 f(x2)=f(1) = cos (1) - 3x1 +1 = -1.4579 x3 = x1f(x2) – x2f(x1)/f(x2) – f(x1) = 0.6071 x (-1.4579)-1 x 0.0002/-1.4597 – 0.0002= 0.6072 f(x3) = f(0.6072) = cos (0.6072)-3 x 0.6072 + 1 = 0.0001 Thus, the third approximation to the root is 0.6072 Since last two iterations produce no change at the first three decimal positions, therefore, we take x=0.607 as the desired solution correct to three decimal positions.
SECANT METHOD
The secant method is similar to the False Position method with only one difference. In Secant method, two most recent approximations to the root are used to find the new approximation instead of using only those two approximations that bound the interval containing the root. In addition, it is not necessary for the initial approximations to enclose the root. The secant method is much faster than the false position method, but the only difficulty with secant method is that convergence is not always assured. To describe its working assume that x1 and x2 are two approximations to the root. Join the points (x1,f(x1)) and (x2,f(x2)) by a straight line. The point where this line intersects the x-axis gives next approximation to the root. Let this intersection point be x3. Now x2 and x3 are taken as the starting approximation for the next iteration. The line drawn joining the points (x2,f(x2)) and (x3,f(x3)). Let this intersection point be x4. The iterative procedure terminates when the relative error in two successive approximations is less than or equal to the prescribe tolerance.
Proceeding on similar lines as in the case of false position method, the general formula for secant method can be derived as. xi+1 = xi-1 f(xi)-xi f(xi-1) f(xi)-f(xi-1) Since the convergence is not always assured, therefore, we put a limit on the maximum number of iterative permitted.
Example:- Given that one of the root of non-linear equation Cos x –xex =0 Lies between 0.5 and 1.0. Find the root correct to three decimal positions places. Sol: Since we want the solution correct to three decimal positions, the iterative process be terminated as soon as the successive iterations produce no changes at first three decimal positions or the function vanishes at new approximation.
Iteration 1: Now we take x1 = 0. 5 and x2= 1. 0 f(x1)=f(0. 5) = cos (0 Iteration 1: Now we take x1 = 0.5 and x2= 1.0 f(x1)=f(0.5) = cos (0.5) – 0.5 x e0.5 = 0.175 f(x2)=f(1.0) = cos (1.0) – 1.0 x e1.0 = -1.719 x3 = x1f(x2) – x2f(x1) f(x2) – f(x1) 0.5x (-1.719)-1.0 x 0.175 = 0.546 -1.719 – 0.175 f(x3) = f(0.546) = cos (0.546)- 0.546) x e0.546 = 0.057
Iteration 2: Now we take x1 = 1. 0 and x2= 0. 546 f(x1) = -1 Iteration 2: Now we take x1 = 1.0 and x2= 0.546 f(x1) = -1.719 f(x2) = 0.057 x3 = x1f(x2) – x2f(x1) f(x2) – f(x1) 1.0x 0.057-0.546 x (-1.719) = 0.560 0.057-(-1.719) f(x3) = f(0.560) = cos (0.560)- 0.560 x e0.560 = 0.019
Iteration 3: Now we take x1 = 0. 546 and x2= 0. 560 f(x1) = 0 Iteration 3: Now we take x1 = 0.546 and x2= 0.560 f(x1) = 0.546 f(x2) = 0.56 x3 = x1f(x2) – x2f(x1) f(x2) – f(x1) 0.546 x 0.177- 0.560 x 0.057 = 0.567 0.177 – 0.057 f(x3) = f(0.567) = cos (0.567)- 0.567 x e0.567 = 0.0000 Observe that after third iteration, the function f(x) vanishes i.e. becomes zero. Therefore x = 0.567 is taken as the approximate solution.
Example:- Find the root of equation. x3-5x+3=0 Correct to three decimal positions using Secant method. Sol: Since we want the solution correct to three decimal positions, the iterative process be terminated as soon as the successive iterations produce no changes at first three decimal positions or the function vanishes at new approximation.
Iteration1: Starting with x1=0 and x2=1 f(0) = 03-5x0+3= 3.0 Now f(0) = 03-5x0+3= 3.0 f(1) = 13-5x1+3= -1.0 Since f(0) is +ve and f(1) is –ve, therefore one root lies between 0 and 1. Iteration1: Starting with x1=0 and x2=1 f(0) = 03-5x0+3= 3.0 x3 = x1f(x2) – x2f(x1) f(x2) – f(x1) 0x(-1.0)-1x3.0 = 0.75 -1.0-3.0 F(x3) = f(0.75)=0.753-5x0.75+3= -0.3281 Thus, the first approximation to the root is 0.75.
Iteration2: Starting with x1=1.0 and x2=0.75 f(x1) = -1.0 x3 = x1f(x2) – x2f(x1) f(x2) – f(x1) 1.0x(-0.3281)-0.75x(-1.0) = 0.6279 -0.3281-(-1.0) F(x3) = f(0.6279)=0.62793-5x0.6279+3= 0.1080 Thus, the second approximation to the root is 0.6279
Example: Find the root of equation X3-5x+3=0 Now f(0) = 03-5x0+3 = 3.0 Since f(0) is +ve and f(1) is –ve, therefore one root lies between 0 and 1. Iteration 1: Starting with x1=0 and x2=1
x3 = x1f(x2) – x2f(x1) f(x2) – f(x1) 0x(-1.0)-1 x 3 = 0.75 -1.0 - 3.0 f(x3) = f(0.75)=0.753-5x0.75+3= -0.3281 Thus, the first approximation to the root is 0.75
Iteration 2: Since we take the last approximations Iteration 2: Since we take the last approximations. Therefore, we have X1 = -1.0 and x2=0.75 f(x1) = -1.0 and f(x2) = -0.3281 X3 = 1.0x(-0.3281)-0.75x(-1.0) = 0.6279 -0.3281 – (-1.0) f(x3) = f(0.6279) = 0.62793-5x0.6279+3 = 0.1080 Thus, the second approximation to the root is 0.6279.
Iteration 3: Since we take the last approximations Iteration 3: Since we take the last approximations. Therefore, we have X1 = 0.75 and x2=0.6279 f(x1) = -0.3281 and f(x2) = 0.1080 X3 = 0.75x 0.1080 – 0.6279 x (-0.3281) = 0.6582 0.1080 – (- 0.3281) f(x3) = f(0.6582) = 0.65823-5x0.6582+3 = -0.0057 Thus, the third approximation to the root is 0.6582. Subsequent two iterations produce 0.6566 as the approximation to the root, where function also nearly vanishes. Thus, we take x= 0.656 as the desired solution correct to three decimal positions.
Example: Using Secant method, find the appropriate value of correct to three decimal places.
Sol: Let x= X2=12 X2-12 = 0 Iteration 1: Starting with x1 = 3 and x2 = 4 f(3) = -3.0 f(4) = 4.0 x3 = 3.4286 f(x3) = -0.2447 Thus the first approximation to root is 3.4286.
Iteration 2: Starting with x1 = 4 and x2 = 3. 4286 f(4) = 4. 0 f(3 Iteration 2: Starting with x1 = 4 and x2 = 3.4286 f(4) = 4.0 f(3.4286) = -0.2449 x3 = 3.4615 f(x3) = -0.0180 Thus the second approximation to root is 3.4615. Iteration 3: Starting with x1 = 3.4286 and x2 = 3.4615 f(3.4615) = - 0.0178 x3 = 3.4641 f(x3) = -0.0001 Thus the third approximation to root is 3.4641.
Iteration 4: Starting with x1 = 3. 4615 and x2 = 3. 4641 f(3 Iteration 4: Starting with x1 = 3.4615 and x2 = 3.4641 f(3.4615) = -0.0178 f(3.4641) = 0.0001 x3 = 3.4641 Since, this iteration also produces the same approximation as previous iteration, therefore we terminate iteration here and take x = 3.464 as the desired solution correct to three decimal positions of equation X2-12 = 0. Thus, the approximate value of correct to three decimal positions is 3.464
GRAPHICAL METHOD
The given equation is f(x) = x2-3 X Y X = 0 f(0) = -3 X = 1 f(1) = -2 X = 2 f(2) = 1 X = 3 f(3) = 6
Y 8 7 6 5 4 3 2 1 -3 -2 -1 1 2 3 4 5 6 7 8 X -1 -2 -3 -4
Newton –Raphson Method
The Newton Raphson method, also known as Newton’s method of tangents, is one of the fastest iterative methods. This method begins with on initial approximation. Here one have to take care while selecting the initial approximation, as it is very sensitive to the initial approximation. Once proper choice is made for the initial approximation, it converges faster that False Position and the Secant method.
Geometric Derivation The slope of the curve at point (x0,fx0) is given by Tan θ = f(x0) = f’(x0) x0-x1 Solving for x1, we get x1= x0 – f(x0) f’(x0)
The next approximation would be x2= x1 – f(x1) f’(x1) In general, the (i+1)th approximation is obtained from the ith approximation as xi+1= xi – f(xi) f’(xi)
X3-4x-9=0 Sol: Given f(x) = X3- 4x - 9 f’(x) = 3X2 - 4 Example: Given the one root of the non-linear equation X3-4x-9=0 Lies between 2.625 and 3.0. Find the root correct to four significant digits. Sol: Given f(x) = X3- 4x - 9 f’(x) = 3X2 - 4 Iteration 1: we start with x0 = 2.95 f(x0) = f(2.95) = 2.953-4x 2.95-9 = 4.8724 f’(x0) = f’(2.95) = 3 x 2.952-4 = 22.1075
x1= x0 – f(x0) f’(x0) 2.95 – 4.8724 = 2.7296 22.1075 Iteration 2: Now taking x0 = 2.7296 f(x0) = f(2.7296) = 2.72963-4x 2.7296-9 = 0.4191 f’(x0) = f’(2.7296) = 3 x 2.72962-4 = 18.3521 2.7296 – 0.4191 = 2.7068 18.3521
Iteration 3: Now taking x0 = 2.7068 f(x0) = f(2. 7068) = 2. 70683-4x 2.7068-9 = 0.0049 f’(x0) = f’(2. 7068) = 3 x 2. 70682-4 = 17.9803 x1= x0 – f(x0) f’(x0) 2.7068 – 0.0049 = 2.7065 17.9803
Iteration 4: Now taking x0 = 2.7065 f(x0) = f(2. 7065) = 2. 70653-4x 2.7065-9 = -0.0005 f’(x0) = f’(2. 7065) = 3 x 2. 70652-4 = 17.9754 x1= x0 – f(x0) f’(x0) 2.7065 – (-0.0005) = 2.7065 17.9754 Therefore, we take x = 2.7065 as the desired solution.
Example: Given the one root of the equation X3-X-4=0 Find the root correct to four significant digits. Sol. Given f(x)= X3-X-4 Therefore f’(x)= 3X2-1 Iteration 1: we Start with x0 = 2 f(2) = 23-2-4 = 2 f’(2) = 3 X 22-1 = 11 X1 = 2 – 2 =1.8182 11 Thus, the first approximation to the root is 1.8182.
Homework Example: Equation sinx-x-2 = 0 lies near x = 2.5.
Graphical Method
For illustration, consider the equation 2x-x-3=0 Which has two distinct roots. We are interested to find the intervals that contain the root. In order to do that, the values of f(x) = 2x-x-3=0 Are tabulated for various values of x. These values are listed in the following table.
Tabulated data for the function f(x) = 2x-x-3=0 The root lies between those points where there is a sign change in f(x). Hence, the root lies in the interval (-3,-2) and (2,3). We can state this result more concisely and in a form more suited for use on computers as:- If f(x) is a continuous function and f(a) x f(b) <0, then the equation f(x) = 0 has a root (say Z) lying in the interval (a , b) or in the interval (b , a) if b < a. X -4 -3 -2 -1 1 2 3 4 f(x) 1.0625 0.125 -0.75 -1.5 9
Y 9 f(x) 8 7 6 5 4 3 2 1 -4 -3 -2 -1 1 2 3 4 x
Fixed Point Method Or Method of Successive Approximations Direct Substitution Method Method of Fixed Iterations Method of Iterations
This method also known as the direct substitution method or method of iterations or method of fixed iterations or method of successive approximation, is applicable if the equation f(x) = 0 can be expressed as x = g(x) If x1 is the initial approximation to the root, then the next approximation to the root is given by x2 = g(x1) and the next approximation will be x3 = g(x2) In general xi+1 = g(xi)
Example: Given the one root of the non-linear equation 2x-x-3 = 0 Lies in the interval (-3,-2). Find the root correct to three decimal places. Sol: The given equation is Must be written in the form x = g(x) Therefore, re-arranging the given equation, we get x = 2x - 3 Thus giving g(x) = 2x - 3
x2 = g(x1) x3 = g(x2) x4 = g(x3) = 2-3-3 = -2.875 Iteration 1: Let us start with initial approximation x1 = -3 x2 = g(x1) = 2-3-3 = -2.875 Iteration2 : Now we take x2 = -2.875 as the current approximation to obtain the next approximation as x3 = g(x2) = 2-2.875-3 = -2.8675 Iteration3 : Now we take x3 = -2.8675 as the current approximation to obtain the next approximation as x4 = g(x3) = 2-2.8675-3 = -2.8626
Iteration 4 : Now we take x4 = -2 Iteration 4 : Now we take x4 = -2.875 as the current approximation to obtain the next approximation as x5 = g(x4) = 2-2.8626-3 = -2.8625 Iteration 5 : Now we take x5 = -2.875 as the current approximation to obtain the next approximation as x6 = g(x5) = 2-2.8625-3 = -2.8625 We see that after iteration 3, there is no change at the first four significant digits. Therefore we take x = -2.862 as the desired solution correct to four significant digits.
Example: Find the root of equation 2x-cosx-3 = 0 Sol: Let f(x) = 2x-cosx-3 f(0) = 0 - cos0 – 3 = -4 f(2) = 4 – cos2- 3 = 0.001 Thus, a root lies between 0 and 2. Further to apply iteration method, the equation 2x – cosx – 3 = 0 Must be written in the form x = g(x) Therefore, re-arranging the given equation, we get X = 1 (cos x +3) 2 Thus giving g(x) = 1 (cos x+3) 2
Iteration1: Let us start with initial approximation x1 = 1 Iteration1: Let us start with initial approximation x1 = 1.5 x2 = g(x1) = 1 (cos1.5+3) = 1.5354 2 Thus the first approximation to the root is 1.5354 Iteration2: Now we take x2 = 1.5354 as the current approximation to obtain the next approximation as x3 = g(x2) = 1 (cos1.5354 + 3) = 1.5178 Thus, the second approximation to the root is 1.5178 Iteration3: Now we take x2 = 1.5178 as the current approximation to obtain the next approximation as x4 = g(x3) = 1 (cos1.5178 + 3) = 1.5665
Thus, the third approximation to the root is 1. 5665 Thus, the third approximation to the root is 1.5665. The subsequent iterations produce the following approximations to the root 1.5665, 1.5221, 1.5243, 1.5232, 1.5238, 1.5235, 1.5236 Observe that the last four iterations produce no change at first three decimal places in the successive approximations to the root. Therefore, we take x = 1.523 as the desired solution correct to three decimal places.
Example: Find the root of equation 2x - log10 x - 7=0 Sol: Let f(x) = 2x-log10 x - 7 f(3) = 6 – log10 3- 7 = 6-0.4771-7 = -1.4471 f(4) = 8 - log10 4- 7 = 8-0.602-7 = 0.398 Thus, a root lies between 3 and 4 Further to apply iteration method, the equation 2x - log10 x -7=0 Must be written in the form x = g(x) Therefore, re-arranging the given equation, we get x =1 (log10 x + 7) 2 g(x) = 1 (log10 x + 7)
Iteration1: Let us start with initial approximation x1 = 3 Iteration1: Let us start with initial approximation x1 = 3.5 X2 = g(x1) = 1 (log10 3.5 + 7) = 3.7720 2 Thus, the first approximation to the root is 3.7720. Iteration2: Now we take x2 = 3.7710 as the current approximation to obtain the next approximation as X3 = g(x2) = 1 (log10 3.7720 + 7) = 3.7883 Iteration3: Now we take x2 = 3.7883 as the current approximation to obtain the next approximation as X4 = g(x3) = 1 (log10 3.7883 + 7) = 3.7892