Secant Method
One of the reasons for the slow convergence of the bisection method is that it uses no other information about the function
then the sign at
and
. The Secant Method uses the values at
and
to estimate the next approximation. It also does not require the root to be bracketed, i.e. the initial values
and
may be two approximations to the root. The idea is to draw the line between (
) and (
) and find its intersection with the
-axis; Consider the following example:
> f:=x->cos(x)-0.3;
> a:=0;f(a);
> b:=0.7;f(b);
> line1:=x->f(a)+(f(b)-f(a))/(b-a)*(x-a);
> x[1]:=solve(line1(x)=0,x);f(x[1]);
> a:=b;b:=x[1];line2:=x->f(a)+(f(b)-f(a))/(b-a)*(x-a);
> x[2]:=solve(line2(x)=0,x);f(x[2]);
> a:=b;b:=x[2];line3:=x->f(a)+(f(b)-f(a))/(b-a)*(x-a);
> x[3]:=solve(line3(x)=0,x);f(x[3]);
We seem to move closer and closer to the real root. Graphically, these steps are illustrated in the following picture:
>
The algorithm for the Secant Method is given below:
>
Step 1: obtain two approximations,
and
.
Step 2: calculate the next approximation as
.
Step 3: If
then
is the root, otherwise, if
then
is the required approximation to the root, else repeat step 2.
>
Notice that it is best to use the relative error between two consecutive approximations to determine when to halt the process.
The Secant Method converges very rapidly, if good inital estimates are given. But estimating an upper bound to the convergence rate is more complicated.