JuliaIntervals / IntervalRootFinding.jl

Library for finding the roots of a function using interval arithmetic
https://juliaintervals.github.io/IntervalRootFinding.jl/
Other
129 stars 26 forks source link

Specifying a maximum number of bisections #178

Open AnderGray opened 3 years ago

AnderGray commented 3 years ago

Is it possible to specify a maximum number of bisections?

I see there are some functions where you can specify maxlevels:

function find_roots(f::Function, a::Interval{T}, method::Function = newton;
                    tolerance = eps(T), debug = false, maxlevel = 30) where {T}

    method(f, a; tolerance=tolerance, debug=debug, maxlevel=maxlevel)
end

but not sure if it's used in the method. I guess this was put here as a future feature?

I've tried also changing tol, but it didn't seem to change much.

Kolaru commented 3 years ago

This is not supported by the interface currently. IIRC find_roots is the older interface, that has been superseeded by roots.

In principle all that is needed is to pass the information around down to the search iterator and stop it early if the maxlevel is reached.

Related #59, #109, #116.