This lecture contains Secant Method working rule, Graphical representation, Example, Pros and cons of this method and a Matlab Code.
Size: 1.43 MB
Language: en
Added: Mar 28, 2021
Slides: 14 pages
Slide Content
Numerical Computing Secant Method Lecture # 9 By Nasima Akhtar
Secant Method Working Rule The secant method begins by finding two points on the curve of f(x), hopefully near to the root we seek. A graph or a few applications of bisection might be used to determine the approximate location of the root. we draw the line through these two points and find where it intersects the x-axis. The line through two points on the curve is called the secant line.
Graphical Representation of Secant Method 1
Derivation Approach 1 A C B D E
Derivation Approach 1 From the similar Triangle ABC = ADE By re-arrangement we get (I have done to whole derivation on page See the next slide. = - f( )* = - f( )* A C B D E
Derivation Approach 2 From Newton Raphson Method we have, = - -----------------------1 From the equation of line we have slope, = ------------------------2 Putting equation 2 in 1 = - = - f( )*
Algorithm for Secant Method To determine a root of f(x) = 0, given two values, and , that are near the root, If If ( l < I f ( )l then Swap with Repeat Set = -f( )* Set = . Set = . Until If( )l < tolerance value.
Graphical Representation of Secant Method 2
Matlab Code f=@(x)(x^3-5*x+1); x1=2; x2 = 2.5; i = 0; while i <= 5 val = f(x2); val1 = f(x1); temp = x2 - x1; temp1 = val - val1; nVal = temp/temp1; nVal = nVal * val ; nVal = x2 - nVal ; x1 = x2; x2 = nVal ; i = i+1; end fprintf ('Point is %f\n',x2)
Example Numerical F(x)= So we consider =2, F(2)=-1 F(2.5)=4.125 = -f( )* = -f( )* = – 4.125* =2.0975 = - f( )* =2.1213 =2.1285 =2.1284 X F(x) 1 -3 2 -1 2.5 4.125 3 13
Secant Method Pros and Cons Advantages No computations of derivatives Only f(x) computation each step It converges faster than linear rate. Disadvantages It may not converge There is no guaranteed error bound for the computed iterates