Secant Method
Secant Method
Secant Method
Definition
Newton’s method is an extremely powerful technique, but it has a major weakness:
the need
to know the value of the derivative of f at each approximation. Frequently, f (x) is far
more
difficult and needs more arithmetic operations to calculate than f (x).
To circumvent the problem of the derivative evaluation in Newton’s method, we
introduce a slight variation. By definition,
This technique is called the Secant method and is presented in below figure. Starting
with the two initial approximations p0 and p1, the approximation p2 is the x-intercept of
the line joining ( p0, f ( p0)) and ( p1, f ( p1)). The approximation p3 is the x-intercept of
the line joining ( p1, f ( p1)) and ( p2, f ( p2)), and so on. Note that only one function
evaluation is needed per step for the Secant method after p2 has been determined. In
contrast, each step of Newton’s method requires an evaluation of both the function
and its derivative.
Background
A special case of this method was first called the rule of double false position in 18th-
Century B.C. Babylonian clay tablets. It is now thought of as a primitive version
because it is essentially the secant method applied to a linear equation. Because
algebra hadn't been developed by that time, Babylonians had described their problems
in a written form rather than symbolically. This method was developed as a result of
common problems they encountered such as the sale and distribution of properties,
inheritance, or for the purpose of portion control and the prediction of production. In
1545 the rule of double false position was first used as an iterative procedure by
Cardano in his Artis Magnae (Papakonstantinou 2009). Thus, we have the secant
method for a nonlinear equation
Example
Find a root of this equation using Secant method :
Here :
First iteration
Second iteration
Third iteration
Fourth iteration
Fifth iteration
Matlab Code
%Example
%Find a root of an equation f(x)=x^3-x-1 using Secant method
clear all
clc
f=@(x)x*x*x-x-1; %Nhap phuong trinh f(x)
% Nghiem nam trong khoang(x0,x1).
x0=input('\n Nhap diem bat dau '); %Vi du x0=1
x1=input('\n Nhap diem ket thuc ');%Vi du x1=2
epsilon=input('\n Nhap sai so mong muon '); %Sai so tùy ý 0.001 hoac etc.
err=abs(x1-x0);
%Công thuc x2=(x0*f(x1)-x1*f(x0))/(f(x1)-f(x0));
if f(x0)*f(x1)>0
disp('So ban vua nhap khong hop ly !!!');
else
while err > epsilon
x2=(x0*f(x1)-x1*f(x0))/(f(x1)-f(x0));
x0=x1;
x1=x2;
err=abs(x1-x0);
root=x2;
end
fprintf('\n Nghiem la %4.4f ',root);
end