Newton’s method
Tsung-Ming Huang
Department of Mathematics National Taiwan Normal University, Taiwan
June 14, 2009
Suppose that f : R → R and f ∈ C2[a, b], i.e., f00 exists and is continuous.
If f (x∗) = 0 and x∗= x + h where h is small, then byTaylor’stheorem 0 = f (x∗) = f (x + h)
= f (x ) + f0(x )h +1
2f00(x )h2+ 1
3!f000(x )h3+ · · ·
= f (x ) + f0(x )h + O(h2).
Since h is small, O(h2) is negligible. It is reasonable to drop O(h2) terms.
This implies
f (x ) + f0(x )h ≈ 0 and h ≈ −f (x )
f0(x ), if f0(x ) 6= 0.
Hence
x + h = x − f (x ) f0(x ) is a better approximation to x∗.
This sets the stage for the Newton-Rapbson’smethod, which starts with an initial approximation x0 and generates the sequence {xn}∞n=0 defined by
xn+1 = xn− f (xn) f0(xn).
Since the Taylor’s expansion of f (x ) at xk is given by f (x ) = f (xk) + f0(xk)(x − xk) +1
2f00(xk)(x − xk)2+ · · · . At xk, one uses thetangent line
y = `(x ) = f (xk) + f0(xk)(x − xk)
to approximate the curveof f (x ) and uses the zero of the tangent line to approximate the zero of f (x ).
Newton’s Method
Given x0, tolerance TOL, maximum number of iteration M.
Set i = 1 and x = x0− f (x0)/f0(x0).
While i ≤ M and |x − x0| ≥ TOL
Set i = i + 1, x0 = x and x = x0− f (x0)/f0(x0).
End While
Problem
The equation f (x ) ≡ x2− 10 cos x = 0 has two solutions ±1.3793646. Use Newton’s method to approximate the solutions with initial values ±25.
Requirements
1 Write two MATLAB functions, said fun f and fun df, to compute the values of f and f0, respectively.
2 Implement the Newton’s algorithm as a MATLAB function:
I Input arguments: fun f, fun df, initial value
I Output arguments: approximated solution of the equation