JuliaIntervals / IntervalRootFinding.jl

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

roots cannot handle functions that return intervals #77

Open dpsanders opened 6 years ago

dpsanders commented 6 years ago

Also seems to be true of newton1d.

cc @eeshan9815

Kolaru commented 6 years ago

Do you mean something like that ?

julia> g(x::Interval) = x^2 - 2
g (generic function with 1 method)

julia> roots(g, -2..2)
ERROR: MethodError: no method matching g(::ForwardDiff.Dual{ForwardDiff.Tag{#g,IntervalArithmetic.Interval{Float64}},IntervalArithmetic.Interval{Float64},1})
dpsanders commented 6 years ago

I meant something like

julia> g(x) = x..x
g (generic function with 1 method)

julia> roots(g, -2..2)
ERROR: MethodError: no method matching atomic(::Type{IntervalArithmetic.Interval{IntervalArithmetic.Interval{Float64}}}, ::IntervalArithmetic.Interval{Float64})
Closest candidates are:
Kolaru commented 6 years ago

Is there an use case where this makes sense ? If the return value of g is an interval I don't know how g(x) = 0 should be interpreted.

lbenet commented 6 years ago

I've read somewhere that such cases occur and are of interest. Yet, in my opinion, we should perhaps document the current limitations and eventually add that functionality.