Let's take the example function
In [1]:
f(x) = asin(x)/x - pi/3
Out[1]:
It has two symmetrical roots, -1/2 and 1/2.
The zero-finding algorithms will encounter the roots as long as we start with the intervals fitting in the domain of arcsin:
In [2]:
using KrawczykMethod
In [3]:
krawczyk(f, Interval(-0.9, 0.9))
Out[3]:
In [4]:
using NewtonMethod
In [5]:
newton(f, Interval(-0.9, 0.9))
Out[5]:
But if we set the interval which goes outside of the domain, we get errors.
In [6]:
krawczyk(f, Interval(-2, 2))
In [7]:
newton(f, Interval(-2, 2))
In [ ]: