0
ROOTS OF EQUATIONS              ENGR 351  Numerical Methods for EngineersSouthern Illinois University Carbondale       Col...
Quadratic Formula                  − b ± b 2 − 4 ac             x=                          2a             f ( x) = ax 2 +...
Roots of Equations• Plot the function and determine where it  crosses the x-axis• Lacks precision          f(x)=e-x-x     ...
Overview of Methods• Bracketing methods  Graphing method  Bisection method  False position• Open methods  One point iterat...
Specific Study Objectives• Understand the graphical interpretation of a  root• Know the graphical interpretation of the fa...
Specific Study Objectives• Understand the concepts of convergence and  divergence.• Know why bracketing methods always  co...
Specific Study Objectives• Know the fundamental difference between the  false position and secant methods and how it  rela...
Bracketing Methods• Graphical• Bisection method• False position method                             file: roots.ppt p. 8
Graphical       (limited practical value)f(x)                          f(x)           consider lower           and upper b...
Bisection Method• Takes advantage of sign changing• f(xl)f(xu) < 0 where the subscripts refer to  lower and upper bounds• ...
Algorithm• Choose xu and xl. Verify sign change    f(xl)f(xu) < 0• Estimate root   xr = (xl + xu) / 2• Determine if the es...
Error     present approx. − previous approxεa =                                   × 100                  present         L...
EXAMPLEUse the bisection method to determinethe root                         10                          8•f(x) = e-x - x ...
SOLUTION       10        8        6f(x)        4              3.7 1 8282        2                           1       0     ...
SOLUTION       2                      1f(x)       0                  0.1 06531       -0.6321 2       -2            -1    0...
False Position Method• “Brute Force” of bisection method is  inefficient• Join points by a straight line• Improves the est...
Based on                                   similarnext estimate, xr        f(xu)     triangles   xl                       ...
EXAMPLEDetermine the root of the following equationusing the false position method starting withan initial estimate of xl=...
Pitfalls of False Position Method                    f(x)=x1 0-1           30           25           20           15    f(...
Open Methods•   Simple one point iteration•   Newton-Raphson method•   Secant method•   Multiple roots•   In the previous ...
Open Methods cont.• Such methods are said to be convergent  solution moves closer to the root as the    computation progre...
f(x)            f(xi+1 )          The tangent                              gives next       xi                     estimat...
Solution can “overshoot”f(x)            the root and potentially            diverge       x2              x1              ...
Simple one point iteration• Open methods employ a formula to predict  the root• In simple one point iteration, rearrange t...
Simple one point iteration• In simple one point iteration, rearrange the  function f(x) so that x is on the left hand  sid...
EXAMPLE             (solution presented in notes)• Consider f(x) = e-x -3x• g(x) = e-x / 3• Initial guess x = 0           ...
Initial guess   0.000    g(x)         f(x)     εa                                         16                              ...
Newton Raphson                    tangentf(xi)                                              dy                            ...
Newton Raphson    Pitfalls                 file: roots.ppt p. 29
EXAMPLEUse the NewtonRaphson method                1 00                               80to determine the               60r...
In your program code, check for     problems of divergence• Include an upper limit on the number of  iterations• Establish...
Secant methodApproximate derivative using a finite divided difference             f ( xi −1 ) − f ( xi )  f  ( x) =       ...
f ( xi )                     Substitute finite differencexi+1 = xi −                              approximation for the   ...
Secant method                        f ( xi )( xi−1 − xi )           xi +1 = xi −                        f ( xi−1 ) − f ( ...
FALSE POSITIONf(x)                 2                                          SECANT METHOD                               ...
Multiple Roots• Corresponds to a point where  a function is tangential to the  x-axis                           10• i.e. d...
Difficulties• Bracketing methods won’t work• Limited to methods that may diverge                           10             ...
• f(x) = 0 at root• f (x) = 0 at root• Hence, zero in the                              10  denominator for              8 ...
Multiple Roots                            f ( xi ) f  ( xi )xi + 1 = xi −                [ f  ( xi ) ]   2                ...
Systems of Non-Linear             Equations• We will later consider systems of linear  equations  f(x) = a1x1 + a2x2+........
Systems of Non-Linear Equations cont.• Set the equations equal to zero  y = -x2 + x + 0.5  y + 5xy = x3• u(x,y) = -x2 + x ...
Recall the Taylor Series                                           f   ( x i ) 2 f    ( xi ) 3f ( xi + 1 ) ≅ f ( xi ) + f ...
Write a first order Taylor series    with respect to u and v                ∂ui                    ∂ui  ui + 1 = ui +     ...
Therefore                   ∂vi      ∂u                ui     − vi                   ∂y       ∂yxi + 1 = xi −             ...
Therefore                   ∂vi      ∂u                ui     − vi        THE DENOMINATOR                   ∂y       ∂yxi ...
EXAMPLE• Determine the roots of the following  nonlinear simultaneous equations  y = -x2 + x + 0.5  y + 5xy = x3• Use and ...
APPLIED PROBLEMThe concentration of pollutant bacteria C in a lakedecreases according to:C = 80e−2 t + 20e−0.1tDetermine t...
APPLIED PROBLEMYou buy a $20 K piece of equipment for nothing downand $5K per year for 5 years. What interest rate are you...
PREVIOUS QUIZGraphically illustrate the Newton Raphson Method andbi-section method for finding the roots of an equation on...
PREVIOUS QUIZGiven the Taylor series approximation, describe thedetail given by a) zero order approximation; b) firstorder...
PREVIOUS EXAM QUESTIONGiven the equation:f(x) = x4 - 3x2 + 6x -2 = 0a) Indicate on the graph an initial estimate for the N...
Upcoming SlideShare
Loading in...5
×

