Math98 HW3 Suppose f : R → R and that x0 is a given real number. Halley’s method 1 for ﬁnding a root of f starting at x0 is given by the sequence x n +1 = x n-2 f ( x n ) f0 ( x n ) 2 f0 ( x n ) 2-f ( x n ) f 00 ( x n ) , n ≥0 . This method is obtained by applying Newton’s method on the function f/ p | f0 | , which of course has the same roots of f . Although this method requires evaluation of f 00 (which is a limitation), when it converges it does so at a rate faster than that of Newton’s method. a. Implement a MATLAB function of the form function [Approx, Success]=HalleysMethod(f, x0 , maxIter, Tol) . Here f is an inline function and x0 is an initial guess for a root of f . This method terminates when either it has performed maxIter iterations or | f (Approx) | < Tol, where Approx is the numerical approximation to a root of f computed by Halley’s method. Success is a logical variable that returns 1 if | f (Approx) | < Tol and 0 otherwise.

This is the end of the preview. Sign up
to
access the rest of the document.