Consider the function
$$h(x)=\left(x^{3}-x\right)e^{-x}$$If we are looking for the extremes of $h,$ since the necessary condition for extreme for a differentiable function is that $h'(x)=0,$ we are looking for the zeros of $h'.$
Since the exponential is always positive and different from zero, if we want the roots of $h'$ we have to find the zeros of
$$f(x)=-x^3 + 3x^2 + x - 1$$We see that the three sufficient conditions to exist a single root in the interval are met:
Let us also prove it analytically:
We compute the zeros of this second degree polynomial $ax^2+bx+c=0$ with
$$x_{1,2} = \frac{-b\pm \sqrt{b^2-4ac}}{2a}$$as $a=-3$, $b=6$ and $c=1$ we have
$$x_{1,2} = \frac{-6\pm \sqrt{6^2-4(-3)}}{2(-3)}\quad x_1= -0.15 \quad x_2 = 2.15$$Therefore
$$f'(x)=a(x-x_1)(x-x_2)=-3(x+0.15)(x-2.2)$$and, as the first factor factor, $-3$, is negative, and the second, $(x+0.15)$ and third, $(x-2.2)$ positive in $(3,4)$, we have
$$f'(x)=-3(x+0.15)(x-2.2)= (-)(+)(+)\lt 0 \quad \mathrm{in} \quad (3,4)$$The conditions to apply the Bisection method are Bolzano's conditions, that is, conditions 1 and 2 of the previous section.
As we demonstrated, these two conditions are met and therefore, we can apply the Bisection method.
We iterate taking into account that given $a$ and $b$ the midpoint is
$$m = \frac{a+b}{2}$$and that the error boundary is given by
$$c = b-a$$of the next iteration.
Iteration 1
The interval is $[3,4]$ and its midpoint is
$$m = \frac{a+b}{2}=\frac{3+4}{2}=3.5$$As $f(3)=2$ and $f(3.5)=-3.63$ the sign of the function is different at the next interval boundaries that is $[3,3.5]$ and the error boundary is the length of this interval, 0.5.
Iteration 2
The interval is $[3,3.5]$ and its midpoint is
$$m = \frac{a+b}{2}=\frac{3+3.5}{2}=3.25$$As $f(3)=2$ and $f(3.25)=-0.39$ the sign of the function is different at the next interval boundaries that is $[3,3.25]$ and the error boundary is the length of this interval, 0.25.
Iteration 3
The interval is $[3,3.25]$ and its midpoint is
$$m = \frac{a+b}{2}=\frac{3+3.25}{2}=3.125$$As $f(3.125)=0.9$ and $f(3.25)=-0.39$ tienen signo distinto el siguiente intervalo es $[3.125,3.25]$ and the error boundary is the length of this interval, 0.125.
Iteration 4
The interval is $[3.125,3.25]$ and its midpoint is
$$m = \frac{a+b}{2}=\frac{3.125+3.25}{2}=3.1875$$and the error boundary is half the length of the previous interval, that is, 0.0625.
We already calculated the error bound along with the iterations but, taking into account that the number of iterations is $k = 4$, we could also have used the formula
$$c_k=\frac{b_0-a_0}{2^k}=\frac{4-3}{2^4}=\frac{1}{2^4}=\frac{1}{2^4}=\frac{1}{16} = 0.0625$$Let's check that the error is less than the error boundary. Since the exact solution is $\alpha= 3.2143$, the absolute error is
$$e_4 = |x_4-\alpha|=|3.1875-3.2143|=0.0268$$which is less than the error boundary, as expected.
We want that
$$ e_{a}=\left|\alpha-x_{n}\right|\lt 10^{-8}. $$Since the error (unknown) is less than the error bound (known)
$$ e_{a}=\left|\alpha-x_n\right|\lt\dfrac{b_{0}-a_{0}}{2^n}. $$a sufficient condition for the error to be less than $10^{-8}$ is that the error bound is less than $10^{-8}$
$$ \dfrac{b_{0}-a_{0}}{2^n}\lt 10^{-8}. $$We will work with this inequality and apply the following properties
Taking into account property 1 and multiplying both members of the inequality first by $2^n$ and then $10^8$ we have
$$ \frac{4-3}{2^{n}} \lt 10^{-8} \Longleftrightarrow 1 \lt 2^n 10^{-8} \Longleftrightarrow 10^8\lt 2^{n} $$Since $f(x)=\log(x)$ is a strictly increasing function, applying property 2 we have
$$ \log\left(10^8\right)\lt\log\left(2^{n}\right) $$and taking into account property 3
$$ \log\left(10^8\right)\lt n\log2. $$As $\log2 \gt 0$, applying property 1 with $c=1/\log2$
$$ \frac{\log\left(10^8\right)}{\log2}\lt n $$$\log$ represents here any logarithm in base greater than 1. We will use, for example, natural logarithms
$$26.6\lt n$$And if we iterate $\fbox{$n=27$}$ times, we can guarantee that the error is less than $10^{-8}.$