Presentation is loading. Please wait.

Presentation is loading. Please wait.

ROOTS OF EQUATIONS Student Notes ENGR 351 Numerical Methods for Engineers Southern Illinois University Carbondale College of Engineering Dr. L.R. Chevalier.

Similar presentations


Presentation on theme: "ROOTS OF EQUATIONS Student Notes ENGR 351 Numerical Methods for Engineers Southern Illinois University Carbondale College of Engineering Dr. L.R. Chevalier."— Presentation transcript:

1 ROOTS OF EQUATIONS Student Notes ENGR 351 Numerical Methods for Engineers Southern Illinois University Carbondale College of Engineering Dr. L.R. Chevalier Dr. B.A. DeVantier

2 Applied Problem The concentration of pollutant bacteria C in a lake decreases according to: Determine the time required for the bacteria to be reduced to 10 ppm.

3 You buy a $20 K piece of equipment for nothing down and $5K per year for 5 years. What interest rate are you paying? The formula relating present worth (P), annual payments (A), number of years (n) and the interest rate (i) is: Applied Problem

4 Quadratic Formula This equation gives us the roots of the algebraic function f(x) i.e. the value of x that makes f(x) = 0 How can we solve for f(x) = e -x - x?

5 Roots of Equations  Plot the function and determine where it crosses the x-axis  Lacks precision  Trial and error

6 Overview of Methods  Bracketing methods Bisection method False position  Open methods Newton-Raphson Secant method

7  Understand the graphical interpretation of a root  Know the graphical interpretation of the false-position method (regula falsi method) and why it is usually superior to the bisection method  Understand the difference between bracketing and open methods for root location Specific Study Objectives

8  Understand the concepts of convergence and divergence.  Know why bracketing methods always converge, whereas open methods may sometimes diverge  Know the fundamental difference between the false position and secant methods and how it relates to convergence Specific Study Objectives

9  Understand the problems posed by multiple roots and the modification available to mitigate them  Use the techniques presented to find the root of an equation  Solve two nonlinear simultaneous equations using techniques similar to root finding methods Specific Study Objectives

10 Bracketing Methods  Bisection method  False position method (regula falsi method)

11 Graphically Speaking xlxl xuxu 1.Graph the function 2.Based on the graph, select two x values that “bracket the root” 3.What is the sign of the y value? 4.Determine a new x (x r ) based on the method 5.What is the sign of the y value of x r ? 6.Switch x r with the point that has a y value with the same sign 7.Continue until f(x r ) = 0 xrxr

12 x f(x) x x x consider lower and upper bound same sign, no roots or even # of roots opposite sign, odd # of roots Theory Behind Bracketing Methods

13 Bisection Method  x r = (x l + x u )/2  Takes advantage of sign changing  There is at least one real root x f(x)

14 Graphically Speaking xlxl xuxu 1.Graph the function 2.Based on the graph, select two x values that “bracket the root” 3.What is the sign of the y value? 4.x r = (x l + x u )/2 5.What is the sign of the y value of x r ? 6.Switch x r with the point that has a y value with the same sign 7.Continue until f(x r ) = 0 xrxr

15 Algorithm  Choose x u and x l. Verify sign change f(x l )f(x u ) < 0  Estimate root x r = (x l + x u ) / 2  Determine if the estimate is in the lower or upper subinterval f(x l )f(x r ) < 0 then x u = x r RETURN f(x l )f(x r ) >0 then x l = x r RETURN f(x l )f(x r ) =0 then root equals x r - COMPLETE

16 Error Let’s consider an example problem:

17 f(x) = e -x - x x l = -1 x u = 1 Use the bisection method to determine the root Example STRATEGY

18 Strategy  Calculate f(x l ) and f(x u )  Calculate x r  Calculate f(x r )  Replace x l or x u with x r based on the sign of f(x r )  Calculate  a based on x r for all iterations after the first iteration  REPEAT

19 False Position Method  “Brute Force” of bisection method is inefficient  Join points by a straight line  Improves the estimate  Replacing the curve by a straight line gives the “false position”

20 xlxl xuxu f(x l ) f(x u ) next estimate, x r Based on similar triangles

21 Determine the root of the following equation using the false position method starting with an initial estimate of x l =4.55 and x u =4.65 f(x) = x 3 - 98 Example STRATEGY

22 Strategy  Calculate f(x l ) and f(x u )  Calculate x r  Calculate f(x r )  Replace x l or x u with x r based on the sign of f(x r )  Calculate  a based on x r for all iterations after the first iteration  REPEAT

23 Example Spreadsheet  Use of IF-THEN statements  Recall in the bi-section or false position methods.  If f(x l )f(x r )>0 then they are the same sign  Need to replace x u with x r  If f(x l )f(x r )< 0 then they are opposite signs  Need to replace x l with x r

24 Example Spreadsheet If f(x l )f(x r ) is negative, we want to leave x u as x u If f(x l )f(x r ) is positive, we want to replace x u with x r The EXCEL command for the next x u entry follows the logic If f(x l )f(x r ) < 0, x u,x r ? Example Spreadsheet

25 Pitfalls of False Position Method

