Given the equation: f(x) = x3 - x - 2
and the interval (1,2)
I was asked to calculate the iterations that are going to be needed
in order to get the root at 4 decimal places
I know how to apply the Bisection method, what I don't know is how to calculate the iterations for a given value of decimal places on the end result root.
Any help is greatly appreciated.
You need to iterate until the length of the bracketing interval is smaller than $10^{-5}$, so that rounding to 4 decimal places from both sides of the interval gives the same result.
The earliest that you can be cautiously confident about the first 4 decimal places is when the interval length is smaller $5·10^{-5}$, however there is then still a substantial chance that the last digit varies by $1$. Despite that the bound on the interval length is equivalent to a bound on the number of steps, here $15$ bisections, as $2^{-15}<3.1·10^{-5}$.
You can replace that condition by rounding the interval ends to 4 decimals and test for equality. While that gives absolute certainty, it can take a rather large number of steps to reach that point.
If you take $0.2$ and $0.7$ which are $0.5$ apart, and round both to integer, you get a different result. The same behavior under rounding to integer could happen with $0.497$ and $0.502$, so that interval length is not always a good measure to ensure stationarity in the decimal digits. Another case would be if the root were $0.4999…993$. Under bisection starting with the interval $[0,1]$ the upper interval bound will move in the first steps to $0.5$. Certainty that the first 4 decimal digits are indeed $0.4999$ requires reduction of the interval length to far below $5·10^{-5}$.