# Question about Interval Root finding

**URL:** https://discourse.julialang.org/t/question-about-interval-root-finding/57124
**Category:** General Usage
**Tags:** roots
**Created:** [March 14, 2021, 11:34am UTC](https://discourse.julialang.org/t/question-about-interval-root-finding/57124 "2021-03-14T11:34:25Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![TheLateKronos](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/thelatekronos/32/12824_2.png) [@TheLateKronos](https://discourse.julialang.org/u/TheLateKronos)
#### Post date: [March 14, 2021, 11:34am UTC](https://discourse.julialang.org/t/question-about-interval-root-finding/57124/1 "2021-03-14T11:34:25Z")

</div>

So I am using `IntervalRootFinding.jl` to find out how many possibly energy states exist for a finite potential well (Quantum mechanichs). The problem is that when I look for roots from -1e100 to 1e100, I get 2 solutions, which is consistent with what a classmate has found. But when I expand the interval to -1e200 to 1e200, I get two more roots I am not sure what to do with.

The last one has the status `:unknown`, so I can write it off as non-existing. But the other new root from this new interval has the value `ø`, and status `:unique`. What does that mean?

The code and outputs are seen below.

![image](https://global.discourse-cdn.com/julialang/original/3X/8/9/893ba3679b8e8d0a951008dc23e3c4e7bb0add34.png)

---

<div class="post-metadata">

### Author: ![carstenbauer](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/carstenbauer/32/4981_2.png) [@carstenbauer](https://discourse.julialang.org/u/carstenbauer)
#### Post date: [March 14, 2021, 12:43pm UTC](https://discourse.julialang.org/t/question-about-interval-root-finding/57124/2 "2021-03-14T12:43:08Z")

</div>

FWIW, from the documentation:

 ![Screenshot 2021-03-14 at 13.42.46](https://global.discourse-cdn.com/julialang/original/3X/e/b/eb17dbf89fa1e838cd3f277d28e0173b13fd8d9d.png)

---

<div class="post-metadata">

### Author: ![lferrant](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lferrant/32/22751_2.png) [@lferrant](https://discourse.julialang.org/u/lferrant)
#### Post date: [March 14, 2021, 12:43pm UTC](https://discourse.julialang.org/t/question-about-interval-root-finding/57124/3 "2021-03-14T12:43:23Z")

</div>

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

```julia
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
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.

---

<div class="post-metadata">

### Author: ![TheLateKronos](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/thelatekronos/32/12824_2.png) [@TheLateKronos](https://discourse.julialang.org/u/TheLateKronos)
#### Post date: [March 14, 2021, 1:12pm UTC](https://discourse.julialang.org/t/question-about-interval-root-finding/57124/4 "2021-03-14T13:12:12Z")

</div>

Reguarding me saying that I can remove the `:unknown` root, I knew about the documentation and concluded I could remove it because it fits what I expected, but thanks a lot for the more rigorus way of ruling it out. And thanks you a lot @lferrant for the detailed answer.

---

<div class="post-metadata">

### Author: ![dpsanders](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dpsanders/32/3573_2.png) [@dpsanders](https://discourse.julialang.org/u/dpsanders)
#### Post date: [March 14, 2021, 1:52pm UTC](https://discourse.julialang.org/t/question-about-interval-root-finding/57124/5 "2021-03-14T13:52:31Z")

</div>

That is a check that the package itself should do! I regard both of those last two roots as bugs. Thanks for the nice reproducer.

Note that you can also use BigFloats by writing eg `big(3..5)` as your input interval.

For this particular function it does not make sense to look at negative intervals since you immediately take the square root. But the package did successfully realise that at least!

---

<div class="post-metadata">

### Author: ![dpsanders](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dpsanders/32/3573_2.png) [@dpsanders](https://discourse.julialang.org/u/dpsanders)
#### Post date: [March 14, 2021, 6:18pm UTC](https://discourse.julialang.org/t/question-about-interval-root-finding/57124/6 "2021-03-14T18:18:58Z")

</div>

Reported and being investigated here: [https://github.com/JuliaIntervals/IntervalRootFinding.jl/issues/162](https://github.com/JuliaIntervals/IntervalRootFinding.jl/issues/162)

---

<div class="post-metadata">

### Author: ![TheLateKronos](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/thelatekronos/32/12824_2.png) [@TheLateKronos](https://discourse.julialang.org/u/TheLateKronos)
#### Post date: [March 16, 2021, 9:23am UTC](https://discourse.julialang.org/t/question-about-interval-root-finding/57124/7 "2021-03-16T09:23:13Z")

</div>

Wow. I gotta say, I am pretty thrilled that my “newbie-question” could spark what seems like a serious and productive discussion for making this pretty cool package even better. I never thought about numerical root-finding in terms of intervals, but it actually makes a whole lot more sense than to simply state some value that actually has uncertanty (the tolerance) assosciated with it, and often neglecting the uncertanty. Also, I don’t know how this package aims to guarantee finding all roots, but it defenitly feels like a very rigorous and well implemented project from my perspective. So again, pretty thrilled to have been the spark to the great discussion going on over at the issue 🙂

It also feels great to have a contributor who is active and hears the question, and reacts. This is of course not something that can be expected in open-source project, but it has the same positives as great custumer support - that it, it is very appriciated 😃. Thanks for your time and effort @dpsanders \<3.

---

<div class="post-metadata">

### Author: ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)
#### Post date: [March 17, 2021, 8:17am UTC](https://discourse.julialang.org/t/question-about-interval-root-finding/57124/8 "2021-03-17T08:17:01Z")

</div>

> [@TheLateKronos](#):
>
> never thought about numerical root-finding in terms of intervals, but it actually makes a whole lot more sense than to simply state some value that actually has uncertanty (the tolerance) assosciated with it

I think that in this particular case it is not about uncertainty propagation, but a very elegant and fascinating lifting of the whole problem to mapping sets to sets.
