W9 - Finding The Roots

Download as ppt, pdf, or txt
Download as ppt, pdf, or txt
You are on page 1of 21

Centre for Computer Technology

ICT114 Mathematics for Computing


Week 9

Finding the Roots of f(x)

Objectives
Review week 8 Errors in Computing Differential Newtons Method Secant Method Summary

March 20, 2012

Copyright Box Hill Institute

Fixed Point Iteration


It involves evaluating a formula that takes a guess at a root as input and returns an updated guess at the root as output. The success of this method depends on the choice of the formula that is iterated

March 20, 2012

Copyright Box Hill Institute

Algorithm : Fixed Point Iteration


To solve f(x) = 0 rewrite as xnew = g(xold)

initialize: x0 = . . . for k = 1, 2, . . . xk = g(xk-1) if converged, stop end


March 20, 2012

Copyright Box Hill Institute

Bisection Method
Given an initial bracket for a root, the systematic halving of the of the bracket around the root is called the bisection method. Though it does it slowly, it always converges. note: when a root is suspected to lie in the range xleft x xright, the pair (xleft, xright ) is referred to as a bracket.
March 20, 2012

Copyright Box Hill Institute

Algorithm : Bisection Method


initialize: a = . . ., b = . . . for k = 1, 2, . . . xm = (a + b) / 2 if f(xm)<0 a = xm, b=b else a =a, b = xm end if converged, stop end
March 20, 2012

Copyright Box Hill Institute

Centre for Computer Technology

Newtons Method

Newton's Method
Using an initial guess at the root and the slope of f(x), Newton's method uses extrapolation to estimate where f(x) crosses the x axis. This method converges very quickly, but it can diverge if f(x) = 0 is encountered during iterations. (f(x) is the differential of f(x))
March 20, 2012

Copyright Box Hill Institute

Newtons Method

March 20, 2012

Copyright Box Hill Institute

Newtons Method

f(x) is the differential for f(x)

March 20, 2012

Copyright Box Hill Institute

Algorithm
initialize: x1 = . . . for k = 2, 3, . . . xk = xk-1 - f(xk-1)/f(xk-1) if converged, stop end

March 20, 2012

Copyright Box Hill Institute

Example

March 20, 2012

Copyright Box Hill Institute

March 20, 2012

Copyright Box Hill Institute

Centre for Computer Technology

Secant Method

Secant Method
The secant method approximates f(x) from the value of f(x) at two previous guesses at the root. It is as fast as the Newton's method but can also fail at f(x)=0.

March 20, 2012

Copyright Box Hill Institute

Secant Method

March 20, 2012

Copyright Box Hill Institute

Secant Method

March 20, 2012

Copyright Box Hill Institute

Algorithm
initialize: x1 = . . ., x2 = . . . for k = 2, 3 .. . xk+1 = xk - f(xk)(xk - xk-1)/(f(xk) - f(xk-1)) If f(xk+1)<0, xk-1 = xk+1, xk=xk else xk-1= xk-1, xk=xk+1 if converged, stop end
March 20, 2012

Copyright Box Hill Institute

Example

March 20, 2012

Copyright Box Hill Institute

Summary
Newtons Method - Using an initial guess at the root and the slope of f(x), Newton's method uses extrapolation to estimate where f(x) crosses the x axis. Secant Method - The secant method approximates f(x) from the value of f(x) at two previous guesses at the root. It is as fast as the Newton's method but can also fail at f(x)=0.

March 20, 2012

Copyright Box Hill Institute

References

Gerald W. Recktenwald, Numerical Methods with MATLAB, Implementation and Application, Prentice Hall H L Verma and C W Gross : Introduction to Quantitative Methods,John Wiley JB Scarborough : Numerical Mathematical Analysis, Jon Hopkins Hall, New Jersey Finding the Roots of f(x) = 0, Gerald W. Recktenwald, Department of Mechanical Engineering, Portland State University
Copyright Box Hill Institute

March 20, 2012

You might also like