Interval Halving (Bisection)


\begin{displaymath}
f(x)=3x + sin(x) - e^x
\end{displaymath}

Look at to the plot of the function (see Fig. 1) to learn where the function crosses the x-axis. MATLAB can do it for us:
>> f = inline ( ' 3 *x + sin ( x) - exp ( x) ')
>> fplot ( f, [ 0 2 ]) ; grid on
And we see from the figure that indicates there are zeros at about $x=0.35$ and $1.9$.
An algorithm for Halving the Interval (Bisection):
\fbox{\parbox{10cm}{
To determine a root of $f(x)=0$\ that is accurate within a ...
...et $x_l=x_3$\ End If\\
Until $(\vert x_1 - x_2\vert) < 2*tolerance~value$\\
}} To obtain the true value for the root, which is needed to compute the actual error. MATLAB surely used a more advanced method than bisection.
>> solve('3*x + sin(x) - exp(x)')
ans=
.36042170296032440136932951583028
Figure 1: Plot of the function: $f(x)=3x + sin(x) - e^x$
\includegraphics[scale=1]{figures/1.1.ps}

Table 1: The bisection method for $f(x)=3x + sin(x) - e^x$, starting from $x_1=0,x_2=1$, using a tolerance value of 1E-4.
\begin{table}
\begin{center}
\includegraphics[scale=1]{figures/1.2.ps}
\end{center}\end{table}


2004-10-15