JuliaMath/Roots.jl

`Roots.A42()` finds zeros outside of initial bracket

Closed this issue · 3 comments

MWE

julia> using Roots

julia> f(x) = x - 1
f (generic function with 1 method)

julia> find_zero(f, (-3,0), Roots.A42())
1.0

julia> find_zero(f, (-3,0), Roots.Brent())
ERROR: ArgumentError: The interval [a,b] is not a bracketing interval.
You need f(a) and f(b) to have different signs (f(a) * f(b) < 0).
Consider a different bracket or try fzero(f, c) with an initial guess c.

Calling a42 directly throws the right error

julia> Roots.a42(f, (-3,0))
ERROR: ArgumentError: The interval [a,b] is not a bracketing interval.
You need f(a) and f(b) to have different signs (f(a) * f(b) < 0).
Consider a different bracket or try fzero(f, c) with an initial guess c.

Thanks!! There is a missing bracket check. Will fix soon.

Thanks much for the report!!!