IntervalRootFinding.jl is a Julia package for finding the roots of functions, i.e. solutions to the equation
The official documentation is available online: https://juliaintervals.github.io/IntervalRootFinding.jl/stable.
The IntervalRootFinding.jl package requires to install Julia.
Then, start Julia and execute the following command in the REPL:
using Pkg; Pkg.add("IntervalRootFinding")
The basic function is roots
. Given a standard Julia function and an interval, the roots
function returns a list of intervals containing all roots of the function located in the prescribed interval.
julia> using IntervalArithmetic, IntervalRootFinding
julia> f(x) = sin(x) - 0.1*x^2 + 1
f (generic function with 1 method)
julia> roots(f, -10..10)
4-element Array{Root{Interval{Float64}},1}:
Root([3.14959, 3.1496], :unique)
Root([-4.42654, -4.42653], :unique)
Root([-1.08205, -1.08204], :unique)
Root([-3.10682, -3.10681], :unique)
The :unique
status indicates that each listed interval contains exactly one root. The other possible status is :unknown
, which corresponds to intervals that may contain zero, one, or more roots (no guarantee is provided for these intervals).
These results are represented in the following plot, the region containing roots being in green.