

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


Newton’s Method for Root-Finding Almost every (nonlinear) equation can be rewritten as f (x) = 0, where f (x) is assumed to be a differentiable function. We want to find
Let’s say, an initial guess to the root is x 0. The tangent line to the curve at point (x 0 , f (x 0 )) is y = f (x 0 ) + f ′(x 0 )(x − x 0 ).
The Main Idea: Use the intersection of the tangent line with the x-axis as an approximation to the intersection of the curve with the x-axis. Setting y = 0 in the above tangent line equation, we obtain
x 1 = x 0 −
f (x 0 ) f ′(x 0 )
assuming f ′(x 0 ) 6 = 0. Of course, in that case, the tangent line is parallel to the x-axis, we won’t have any intersection. Keep doing so, we establish an iterative scheme
xn+1 = xn −
f (xn) f ′(xn)
and this is the great Newton’s method.
Implementation of Newton’s Method Implement the Newton’s method as an independent function (.m file) that has the following format
function [aprx,itr] = newton(fxn,fxnderiv,tol,maxitr,guess)
where aprx: An approximation to the root itr: The number of iterations executed fxn: A generic function for the equation fxnderiv: A generic function for the derivative tol: A preset tolerance, say 10−^9 maxitr: Maximal number of iterations allowed guess: An initial guess to the root
Things to Consider When Implementing the Newton’s Method
Examples of using inline to define a function:
myfxn = inline(’x.^3-2x+2’, ’x’); myfxnderiv = inline(’3x.^2-2’, ’x’);