NumericalMath`IntervalRoots`
Interval methods in numerical computation provide a mechanism for verified calculation. With ordinary computer arithmetic you almost never know how much error is in the final result. With Mathematica's variableprecision arithmetic this issue is addressed somewhat for basic arithmetic and the elementary functions, but no claim is made to rigor. With interval arithmetic absolute rigor is possible: the correct value is always maintained between two numbers, which are hopefully not too far apart.
In addition to basic arithmetic, there are interval analogs of many of the standard algorithms of numerical analysis. The package NumericalMath`IntervalRoots` provides three interval rootfinding methods: bisection, secant, and Newton's method. A nice feature of interval rootfinding methods is that they find all roots of the given function on a given interval. More precisely, they start with the given interval and discard parts of it that cannot possibly contain any roots. What you end up with are some subintervals of the given interval that are guaranteed to contain all of the roots that are contained in the the given interval. If the roots of the given interval are well separated then the result consists of short subintervals, each of which contains exactly one root.
Interval rootfinding methods.
Options for interval rootfinding methods.
This loads the package.
In[1]:= <<NumericalMath`IntervalRoots`
This finds the roots of on the interval and stops recursing when the subintervals have decreased to less than .
In[2]:= IntervalBisection[Sin[x], x, Interval[{2., 8.}], .1]
Out[2]=
This attempts to find the roots with a smaller error tolerance. For each of the two roots MaxRecursion is exceeded before the tolerance is achieved.
In[3]:= IntervalBisection[Sin[x], x, Interval[{2., 8.}], .01]
Out[3]=
We can increase MaxRecursion to achieve the smaller tolerance.
In[4]:= IntervalBisection[Sin[x], x, Interval[{2., 8.}], .01, MaxRecursion > 10]
Out[4]=
The interval secant method converges more rapidly and does not need the extra recursion to achieve the same tolerance.
In[5]:= IntervalSecant[Sin[x], x, Interval[{2., 8.}], .01]
Out[5]=
The interval Newton's method is used in the same way.
In[6]:= IntervalNewton[Sin[x], x, Interval[{2., 8.}], .01]
Out[6]=
The working precision can be infinite.
In[7]:= IntervalBisection[Sin[x], x, Interval[{2, 8}], .1, WorkingPrecision > Infinity]
Out[7]=
Infinite precision with Newton's method gives rather complicated results.
In[8]:= IntervalNewton[Sin[x], x, Interval[{2, 8}], .1, MaxRecursion > 2, WorkingPrecision > Infinity]
Out[8]=