26 Open Methods  Newton-Raphson method  Secant method  Multiple roots  In the previous bracketing methods, the root is located within an interval prescribed by an upper and lower boundary

27 Newton Raphson most widely used f(x) x

28 Newton Raphson f(x i ) xixi tangent x i+1

29 Newton Raphson  A is the initial estimate  B is the function evaluated at A  C is the first derivative evaluated at A  D= A-B/C  Repeat ixf(x)f’(x) 0ABC 1D 2

30 Solution can “overshoot” the root and potentially diverge x0x0 f(x) x x1x1 x2x2 Newton Raphson Pitfalls

31 Use the Newton Raphson method to determine the root of f(x) = x 2 - 11 using an initial guess of x i = 3 Example STRATEGY

32 Strategy  Start a table to track your solution ixixi f(x i )f ’ (x i ) 0x0x0  Calculate f(x) and f’(x)  Estimate the next x i based on the governing equation  Use  s to determine when to stop  Note: use of subscript “0”

33 Secant method Approximate derivative using a finite divided difference What is this? HINT: dy / dx =  y /  x Substitute this into the formula for Newton Raphson

34 Secant method Substitute finite difference approximation for the first derivative into this equation for Newton Raphson

35 Secant method  Requires two initial estimates  f(x) is not required to change signs, therefore this is not a bracketing method

36 Secant method new estimate initial estimates slope between two estimates f(x) x {

37 Determine the root of f(x) = e -x - x using the secant method. Use the starting points x 0 = 0 and x 1 = 1.0. Example STRATEGY

38 Strategy  Start a table to track your results ixixi f(x i ) aa 00Calculate 11 2  Note: here you need two starting points!  Use these to calculate x 2  Use x 3 and x 2 to calculate  a at i=3  Use  s

39 Comparison of False Position and Secant Method x f(x) x 1 1 2 new est. 2

40 Multiple Roots  Corresponds to a point where a function is tangential to the x-axis  i.e. double root f(x) = x 3 - 5x 2 + 7x -3 f(x) = (x-3)(x-1)(x-1) i.e. triple root f(x) = (x-3)(x-1) 3

41 Difficulties  Bracketing methods won’t work  Limited to methods that may diverge

42  f(x) = 0 at root  f '(x) = 0 at root  Hence, zero in the denominator for Newton-Raphson and Secant Methods  Write a “DO LOOP” to check is f(x) = 0 before continuing

43 Multiple Roots

44 Systems of Non-Linear Equations  We will later consider systems of linear equations f(x) = a 1 x 1 + a 2 x 2 +...... a n x n - C = 0 where a 1, a 2.... a n and C are constant  Consider the following equations y = -x 2 + x + 0.5 y + 5xy = x 3  Solve for x and y

45 Systems of Non-Linear Equations cont.  Set the equations equal to zero y = -x 2 + x + 0.5 y + 5xy = x 3  u(x,y) = -x 2 + x + 0.5 - y = 0  v(x,y) = y + 5xy - x 3 = 0  The solution would be the values of x and y that would make the functions u and v equal to zero

46 Recall the Taylor Series

47 Write a first order Taylor series with respect to u and v The root estimate corresponds to the point where u i+1 = v i+1 = 0

48 Therefore THE DENOMINATOR OF EACH OF THESE EQUATIONS IS FORMALLY REFERRED TO AS THE DETERMINANT OF THE JACOBIAN This is a 2 equation version of Newton-Raphson

49  Determine the roots of the following nonlinear simultaneous equations x 2 +xy=10 y + 3xy 2 = 57  Use and initial estimate of x=1.5, y=3.5 Example STRATEGY

50 Strategy  Rewrite equations to get u(x,y) = 0 from equation 1 v(x,y) = 0 from equation 2  Determine the equations for the partial of u and v with respect to x and y  Start a table! ixixi yiyi u (x,y)v(x,y)du/dxdu/dydv/dxdv/dyJ

51  Understand the graphical interpretation of a root  Know the graphical interpretation of the false-position method (regula falsi method) and why it is usually superior to the bisection method  Understand the difference between bracketing and open methods for root location Specific Study Objectives

52  Understand the concepts of convergence and divergence.  Know why bracketing methods always converge, whereas open methods may sometimes diverge  Know the fundamental difference between the false position and secant methods and how it relates to convergence Specific Study Objectives

53  Understand the problems posed by multiple roots and the modification available to mitigate them  Use the techniques presented to find the root of an equation  Solve two nonlinear simultaneous equations Specific Study Objectives

54 The concentration of pollutant bacteria C in a lake decreases according to: Determine the time required for the bacteria to be reduced to 10 using Newton-Raphson method. Applied Problem

55 You buy a $20 K piece of equipment for nothing down and $5K per year for 5 years. What interest rate are you paying? The formula relating present worth (P), annual payments (A), number of years (n) and the interest rate (i) is: Use the bisection method Applied Problem


Download ppt "ROOTS OF EQUATIONS Student Notes ENGR 351 Numerical Methods for Engineers Southern Illinois University Carbondale College of Engineering Dr. L.R. Chevalier."

Similar presentations


Ads by Google