Also what about a function for which it diverges?
I was thinking f(x) = 10 + 1/x would work for where it converges, but can't think of one where the bisection method diverges at near a root. Thanks for any thoughts!
Also what about a function for which it diverges?
I was thinking f(x) = 10 + 1/x would work for where it converges, but can't think of one where the bisection method diverges at near a root. Thanks for any thoughts!
If $f$ is not continuous, the assumption that $f(a)$ and $f(b)$ has opposite signs doesn't imply that $f$ has a zero in $[a,b]$. Take for example something like
$$ f(x) = \begin{cases} 1, & -1 \le 1/\pi \\ -1, & 1/\pi < x \le 1\end{cases}. $$
Then the bisection method (starting with the interval $[-1,1]$) would converge to $1/\pi$ which is not a zero of $f$.
Changing the value of $f(1/\pi)$ to $0$ would give you an example when the method converges to a zero, even when $f$ is not continuous at that point.
In one sense, the bisection method always converges, since the gap between the points is halved in each step, which means that the limit of the endpoints of the interval converge to a common point (but that point need not be a zero of $f$ if $f$ fails to be continuous).