Those ten iterations are obtained using the secant method for the function $\tan(x\pi)-6$ starting with an interval of $[0\,\,\,0.48].$
The actual root is about $0.447431543$.
Can you explain why the method exhibited poor performance?
Best Answer
This Desmos demo might help you see what's going on. The image of the plot is also below, the green and red dots are the initial interval. It has the first four secant lines plotted, but you can probably follow the pattern/add more if you want. Essentially the iterates are jumping around between different pieces of your function. Because your function has so many vertical asymptotes you're going to need your initial interval to be closer to the root if you want any hope of the method converging.
No, there is no guarantee of convergence, as there is for bisection. The secant method can:
run into overflow (division by zero) if the secant is very close to horizontal
diverge to infinity
get stuck in infinite look
get stuck in nearly-infinite loop, from which it will eventually converge to the root, but it will take very long time.
That's the tradeoff between speed and reliability. Under favorable conditions, the secant method converges faster than bisection: the error $E_n$ after $n$ steps behaves like $E_{n+1} \approx E_n^\varphi$ with $\varphi = (1+\sqrt{5})/2=1.612\dots$. In other words, the number of correct digits in the answer grows like the Fibonacci sequence with the secant method; while for the bisection method it grows linearly. However, the above is asymptotic error analysis in the vicinity of a root (which assumes the function is twice differentiable, with nonzero first derivative at the root). How long the method will take to get to this vicinity is anyone's guess.
Try to find a continuously differentiable function with the following properties:
$f(a)$ and $f(b)$ have opposite signs and
$f'(\xi) = 0$ for a $\xi \in [a,b]$
The first point ensures that the bisection methods converges. Whereas if $f'(\xi)=0$, the secant method can fail. See these lecture notes (page 101) for an example.
Best Answer
This Desmos demo might help you see what's going on. The image of the plot is also below, the green and red dots are the initial interval. It has the first four secant lines plotted, but you can probably follow the pattern/add more if you want. Essentially the iterates are jumping around between different pieces of your function. Because your function has so many vertical asymptotes you're going to need your initial interval to be closer to the root if you want any hope of the method converging.