1 / 10

Lecture 11

Lecture 11. More root finding methods Newton’s method Very fast way to find roots Requires taking the derivative of f(x) Can be unstable if ‘unattended’ Secant method Similar to Newton’s method, but derivative is numerical not analytical. Newton’s method. X old = 5.318

adonis
Download Presentation

Lecture 11

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Lecture 11 • More root finding methods • Newton’s method • Very fast way to find roots • Requires taking the derivative of f(x) • Can be unstable if ‘unattended’ • Secant method • Similar to Newton’s method, but derivative is numerical not analytical Lecture 11 Rootfinding – Newton’s and secant methods

  2. Newton’s method Lecture 11 Rootfinding – Newton’s and secant methods

  3. Xold = 5.318 f(xold) = 3.296 df/dx@ xold =7.955 Define slope: Xnew = 4.839 Xnew = 5.318 Xold = 4 f(xold) = -3.48 df/dx@ xold = 2.64 Lecture 11 Rootfinding – Newton’s and secant methods

  4. Newton Method Calculations xold f(xold) df/dx@xold xnew 4.00 -3.48 2.64 5.31818 5.31818 3.2967 7.95467 4.90375 4.90375 0.394565 6.08148 4.83887 4.83887 0.008993 5.80503 4.837315 4.837315 0.0000051 5.79848 4.837315 Lecture 11 Rootfinding – Newton’s and secant methods

  5. x init = -4.00 x root= -2.51601 steps = 4 x init = 4.00 x root= 4.83731 steps = 4 x init = 2.00 x root= 0.456469 steps = 3 Newton’s method Answer depends on where you start. Lecture 11 Rootfinding – Newton’s and secant methods

  6. Function for Newton’s Method newtonexample.cpp code can be found in the Examples page. Lecture 11 Rootfinding – Newton’s and secant methods

  7. X2 X4 = 4.8513 X2 = 4.5210 X3 = 4.7303 f(x2) = -1.6287 f(x3) = -0.5967 Secant method X1 = 6 f(x1) = 9.88 x1 and x0 don’t have to bound solution X0 = 4 f(x0) = -3.48 Lecture 11 Rootfinding – Newton’s and secant methods

  8. Secant method table f(xn-1) xn-1 xn f(xn) xn+1 n 1 4.0000 -3.4800 6.0000 9.8800 4.5210 4.7303 9.8800 2 6.0000 4.5210 -1.6287 -1.6287 3 4.7303 -0.5967 4.8513 4.5210 4.8368 -0.5967 -0.0815 4.8513 4.7303 4 -.0032 5 4.8513 4.8373 -0.0815 4.8373 Lecture 11 Rootfinding – Newton’s and secant methods

  9. Secant method function secantexample.cpp code can be found in the Examples page. Lecture 11 Rootfinding – Newton’s and secant methods

  10. Comparing methods:Iterations required to reach a tolerance of 0.0001 Method Initial x x Root #Iterations substitution 4.0 4.8373 18 bisection 4.0, 6.0 4.8373 17 Newton’s 4.0 4.8373 4 Secant 4.0, 6.0 4.8373 5 Lecture 11 Rootfinding – Newton’s and secant methods

More Related