# Find all the roots of a function in an interval

**URL:** <https://discourse.julialang.org/t/find-all-the-roots-of-a-function-in-an-interval/76271>\
**Category:** General Usage\
**Tags:** roots\
**Created:** [February 11, 2022, 9:37pm UTC](https://discourse.julialang.org/t/find-all-the-roots-of-a-function-in-an-interval/76271 "2022-02-11T21:37:53Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Norbert-droid](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/norbert-droid/32/20364_2.png) [@Norbert-droid](https://discourse.julialang.org/u/Norbert-droid)\
**Post date:** [February 11, 2022, 9:37pm UTC](https://discourse.julialang.org/t/find-all-the-roots-of-a-function-in-an-interval/76271/1 "2022-02-11T21:37:53Z")

</div>

I have a function of one variable, and I want to find all the roots in an interval. The roots are simple, and their derivative is different than cero. I want a function that accepts alike arguments the function and the interval; and returns a vector with the roots.

Does Julia have a function for this purpose? or Is there a macro For this purpose?

---

<div class="post-metadata">

**Author:** ![Oscar\_Smith](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/oscar_smith/32/25343_2.png) [@Oscar\_Smith](https://discourse.julialang.org/u/Oscar_Smith)\
**Post date:** [February 11, 2022, 9:39pm UTC](https://discourse.julialang.org/t/find-all-the-roots-of-a-function-in-an-interval/76271/2 "2022-02-11T21:39:00Z")

</div>

`Roots.jl` has what you want.

---

<div class="post-metadata">

**Author:** ![j\_verzani](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/j_verzani/32/8551_2.png) [@j\_verzani](https://discourse.julialang.org/u/j_verzani)\
**Post date:** [February 11, 2022, 10:17pm UTC](https://discourse.julialang.org/t/find-all-the-roots-of-a-function-in-an-interval/76271/3 "2022-02-11T22:17:30Z")

</div>

Yes, `find_zeros` from Roots should work for this task. If not, the `https://github.com/JuliaIntervals/IntervalRootFinding.jl` package has a more robust implementation.

---

<div class="post-metadata">

**Author:** ![Norbert-droid](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/norbert-droid/32/20364_2.png) [@Norbert-droid](https://discourse.julialang.org/u/Norbert-droid)\
**Post date:** [February 12, 2022, 10:03pm UTC](https://discourse.julialang.org/t/find-all-the-roots-of-a-function-in-an-interval/76271/4 "2022-02-12T22:03:55Z")

</div>

Thanks
