# IntervalRootFinding tolerance

**URL:** <https://discourse.julialang.org/t/intervalrootfinding-tolerance/101141>\
**Category:** New to Julia\
**Tags:** question, package\
**Created:** [July 3, 2023, 7:32pm UTC](https://discourse.julialang.org/t/intervalrootfinding-tolerance/101141 "2023-07-03T19:32:58Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Longblackcoffee](https://avatars.discourse-cdn.com/v4/letter/l/a5b964/32.png) [@Longblackcoffee](https://discourse.julialang.org/u/Longblackcoffee)\
**Post date:** [July 3, 2023, 7:32pm UTC](https://discourse.julialang.org/t/intervalrootfinding-tolerance/101141/1 "2023-07-03T19:32:58Z")

</div>

Hi guys,

I’m trying to use IntervalRootFinding to find the roots of a 2-D function (compute\_implied\_r in the example below), which outputs a 2-D vector.

```julia
roots(compute_implied_r, IntervalBox(0.9..10,0.9..10), Newton, 1e-1)

```

However, when I use the roots function, I get the following output:

```julia
Root{IntervalBox{2, Float64}}[]

```

I’m interpreting this as saying that there are no roots within my tolerance of 1e-1. However, this is a bit strange because when I just throw in a random input into my function, it outputs something that should be within that tolerance.

```julia
compute_implied_r((1.04, 1.31))
2-element SVector{2, Float64} with indices SOneTo(2):
 -0.008537271557149229
  0.007921987019354315

```

I’d really appreciate any help understanding this/advice, thank you!

---

<div class="post-metadata">

**Author:** ![nsajko](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nsajko/32/221187_2.png) [@nsajko](https://discourse.julialang.org/u/nsajko)\
**Post date:** [July 3, 2023, 8:50pm UTC](https://discourse.julialang.org/t/intervalrootfinding-tolerance/101141/2 "2023-07-03T20:50:43Z")

</div>

> [@Longblackcoffee](#):
>
> I’m interpreting this as saying that there are no roots within my tolerance of 1e-1. However, this is a bit strange because when I just throw in a random input into my function, it outputs something that should be within that tolerance.

See the [docs](https://juliaintervals.github.io/pages/apiDocs/apiRootFinding/index.html#roots). The tolerance parameter, `tol`, is a diameter on your function’s _domain_.

---

<div class="post-metadata">

**Author:** ![Longblackcoffee](https://avatars.discourse-cdn.com/v4/letter/l/a5b964/32.png) [@Longblackcoffee](https://discourse.julialang.org/u/Longblackcoffee)\
**Post date:** [July 3, 2023, 9:14pm UTC](https://discourse.julialang.org/t/intervalrootfinding-tolerance/101141/3 "2023-07-03T21:14:47Z")

</div>

Thanks, that explains it. It doesn’t seem like there’s a way to change the tolerance of the root, is there?

---

<div class="post-metadata">

**Author:** ![nsajko](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nsajko/32/221187_2.png) [@nsajko](https://discourse.julialang.org/u/nsajko)\
**Post date:** [July 3, 2023, 9:35pm UTC](https://discourse.julialang.org/t/intervalrootfinding-tolerance/101141/4 "2023-07-03T21:35:23Z")

</div>

> [@Longblackcoffee](#):
>
> change the tolerance of the root

You’re trying to find points that have small but nonzero magnitude? If so, I _think_ that IntervalRootFinding is the wrong tool for the job.

---

<div class="post-metadata">

**Author:** ![fph](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/fph/32/17159_2.png) [@fph](https://discourse.julialang.org/u/fph)\
**Post date:** [July 4, 2023, 12:27pm UTC](https://discourse.julialang.org/t/intervalrootfinding-tolerance/101141/5 "2023-07-04T12:27:39Z")

</div>

If you want to use IntervalRootFinding for that job, you should probably use `roots(f .+ -0.1..0.1, ...)`. But this is likely to return large enclosures and become very slow, I am afraid.