Roots00 posted

176

Published on

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
176
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
1
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Transcript of "Roots00 posted"

  1. 1. ROOTS OF EQUATIONS ENGR 351 Numerical Methods for EngineersSouthern Illinois University Carbondale College of Engineering Dr. L.R. Chevalier Dr. B.A. DeVantier file: roots.ppt p. 1
  2. 2. Quadratic Formula − b ± b 2 − 4 ac x= 2a f ( x) = ax 2 + bx + c = 0This equation gives us the roots of the algebraic functionf(x)i.e. the value of x that makes f(x) = 0How can we solve for f(x) = e-x - x? file: roots.ppt p. 2
  3. 3. Roots of Equations• Plot the function and determine where it crosses the x-axis• Lacks precision f(x)=e-x-x 10• Trial and error 8 6 f(x) 4 2 0 -2 -2 -1 0 1 2 x file: roots.ppt p. 3
  4. 4. Overview of Methods• Bracketing methods Graphing method Bisection method False position• Open methods One point iteration Newton-Raphson Secant method file: roots.ppt p. 4
  5. 5. Specific Study Objectives• Understand the graphical interpretation of a root• Know the graphical interpretation of the false- position method and why it is usually superior to the bisection method• Understand the difference between bracketing and open methods for root location file: roots.ppt p. 5
  6. 6. Specific Study Objectives• Understand the concepts of convergence and divergence.• Know why bracketing methods always converge, whereas open methods may sometimes diverge• Realize that convergence of open methods is more likely if the initial guess is close to the true root file: roots.ppt p. 6
  7. 7. Specific Study Objectives• Know the fundamental difference between the false position and secant methods and how it relates to convergence• 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 file: roots.ppt p. 7
  8. 8. Bracketing Methods• Graphical• Bisection method• False position method file: roots.ppt p. 8
  9. 9. Graphical (limited practical value)f(x) f(x) consider lower and upper bound same sign, x no roots or x even # of rootsf(x) f(x) opposite sign, odd # of roots x x file: roots.ppt p. 9
  10. 10. Bisection Method• Takes advantage of sign changing• f(xl)f(xu) < 0 where the subscripts refer to lower and upper bounds• There is at least one real rootf(x) f(x) f(x) x x x file: roots.ppt p. 10
  11. 11. Algorithm• Choose xu and xl. Verify sign change f(xl)f(xu) < 0• Estimate root xr = (xl + xu) / 2• Determine if the estimate is in the lower or upper subinterval f(xl)f(xr) < 0 then xu = xr RETURN f(xl)f(xr) >0 then xl = xr RETURN f(xl)f(xr) =0 then root equals xr - COMPLETE file: roots.ppt p. 11
  12. 12. Error present approx. − previous approxεa = × 100 present Let’s consider an example problem: file: roots.ppt p. 12
  13. 13. EXAMPLEUse the bisection method to determinethe root 10 8•f(x) = e-x - x 6•xl = -1 xu = 1 f(x) 4 3.7 1 8282 2 0 -0.6321 2 -2 -2 -1 0 1 2 x file: roots.ppt p. 13
  14. 14. SOLUTION 10 8 6f(x) 4 3.7 1 8282 2 1 0 -0.6321 2 -2 -2 -1 0 1 2 x file: roots.ppt p. 14
  15. 15. SOLUTION 2 1f(x) 0 0.1 06531 -0.6321 2 -2 -1 0 1 2 x file: roots.ppt p. 15
  16. 16. 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” file: roots.ppt p. 16
  17. 17. Based on similarnext estimate, xr f(xu) triangles xl f ( xl ) f ( xu ) = xr − xl x r − xu xu f(xl) f ( xu )( xl − xu ) xr = xu − f ( xl ) − f ( xu ) file: roots.ppt p. 17
  18. 18. EXAMPLEDetermine the root of the following equationusing the false position method starting withan initial estimate of xl=4.55 and xu=4.65f(x) = x - 98 3 30 20 10 f(x) 0 -1 0 -20 -30 -40 4 4.5 5 x file: roots.ppt p. 18
  19. 19. Pitfalls of False Position Method f(x)=x1 0-1 30 25 20 15 f(x) 10 5 0 -5 0 0.5 1 1 .5 x file: roots.ppt p. 19
  20. 20. Open Methods• Simple one point iteration• 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 file: roots.ppt p. 20
  21. 21. Open Methods cont.• Such methods are said to be convergent solution moves closer to the root as the computation progresses• Open method single starting value two starting values that do not necessarily bracket the root• These solutions may diverge solution moves farther from the root as the computation progresses file: roots.ppt p. 21
  22. 22. f(x) f(xi+1 ) The tangent gives next xi estimate. xi+1 x f(xi) file: roots.ppt p. 22
  23. 23. Solution can “overshoot”f(x) the root and potentially diverge x2 x1 x0 x file: roots.ppt p. 23
  24. 24. Simple one point iteration• Open methods employ a formula to predict the root• In simple one point iteration, rearrange the function f(x) so that x is on the left hand side of the equation i.e. for f(x) = x2 - 2x + 3 = 0 x = (x2 + 3) / 2 file: roots.ppt p. 24
  25. 25. Simple one point iteration• In simple one point iteration, rearrange the function f(x) so that x is on the left hand side of the equation i.e. for f(x) = sin x = 0 x = sin x + x• Let x = g(x)• New estimate based on x i+1 = g(xi) file: roots.ppt p. 25
  26. 26. EXAMPLE (solution presented in notes)• Consider f(x) = e-x -3x• g(x) = e-x / 3• Initial guess x = 0 16 14 12 10 8 6 f(x) 4 2 0 -2 -4 -6 -2 -1 0 1 2 x file: roots.ppt p. 26
  27. 27. Initial guess 0.000 g(x) f(x) εa 16 14 0.333 -0.283 12 10 8 0.239 0.071 39.561 6 f(x) 4 2 0 0.263 -0.018 9.016 -2 -4 -6 0.256 0.005 2.395 -2 -1 0 1 2 x 0.258 -0.001 0.612 0.258 0.000 0.158 0.258 0.000 0.041 file: roots.ppt p. 27
  28. 28. Newton Raphson tangentf(xi) dy tangent = = f dx f ( xi ) − 0 f ( xi ) = xi − xi+1 xi rearrange xi+1 f ( xi ) xi+1 = xi − f ( xi ) file: roots.ppt p. 28
  29. 29. Newton Raphson Pitfalls file: roots.ppt p. 29
  30. 30. EXAMPLEUse the NewtonRaphson method 1 00 80to determine the 60root of f(x) 40f(x) = x2 - 11 using 20an initial guess of 0xi = 3 -20 0 2 4 6 8 10 x file: roots.ppt p. 30
  31. 31. In your program code, check for problems of divergence• Include an upper limit on the number of iterations• Establish a tolerance, εs• Check to see if εa is increasing What if derivative is difficult to evaluate? SECANT METHOD file: roots.ppt p. 31
  32. 32. Secant methodApproximate derivative using a finite divided difference f ( xi −1 ) − f ( xi ) f ( x) = xi −1 − xiWhat is this? HINT: dy / dx = ∆y / ∆xSubstitute this into the formula for Newton Raphson file: roots.ppt p. 32
  33. 33. f ( xi ) Substitute finite differencexi+1 = xi − approximation for the f ( xi ) first derivative into this equation for Newton Raphson f ( xi )( xi−1 − xi )xi+1 = xi − f ( xi −1 ) − f ( xi ) Secant method file: roots.ppt p. 33
  34. 34. Secant method f ( xi )( xi−1 − xi ) xi +1 = xi − f ( xi−1 ) − f ( xi )• Requires two initial estimates• f(x) is not required to change signs, therefore this is not a bracketing method file: roots.ppt p. 34
  35. 35. FALSE POSITIONf(x) 2 SECANT METHOD 2 f(x) 1 1 x new est. The new estimate is selected from the x intersection with the new est. x-axis file: roots.ppt p. 35
  36. 36. Multiple Roots• Corresponds to a point where a function is tangential to the x-axis 10• i.e. double root 8 6 f(x) = x3 - 5x2 + 7x -3 4 m ultiple r oot f(x) 2 f(x) = (x-3)(x-1)(x-1) 0 -2 i.e. triple root -4 0 1 2 3 4 f(x) = (x-3)(x-1)3 x file: roots.ppt p. 36
  37. 37. Difficulties• Bracketing methods won’t work• Limited to methods that may diverge 10 8 6 f(x) 4 m ultiple r oot 2 0 -2 -4 0 1 2 3 4 x file: roots.ppt p. 37
  38. 38. • f(x) = 0 at root• f (x) = 0 at root• Hence, zero in the 10 denominator for 8 6 Newton-Raphson 4 m ultiple r oot f(x) and Secant 0 2 Methods -2 -4• Write a “DO 0 1 2 3 4 x LOOP” to check is f(x) = 0 before continuing file: roots.ppt p. 38
  39. 39. Multiple Roots f ( xi ) f ( xi )xi + 1 = xi − [ f ( xi ) ] 2 − f ( xi ) f ( xi ) 10 8 6 4 m ultiple r oot f(x) 2 0 -2 -4 0 1 2 3 4 x file: roots.ppt p. 39
  40. 40. Systems of Non-Linear Equations• We will later consider systems of linear equations f(x) = a1x1 + a2x2+...... anxn - C = 0 where a1 , a2 .... an and C are constant• Consider the following equations y = -x2 + x + 0.5 y + 5xy = x3• Solve for x and y file: roots.ppt p. 40
  41. 41. Systems of Non-Linear Equations cont.• Set the equations equal to zero y = -x2 + x + 0.5 y + 5xy = x3• u(x,y) = -x2 + x + 0.5 - y = 0• v(x,y) = y + 5xy - x3 = 0• The solution would be the values of x and y that would make the functions u and v equal to zero file: roots.ppt p. 41
  42. 42. Recall the Taylor Series f ( x i ) 2 f ( xi ) 3f ( xi + 1 ) ≅ f ( xi ) + f ( xi ) h + h + h + 2! 3! f n ( xi ) n . . . . . .+ h + Rn n!where h = step size = xi + 1 − xi file: roots.ppt p. 42
  43. 43. Write a first order Taylor series with respect to u and v ∂ui ∂ui ui + 1 = ui + ( xi + 1 − xi ) + ( yi + 1 − yi ) ∂x ∂y ∂v i ∂vi vi + 1 = vi + ( xi + 1 − x i ) + ( y i + 1 − yi ) ∂x ∂y The root estimate corresponds to the point where ui+1 = vi+1 = 0 file: roots.ppt p. 43
  44. 44. Therefore ∂vi ∂u ui − vi ∂y ∂yxi + 1 = xi − ∂ui ∂vi ∂ui ∂vi − ∂x ∂y ∂y ∂x ∂vi ∂u ui − vi ∂y ∂yyi + 1 = yi − ∂ui ∂vi ∂ui ∂vi − ∂x ∂y ∂y ∂xThis is a 2 equation version of Newton-Raphson file: roots.ppt p. 44
  45. 45. Therefore ∂vi ∂u ui − vi THE DENOMINATOR ∂y ∂yxi + 1 = xi − OF EACH OF THESE ∂ui ∂vi ∂ui ∂vi − EQUATIONS IS ∂x ∂y ∂y ∂x FORMALLY ∂vi ∂u REFERRED TO ui − vi ∂y ∂y AS THE DETERMINANTyi + 1 = yi − ∂ui ∂vi ∂ui ∂vi OF THE − ∂x ∂y ∂y ∂x JACOBIANThis is a 2 equation version of Newton-Raphson file: roots.ppt p. 45
  46. 46. EXAMPLE• Determine the roots of the following nonlinear simultaneous equations y = -x2 + x + 0.5 y + 5xy = x3• Use and initial estimate of x=0, y=1 file: roots.ppt p. 46
  47. 47. APPLIED PROBLEMThe concentration of pollutant bacteria C in a lakedecreases according to:C = 80e−2 t + 20e−0.1tDetermine the time required for the bacteria to be reduced to10 using Newton-Raphson method. file: roots.ppt p. 47
  48. 48. APPLIED PROBLEMYou buy a $20 K piece of equipment for nothing downand $5K per year for 5 years. What interest rate are youpaying? The formula relating present worth (P), annualpayments (A), number of years (n) and the interest rate(i) is: i( 1 + i) n A= P ( 1 + i) n − 1 Use the bisection method file: roots.ppt p. 48
  49. 49. PREVIOUS QUIZGraphically illustrate the Newton Raphson Method andbi-section method for finding the roots of an equation ongraphs provided. Only show two iterations. Be sureto select initial guesses which avoid pitfalls (i.e. zeroslope). file: roots.ppt p. 49
  50. 50. PREVIOUS QUIZGiven the Taylor series approximation, describe thedetail given by a) zero order approximation; b) firstorder approximation; c) second order approximation. f ( x i ) 2 f ( xi ) 3f ( xi + 1 ) ≅ f ( xi ) + f ( xi ) h + h + h + 2! 3! f n ( xi ) n . . . . . .+ h + Rn n!where h = step size = xi + 1 − xi file: roots.ppt p. 50
  51. 51. PREVIOUS EXAM QUESTIONGiven the equation:f(x) = x4 - 3x2 + 6x -2 = 0a) Indicate on the graph an initial estimate for the Newton Raphson Method where - the solution will diverge - a reasonable choiceb) Solve to three significant figures file: roots.ppt p. 51
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×