# \#roots

**URL:** https://discourse.julialang.org/tag/roots/209.md

[Latest](https://discourse.julialang.org/latest.md) · [Categories](https://discourse.julialang.org/categories.md) · [Tags](https://discourse.julialang.org/tags.md)

---

## [Root finding for (possibly) complex valued functions with Nonlinearsolve.jl](https://discourse.julialang.org/t/root-finding-for-possibly-complex-valued-functions-with-nonlinearsolve-jl/97784)

<div class="topic-metadata">

**Author:** [@theplatters](https://discourse.julialang.org/u/theplatters)\
**Replies:** 5\
**Last updated:** [September 4, 2025, 3:49pm UTC](https://discourse.julialang.org/t/root-finding-for-possibly-complex-valued-functions-with-nonlinearsolve-jl/97784 "2025-09-04T15:49:08Z")

</div>

Hello. I need to translate some matlab code into Julia, where i need to find the roots in X of the function: function problem(X :: AbstractVector{T}, A, β, Ω, α, ε, θ, σ,L) where T N = length(α) p = @view X\[1:…

---

## [How to check reliably whether a function has a zero on an interval '\[0,a)'](https://discourse.julialang.org/t/how-to-check-reliably-whether-a-function-has-a-zero-on-an-interval-0-a/114560)

<div class="topic-metadata">

**Author:** [@paul188](https://discourse.julialang.org/u/paul188)\
**Replies:** 5\
**Last updated:** [May 22, 2024, 5:23pm UTC](https://discourse.julialang.org/t/how-to-check-reliably-whether-a-function-has-a-zero-on-an-interval-0-a/114560 "2024-05-22T17:23:52Z")

</div>

Let’s say I have a continuous (even smooth) function f(x) which is defined on the whole real line. Now, I want to know whether f(x) has a zero in \[0, ∞). I can say for sure that if it has a zero on this ray, this zero m…

---

## [How to increase precision of solution using Roots.jl and ArbNumerics.jl](https://discourse.julialang.org/t/how-to-increase-precision-of-solution-using-roots-jl-and-arbnumerics-jl/102850)

<div class="topic-metadata">

**Author:** [@roi.holtzman](https://discourse.julialang.org/u/roi.holtzman)\
**Replies:** 28\
**Last updated:** [August 18, 2023, 8:59pm UTC](https://discourse.julialang.org/t/how-to-increase-precision-of-solution-using-roots-jl-and-arbnumerics-jl/102850 "2023-08-18T20:59:06Z")

</div>

I am trying to increase precision for a numeric solution using Roots.jl using ArbFloat (of ArbNumerics.jl). But, when I decrease the tolerance, the outcome does not change. I keep comparing it to the numerical solution…

---

## [Custom rule for differentiating through Newton solver using ForwardDiff: works for gradient, fails for hessian](https://discourse.julialang.org/t/custom-rule-for-differentiating-through-newton-solver-using-forwarddiff-works-for-gradient-fails-for-hessian/93002)

<div class="topic-metadata">

**Author:** [@touste](https://discourse.julialang.org/u/touste)\
**Replies:** 23\
**Last updated:** [May 26, 2023, 5:31pm UTC](https://discourse.julialang.org/t/custom-rule-for-differentiating-through-newton-solver-using-forwarddiff-works-for-gradient-fails-for-hessian/93002 "2023-05-26T17:31:05Z")

</div>

Hi all, I have a function obj(p) that solves for the parameter t of a Bezier curve B(t) so that the arclength is equal to some arbitrary value (2 in this kind-of-minimal example). It uses the Newton’s method. The Bezie…

---

## [Help to plot a surface plot with infinite roots?](https://discourse.julialang.org/t/help-to-plot-a-surface-plot-with-infinite-roots/98291)

<div class="topic-metadata">

**Author:** [@Moslem\_Uddin](https://discourse.julialang.org/u/Moslem_Uddin)\
**Replies:** 10\
**Last updated:** [May 21, 2023, 6:18pm UTC](https://discourse.julialang.org/t/help-to-plot-a-surface-plot-with-infinite-roots/98291 "2023-05-21T18:18:02Z")

</div>

I am trying to generate a surface plot of the following in Julia. As I’m new, I’m struggling where \\alpha\_k are I’m being able to generate a line plot at a fixed time using the following code: using Roots,Plots plot…

---

## [Roots::find\_zero fails depending on small differences in initial condition](https://discourse.julialang.org/t/roots-find-zero-fails-depending-on-small-differences-in-initial-condition/95202)

<div class="topic-metadata">

**Author:** [@nvonturk](https://discourse.julialang.org/u/nvonturk)\
**Replies:** 6\
**Last updated:** [February 26, 2023, 11:20am UTC](https://discourse.julialang.org/t/roots-find-zero-fails-depending-on-small-differences-in-initial-condition/95202 "2023-02-26T11:20:15Z")

</div>

Hi there, I’m having trouble with the Roots package. I have an MVE below (base of post) which is setting up a simple economics model. The last two lines showcase the issue. The first line works and returns the correct …

---

## [Find\_zero to find a solution x as a function of y?](https://discourse.julialang.org/t/find-zero-to-find-a-solution-x-as-a-function-of-y/91628)

<div class="topic-metadata">

**Author:** [@kwyyoo](https://discourse.julialang.org/u/kwyyoo)\
**Replies:** 10\
**Last updated:** [February 10, 2023, 5:45pm UTC](https://discourse.julialang.org/t/find-zero-to-find-a-solution-x-as-a-function-of-y/91628 "2023-02-10T17:45:18Z")

</div>

Hi. This is my first thread topic and question ever posting here. I have the following function and the my goal is to find a solution of x to make it zero. f(x, y) = (x^0.5 - y)/(1-x) - x^(-0.5); Can I find the soluti…

---

## [Find zero of a nonlinear equation using Julia](https://discourse.julialang.org/t/find-zero-of-a-nonlinear-equation-using-julia/61974)

<div class="topic-metadata">

**Author:** [@maoc](https://discourse.julialang.org/u/maoc)\
**Replies:** 14\
**Last updated:** [January 7, 2023, 12:47am UTC](https://discourse.julialang.org/t/find-zero-of-a-nonlinear-equation-using-julia/61974 "2023-01-07T00:47:16Z")

</div>

After a process usyng the SymPy in Julia, I generated a system of nonlinear equations. For the sake of simplicity, I am going to put an approximation here for the case of just a non-linear equation. What I get is somethi…

---

## [2D IntervalRootFinding with parameters](https://discourse.julialang.org/t/2d-intervalrootfinding-with-parameters/90997)

<div class="topic-metadata">

**Author:** [@rodek](https://discourse.julialang.org/u/rodek)\
**Replies:** 2\
**Last updated:** [November 29, 2022, 2:32pm UTC](https://discourse.julialang.org/t/2d-intervalrootfinding-with-parameters/90997 "2022-11-29T14:32:37Z")

</div>

Hi all, possibly a simple/silly question: how do I pass parameters to the function for which I want to find the set of roots in two (or more dimensions) using IntervalRootFinding? In 1D I can use an anonymous function ro…

---

## [Autodiff-ing a function defined by the result of Roots.find\_zero fails](https://discourse.julialang.org/t/autodiff-ing-a-function-defined-by-the-result-of-roots-find-zero-fails/87753)

<div class="topic-metadata">

**Author:** [@joaovgranja](https://discourse.julialang.org/u/joaovgranja)\
**Replies:** 12\
**Last updated:** [September 29, 2022, 9:54am UTC](https://discourse.julialang.org/t/autodiff-ing-a-function-defined-by-the-result-of-roots-find-zero-fails/87753 "2022-09-29T09:54:52Z")

</div>

Hi all! I am trying to ForwardDiff a function that is defined by solving a non-linear equation that depends on parameters. The code below reproduces the error. It first redefines exp by solving log(x) - a = 0 using Roo…

---

## [\[Ann\] IntervalRootFinding.jl for finding all roots of a multivariate function](https://discourse.julialang.org/t/ann-intervalrootfinding-jl-for-finding-all-roots-of-a-multivariate-function/9515)

<div class="topic-metadata">

**Author:** [@dpsanders](https://discourse.julialang.org/u/dpsanders)\
**Replies:** 52\
**Last updated:** [September 26, 2022, 5:12am UTC](https://discourse.julialang.org/t/ann-intervalrootfinding-jl-for-finding-all-roots-of-a-multivariate-function/9515 "2022-09-26T05:12:37Z")

</div>

We are excited to announce v0.2 of the IntervalRootFinding.jl package, which has been completely rewritten from scratch. This package exports a function roots that is guaranteed to find all roots of a given function \\ma…

---

## [Find all the roots of a function in an interval](https://discourse.julialang.org/t/find-all-the-roots-of-a-function-in-an-interval/76271)

<div class="topic-metadata">

**Author:** [@Norbert-droid](https://discourse.julialang.org/u/Norbert-droid)\
**Replies:** 3\
**Last updated:** [February 12, 2022, 10:03pm UTC](https://discourse.julialang.org/t/find-all-the-roots-of-a-function-in-an-interval/76271 "2022-02-12T22:03:55Z")

</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 i…

---

## [BudanTables.jl](https://discourse.julialang.org/t/budantables-jl/75944)

<div class="topic-metadata">

**Author:** [@BMO](https://discourse.julialang.org/u/BMO)\
**Replies:** 1\
**Last updated:** [February 8, 2022, 3:04pm UTC](https://discourse.julialang.org/t/budantables-jl/75944 "2022-02-08T15:04:57Z")

</div>

I implemented a package for plotting the Budan’s table of a polynomial (Budan-Fourier theorem uses it for root counting, see Improved Budan-Fourier Count for Root Finding). https://github.com/LauraBMo/BudanTables.jl By…

---

## [How iteratively/numerically solve for a value](https://discourse.julialang.org/t/how-iteratively-numerically-solve-for-a-value/75019)

<div class="topic-metadata">

**Author:** [@CentraCep](https://discourse.julialang.org/u/CentraCep)\
**Replies:** 9\
**Last updated:** [January 23, 2022, 11:40pm UTC](https://discourse.julialang.org/t/how-iteratively-numerically-solve-for-a-value/75019 "2022-01-23T23:40:02Z")

</div>

I wrote a program intended to calculate the plasma beta of a hydrostatic solar atmosphere: B\_0 = 0.02 # base magnetic field \[T\] p\_0 = 0.015 # base pressure \[J/m^-3\] h\_D = 7.5E7 # dipole depth \[m\] R\_☉ = 6.96E8 # solar ra…

---

## [Help with \`try\`ing different algorithms for root solving](https://discourse.julialang.org/t/help-with-try-ing-different-algorithms-for-root-solving/70832)

<div class="topic-metadata">

**Author:** [@amrods](https://discourse.julialang.org/u/amrods)\
**Replies:** 14\
**Last updated:** [November 3, 2021, 1:54am UTC](https://discourse.julialang.org/t/help-with-try-ing-different-algorithms-for-root-solving/70832 "2021-11-03T01:54:07Z")

</div>

I am trying to program a function that tries different root-finding algorithms depending on whether they succeed or not. How can I accomplish that? I programmed a prototype below, but it does not seem to work: using Roo…

---

## [Find intersection between curves in julia](https://discourse.julialang.org/t/find-intersection-between-curves-in-julia/70494)

<div class="topic-metadata">

**Author:** [@Luigi\_Marongiu](https://discourse.julialang.org/u/Luigi_Marongiu)\
**Replies:** 13\
**Last updated:** [October 28, 2021, 7:20am UTC](https://discourse.julialang.org/t/find-intersection-between-curves-in-julia/70494 "2021-10-28T07:20:56Z")

</div>

Hello, I have two curves with the values: col\_y = \[8.02511788606e7, 9.98481296252e7, 2.328332483329e8, 6.148181496526e8, 9.453171952624e8, 1.2331292887706e9, 1.4394296796998e9, 1.460066157955e9, 1.3570403824485e9, 1.42…

---

## [Does Roots.jl provide an API to obtain the trace of a root finding algorithm?](https://discourse.julialang.org/t/does-roots-jl-provide-an-api-to-obtain-the-trace-of-a-root-finding-algorithm/65654)

<div class="topic-metadata">

**Author:** [@liuyxpp](https://discourse.julialang.org/u/liuyxpp)\
**Replies:** 5\
**Last updated:** [August 2, 2021, 1:08pm UTC](https://discourse.julialang.org/t/does-roots-jl-provide-an-api-to-obtain-the-trace-of-a-root-finding-algorithm/65654 "2021-08-02T13:08:21Z")

</div>

I only find that it can print out such information by the kwargs verbose=true. But how can I obtain this just like the Optim.jl which store all information in the returned value? I want to count the number of evaluations…

---

## [IntervalRootFinding and Legendre polynomials: error](https://discourse.julialang.org/t/intervalrootfinding-and-legendre-polynomials-error/65541)

<div class="topic-metadata">

**Author:** [@blackeneth](https://discourse.julialang.org/u/blackeneth)\
**Replies:** 1\
**Last updated:** [July 31, 2021, 9:54am UTC](https://discourse.julialang.org/t/intervalrootfinding-and-legendre-polynomials-error/65541 "2021-07-31T09:54:15Z")

</div>

When I try to find the roots of the 26th degree Legendre polynomial with IntervalRootFinding.jl, I get an error I can’t decode. julia\> using IntervalArithmetic julia\> using LegendrePolynomials julia\> using IntervalRoo…

---

## [How to catch this error?](https://discourse.julialang.org/t/how-to-catch-this-error/63721)

<div class="topic-metadata">

**Author:** [@amrods](https://discourse.julialang.org/u/amrods)\
**Replies:** 6\
**Last updated:** [June 30, 2021, 1:10am UTC](https://discourse.julialang.org/t/how-to-catch-this-error/63721 "2021-06-30T01:10:36Z")

</div>

I am optimizing a complicated function. That function depends on 2 variables t1 and t2. I can derive first order conditions that result in a system of 2 equations. I can also derive conditions for when t1 \< t2, t1 \> t2, …

---

## [Finding roots of multivariate function with given bounds?](https://discourse.julialang.org/t/finding-roots-of-multivariate-function-with-given-bounds/63406)

<div class="topic-metadata">

**Author:** [@liuyxpp](https://discourse.julialang.org/u/liuyxpp)\
**Replies:** 14\
**Last updated:** [June 24, 2021, 10:59am UTC](https://discourse.julialang.org/t/finding-roots-of-multivariate-function-with-given-bounds/63406 "2021-06-24T10:59:28Z")

</div>

Suppose I have a multivariate function, f(x, y), with x \\in (0, 1) and y \\in (0, 1). I want to find the roots of following equation f(x, y) - c = 0 where c = \[c\_1\\ c\_2\]^T is a constant vector. In my case, there are l…

---

## [Question about Interval Root finding](https://discourse.julialang.org/t/question-about-interval-root-finding/57124)

<div class="topic-metadata">

**Author:** [@TheLateKronos](https://discourse.julialang.org/u/TheLateKronos)\
**Replies:** 7\
**Last updated:** [March 17, 2021, 8:17am UTC](https://discourse.julialang.org/t/question-about-interval-root-finding/57124 "2021-03-17T08:17:01Z")

</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, …

---

## [Root isolation of real-rooted integer polynomials](https://discourse.julialang.org/t/root-isolation-of-real-rooted-integer-polynomials/51421)

<div class="topic-metadata">

**Author:** [@malacroi](https://discourse.julialang.org/u/malacroi)\
**Replies:** 12\
**Last updated:** [December 9, 2020, 6:37pm UTC](https://discourse.julialang.org/t/root-isolation-of-real-rooted-integer-polynomials/51421 "2020-12-09T18:37:33Z")

</div>

I have a collection of polynomials with non-negative integer coefficients that I know to be real-rooted with no repeated roots by examining Sturm chains for each. I would like to show that they form an interlacing famil…

---

## [Is There a Way to Find Symbolic Roots?](https://discourse.julialang.org/t/is-there-a-way-to-find-symbolic-roots/50772)

<div class="topic-metadata">

**Author:** [@brett\_knoss](https://discourse.julialang.org/u/brett_knoss)\
**Replies:** 1\
**Last updated:** [November 25, 2020, 10:38pm UTC](https://discourse.julialang.org/t/is-there-a-way-to-find-symbolic-roots/50772 "2020-11-25T22:38:33Z")

</div>

I’m able to find a floating point approximation of the a second derivative, but I know the actual answer is log(a). Is there a way to find this symbolically? using ModelingToolkit using Roots p(t,a)=1/(1+a\*exp((-t))) …

---

## [Switch find-zero method if convergence fails without try-catch](https://discourse.julialang.org/t/switch-find-zero-method-if-convergence-fails-without-try-catch/50482)

<div class="topic-metadata">

**Author:** [@Jacob\_Stevens](https://discourse.julialang.org/u/Jacob_Stevens)\
**Replies:** 2\
**Last updated:** [November 20, 2020, 11:18pm UTC](https://discourse.julialang.org/t/switch-find-zero-method-if-convergence-fails-without-try-catch/50482 "2020-11-20T23:18:30Z")

</div>

I have an inner loop which solves a simple equation using find\_zero(), currently with the default Order0() method at a plausible starting value. 99.99% of the time, this works smoothly with no issues. However, occasional…

---

## [Query status of the solution when using Roots](https://discourse.julialang.org/t/query-status-of-the-solution-when-using-roots/50328)

<div class="topic-metadata">

**Author:** [@optimist](https://discourse.julialang.org/u/optimist)\
**Replies:** 4\
**Last updated:** [November 18, 2020, 7:08pm UTC](https://discourse.julialang.org/t/query-status-of-the-solution-when-using-roots/50328 "2020-11-18T19:08:51Z")

</div>

Edited to make it more specific I would like to query status of the solution when using the Roots package, before the function returns an answer. I can see in the source code of “find\_zero.jl” that it has some functiona…

---

## [Julia equivalent for python scipy.optimize.fsolve](https://discourse.julialang.org/t/julia-equivalent-for-python-scipy-optimize-fsolve/46139)

<div class="topic-metadata">

**Author:** [@HerAdri](https://discourse.julialang.org/u/HerAdri)\
**Replies:** 29\
**Last updated:** [September 7, 2020, 7:17am UTC](https://discourse.julialang.org/t/julia-equivalent-for-python-scipy-optimize-fsolve/46139 "2020-09-07T07:17:09Z")

</div>

What would be the Julia equivalent for python scipy.optimize.fsolve, to resolve function F (x) f1 = 1- x \[1\] - x \[2\] f2 = 8 - x \[1\] - 3 \* x \[2\] return f1, f2 end x0 = \[1,1\] Solves a linear system of equations s…

---

## [Optimization using Optim and Roots](https://discourse.julialang.org/t/optimization-using-optim-and-roots/39301)

<div class="topic-metadata">

**Author:** [@optimist](https://discourse.julialang.org/u/optimist)\
**Replies:** 9\
**Last updated:** [May 24, 2020, 10:43pm UTC](https://discourse.julialang.org/t/optimization-using-optim-and-roots/39301 "2020-05-24T22:43:55Z")

</div>

Hello, I am a new user of Julia and the Optim package, and I am looking for some guidance on a simple piece of code. I have given my simple implementation of the equivalent of Excel XIRR (extended internal rate of retur…

---

## [Complex root finder for a general function f(z)?](https://discourse.julialang.org/t/complex-root-finder-for-a-general-function-f-z/35989)

<div class="topic-metadata">

**Author:** [@hongchengni](https://discourse.julialang.org/u/hongchengni)\
**Replies:** 40\
**Last updated:** [May 5, 2020, 6:36pm UTC](https://discourse.julialang.org/t/complex-root-finder-for-a-general-function-f-z/35989 "2020-05-05T18:36:53Z")

</div>

Hello, I am new to Julia. I wonder if there is a Julia package that can obtain the complex root for a general complex equation f(z)=0? I am aware there are packages such as Polynomials and PolynomialRoots, but they can o…

---

## [Roots of a two variables equation involving a numerical integration](https://discourse.julialang.org/t/roots-of-a-two-variables-equation-involving-a-numerical-integration/37544)

<div class="topic-metadata">

**Author:** [@Daniel\_Tamayo](https://discourse.julialang.org/u/Daniel_Tamayo)\
**Replies:** 2\
**Last updated:** [April 14, 2020, 5:25am UTC](https://discourse.julialang.org/t/roots-of-a-two-variables-equation-involving-a-numerical-integration/37544 "2020-04-14T05:25:02Z")

</div>

I’m in troubles to find the zeros of the next equation of two variables: (w - k)A + B = 0 The issue is that the terms ‘A’ and ‘B’ are not numbers but are integral of certain functions ‘f(k,w,p)’ and ‘g(k,w,p)’ involvin…

---

## [Use Roots.Brent() in fzero Roots.jl](https://discourse.julialang.org/t/use-roots-brent-in-fzero-roots-jl/37126)

<div class="topic-metadata">

**Author:** [@mleprovost](https://discourse.julialang.org/u/mleprovost)\
**Replies:** 3\
**Last updated:** [April 7, 2020, 12:00am UTC](https://discourse.julialang.org/t/use-roots-brent-in-fzero-roots-jl/37126 "2020-04-07T00:00:26Z")

</div>

Hello, I would like to use the method Brent-Dekker in Roots.jl without using the find\_zero wrapper since I will only do one run of root-finding for the function of interest. fzero seems to be the way to go, but I don’t …

[Next page](https://discourse.julialang.org/tag/roots/209.md?match_all_tags=true&page=1&tags%5B%5D=roots)
