Presentation is loading. Please wait.

Presentation is loading. Please wait.

Solution of Nonlinear Equation (b)

Similar presentations


Presentation on theme: "Solution of Nonlinear Equation (b)"— Presentation transcript:

1 Solution of Nonlinear Equation (b)
Dr. Asaf Varol

2 Secant Method Similar approach as the Newton-Raphson method
Differs because the derivative does not need to be calculated analytically, which can be a great advantage F(xi) = [F(xi) - F(xi-1)]/(xi – xi-1) Disadvantage is that two initial guesses are needed instead of one

3 Graphical Interpretation of Newton-Raphson and Secant Method

4 Example: Secant Method
Water flow from a tower at a height h, through a pipe of diameter D and length L which is connected to the tower running vertically downward and then laid horizontally to the desired point of delivery. For this system the following equation for the flow rate Q is found. Find the roots using the Secant Method.

5 Matlab Program

6 Result for Secant Method

7 Multiplicity of Roots and Newton-Based Methods
In some situations, one root can fulfill the role of being a root more than one time. For example, the equation F(x) = x3 - x2 - x + 1= (x + 1)(x - 1)2 = 0 has three roots, namely x = -1, and x = 1 with a multiplicity of two Using l’Hospital’s Rule, the Newton-Raphson method can be modified xi+1 = xi - F(xi)/F(xi) Or, if the second derivative is also zero then l'Hospital's rule can be applied once more to obtain xi+1 = xi - F(xi)/F(xi)

8 Multiplicity of Roots and Newton-Based Methods

9 Example E2.4.1 Problem: Apply Newton-Raphson method to the polynomial equation F(x) = x3 - 3x2 + 3x - 1 = (x - 1)3 = 0 Solution: First we apply Newton-Raphson method without any modification of the given function. It can be shown that the method does not converge for any of the starting values x0 = 0., 0.5, 0.9, and 1.5. In fact the iterations oscillate between and But if we make the following substitution U(x) = F(x) and U(x) = F(x) and apply the same method, i.e. xi+1 = xi - U(xi)/U(xi) then the method converges in 24 iterations to the root x= with an error bound of 1.0E-07, and starting value of x=0.0

10 Systems of Nonlinear Equations
Extension of the previous methods to systems of N equations with N variables Our discussion will be limited to solutions to the following system of nonlinear equations: F(x,y) = 0 G(x,y) = 0 For example, x2 + y2 - 2 = 0 -exp(-x) + y = 0

11 Jacobi Iteration Method
Jacobi method is an extension of the fixed-point iteration method to systems of equations The equations F(x,y) = 0 G(x,y) = 0 need to be transformed into x = f(x,y) y = g(x,y) Actual iteration is similar to the case of one equation with one variable xi+1 = f(xi,yi) yi+1 = g(xi,yi)

12 Jacobi Iteration Method
Convergence criteria - in the vicinity of the root (xr, yr),

13 Example E2.5.1a

14 Matlab for Jacobi Method
%Jacobi Iteration Method x0=0.0; y0=0.0 E=1.0E-4; % %---writing out headers to the file 'jacobimethod.dat' fid=fopen('jacobi.dat','w'); fprintf(fid,'Roots of Equations x-5+exp(-xy)=0 \n\n') fprintf(fid,'Roots of Equations y-1+exp(-0.5x)cos(xy)=0 \n\n') fprintf(fid,'Using Jacobi Method \n') fprintf(fid,'iter x y ErrorX ErrorY \n'); fprintf(fid,' \n'); %---entering the loop to determine the root

15 Matlab for Jacobi Method (Cont’d)
for i=1:100 x1=5-exp(-x0*y0); y1=1-exp(-0.5*x0)*cos(x0*y0); errorx=abs(x1-x0); errory=abs(y1-y0); %---writing out results to the file 'jacobi method.dat' % fprintf(fid,'%4.1f %7.4f %7.4f %7.4f %7.4f \n',i,x1,y1,errorx,errory); if abs(x1-x0)<E&abs(y1-y0)<E break; end x0=x1; y0=y1; fclose(fid) disp('Roots approximation=') x1,y1

16 Results for Jacobi Method

17 Gauss-Seidel Iteration Method
Similar to the Jacobi iteration method Differs by using updated x or y values (i.e. the approximate roots) for calculations

18 Newton’s Method (I) Consider the two nonlinear equations F(x,y) = 0
G(x,y) = 0 The Taylor series expansion for a function F(x, y) is where ( )x and ( )xx denote the first and second partial derivatives with respect to x, and similarly for ( )y , ( )yy and ( )xy

19 Newton’s Method (II) Keeping the first three terms on the right-hand side yields Solving these equations for x and y after letting yields where J is the Jacobian defined by J = (FxGy - GxFy)

20 Newton’s Method (III) Retaining only two terms and thus simplifying the equations,

21 Technique of Underrelaxation and Overrelaxation
Expresses ‘confidence’ in the new estimate of the root Underrelaxation 0 < < 1 Overrelaxation - 1 < < 2 Can be applied to Newton’s method as

22 Case Study C2.2: Two Intersecting Circles

23 Case Study C2.2: Two Intersecting Circles (Cont’d)

24 Case Study C2.3: Damped Oscillation of an Object

25 Case Study C2.3: Damped Oscillation of an Object (continued)

26 Case Study C2.3: Damped Oscillation of an Object (continued)

27 Case Study C2.3: Damped Oscillation of an Object (continued)

28 Case Study C2.3: Damped Oscillation of an Object (continued)

29 Case Study C2.3: Damped Oscillation of an Object (continued)

30 Case Study C2.3: Damped Oscillation of an Object (continued)

31 End of Chapter 2b

32 References Celik, Ismail, B., “Introductory Numerical Methods for Engineering Applications”, Ararat Books & Publishing, LCC., Morgantown, 2001 Fausett, Laurene, V. “Numerical Methods, Algorithms and Applications”, Prentice Hall, 2003 by Pearson Education, Inc., Upper Saddle River, NJ 07458 Rao, Singiresu, S., “Applied Numerical Methods for Engineers and Scientists, 2002 Prentice Hall, Upper Saddle River, NJ 07458 Mathews, John, H.; Fink, Kurtis, D., “Numerical Methods Using MATLAB” Fourth Edition, 2004 Prentice Hall, Upper Saddle River, NJ 07458 Varol, A., “Sayisal Analiz (Numerical Analysis), in Turkish, Course notes, Firat University, 2001


Download ppt "Solution of Nonlinear Equation (b)"

Similar presentations


Ads by Google