Lecture 11 Rootfinding – Newton’s and secant methods 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 Define slope: X old = 4 f(x old ) = x old = 2.64 X old = f(x old ) = x old =7.955 X new = X new = 4.839
Lecture 11 Rootfinding – Newton’s and secant methods 4 Newton Method Calculations
Lecture 11 Rootfinding – Newton’s and secant methods 5 Newton’s method Answer depends on where you start. x init = 2.00 x root = steps = 3 x init = 4.00 x root = steps = 4 x init = x root = steps = 4
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 X 0 = 4 f(x 0 ) = Secant method X 2 = X 1 = 6 f(x 1 ) = 9.88 X 3 = x 1 and x 0 don’t have to bound solution f(x 2 ) = f(x 3 ) = X 4 = X2X2
Lecture 11 Rootfinding – Newton’s and secant methods 8 n xn-1xn f(xn-1) f(xn)xn Secant method table
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 MethodInitial xx Root#Iterations substitution bisection4.0, Newton’s Secant4.0,