In [1]:
using NewtonMethod
In [2]:
f(x) = sin(x)
Out[2]:
In [3]:
newton(f, Interval(-20., 20.), 40)
Out[3]:
In [4]:
newton(f, Interval(-21., 21.), 40)
Out[4]:
In [5]:
newton(f, Interval(-23., 23.), 40)
Out[5]:
In [6]:
newton(f, Interval(-21., 22.), 40)
Out[6]:
In [7]:
newton(f, Interval(-22., 21.), 40)
Out[7]:
In [8]:
newton(f, Interval(-20., 20.), 40)
Out[8]:
In [9]:
newton(f, Interval(-20., 20.), 50)
Out[9]:
In [10]:
newton(f, Interval(-20., 20.), 30)
Out[10]:
In [11]:
newton(f, Interval(-24., 22.), 40)
Out[11]:
The roots that are lost depend on the points of the interval. No other function (except sin and based on it cos) does this. Interestingly, changing the procedure of sin into an alternative one left the problem unchanged.
In [ ]: