Question about Interval Root finding

\emptyset represents the empty interval, as you can verify as follows

julia> rts = roots(f, -1e200..1e200)
4-element Vector{Root{Interval{Float64}}}:
 Root([15.0645, 15.0646], :unique)
 Root([11.1033, 11.1034], :unknown)
 Root(∅, :unique)
 Root([3.84464, 3.84465], :unique)

julia> a = rts[3].interval
∅

julia> isempty(a)
true

Since empty intervals cannot contain a root, you can safely remove it. I am not sure why the algorithm returns it though. I think empty intervals should be pruned away internally.

Note however, that :unknown means that the interval may or may not contain a root and the algorithm could not decide it, so in general you should not throw it away without some further thinking. In this case you can easily verify that the interval does not indeed contain a root as follows

julia> rts = roots(f, -1e200..1e200)
4-element Vector{Root{Interval{Float64}}}:
 Root([15.0645, 15.0646], :unique)
 Root([11.1033, 11.1034], :unknown)
 Root(∅, :unique)
 Root([3.84464, 3.84465], :unique)

julia> a = rts[2].interval
[11.1033, 11.1034]

julia> f(a)
[-2.00889e+08, -5.91418e+07]

julia> 0 ∈ f(a)
false

Since interval arithmetic sometimes overestimates the range but it never underestimates it, the last line is a rigorous proof that that interval does not indeed contain a root of the function and so it can be safely removed.

7 Likes