Hi everyone,
I recently updated the version of Roots.jl
I use in my package. I have some simple code that looks like this
f = β -> begin
diff = mb(β, β, par, bpar = ConstructBPar(β, par)) - infocostdiff(β,par)
@show diff
@show β
return diff
end
find_zero(f, (0.00000001, 2), Bisection())
end
This is what the last iterations look like
diff = -1.6653345369377348e-16
β = 0.06802616450595264
diff = 3.3306690738754696e-16
β = 0.06802616450595263
diff = 3.3306690738754696e-16
β = 0.06802616450595263
diff = -2.220446049250313e-16
β = 0.06802616450595265
diff = -5.0e-8
β = 1.0e-8
diff = -10.0
β = 2.0
and I get the following 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.
init_state(::Bisection, ::Roots.DerivativeFree{getfield(AlbagliInfo, Symbol("##238#239")){Pars}}, ::Tuple{Float64,Float64}) at bracketing.jl:81
#find_zero#8(::Roots.NullTracks, ::Bool, ::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}, ::typeof(find_zero), ::Function, ::Tuple{Float64,Int64}, ::Bisection) at bracketing.jl:310
find_zero at bracketing.jl:307 [inlined]
FindFixedPoint at Functions.jl:636 [inlined]
ChooseBeta at GrowthFuncs.jl:236 [inlined]
#Sim#186(::Array{Float64,2}, ::Type, ::Int64, ::Type{Sim}, ::Pars, ::Int64, ::Symbol) at GrowthFuncs.jl:159
Sim(::Pars, ::Int64, ::Symbol) at GrowthFuncs.jl:137
top-level scope at Growth.jl:65
It seems to me that it found a zero, but then decided that it actually didn’t and that an error would a better outcome.
What can I do? When I run status inside my package, this happens, but I don’t understand why
(MyPackage) pkg> status
Project MyPackage v0.1.0
Status `C:\Path\MyPackage\Project.toml`
[1375f997] + CompEcon v0.4.0
[a93c6f00] ↑ DataFrames v0.17.1 ⇒ v0.19.4
[31c24e10] ↑ Distributions v0.16.4 ⇒ v0.21.8
[2fe49d83] ↑ Expectations v1.0.2 ⇒ v1.1.1
[442a2c76] ↑ FastGaussQuadrature v0.3.2 ⇒ v0.4.0
[a98d9a8b] ↑ Interpolations v0.11.2 ⇒ v0.12.5
[429524aa] ↑ Optim v0.17.2 ⇒ v0.19.4
[d96e819e] ↑ Parameters v0.10.3 ⇒ v0.12.0
[fcd29c91] ↑ QuantEcon v0.15.0 ⇒ v0.16.2
[f2b01f46] ↑ Roots v0.7.4 ⇒ v0.8.3
[37e2e46d] LinearAlgebra
[9a3f8284] Random
[10745b16] Statistics
Status `C:\Path\MyPackage\Project.toml`
[1375f997] + CompEcon v0.4.0
[a93c6f00] ↑ DataFrames v0.17.1 ⇒ v0.19.4
[31c24e10] ↑ Distributions v0.16.4 ⇒ v0.21.8
[2fe49d83] ↑ Expectations v1.0.2 ⇒ v1.1.1
[442a2c76] ↑ FastGaussQuadrature v0.3.2 ⇒ v0.4.0
[a98d9a8b] ↑ Interpolations v0.11.2 ⇒ v0.12.5
[429524aa] ↑ Optim v0.17.2 ⇒ v0.19.4
[d96e819e] ↑ Parameters v0.10.3 ⇒ v0.12.0
[fcd29c91] ↑ QuantEcon v0.15.0 ⇒ v0.16.2
[f2b01f46] ↑ Roots v0.7.4 ⇒ v0.8.3