-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Incorrect unique zero for 0/x + x and similar. #181
Comments
Hi @kemchurch! Thanks for opening this discussion here. In general, I agree with your analysis. Yet, there is still one point you did not include stressed above, which i think is important: a naive evaluation of |
Ah, you make a good point. I suppose I was thinking of IntervalRootFinding.jl as something that it isn't: a black box that computes all zeroes of a given function on a box and encloses "bad" points (with status :unknown). It does indeed work like this in the case of some essential singularities (like for 1/x on a domain containing zero), but I shouldn't expect the same behaviour to hold generally.
|
The idea of tagging roots as |
This main problem you are hitting here is that in the current flavor of IntervalArithmetic, Allowing for different flavors of interval, and ultimately one with a more intuitive use of
In principle this could be true. We would need for it, as far as I can see:
So I think this issue should be kept open, as it is fair game to except it to work (or at least gracefully crash instead of giving wrong result) with the package. |
As both @lbenet and @Kolaru have correctly pointed out, the Newton algorithm is designed to work with differentiable functions Decorated intervals were designed to check whether a function over a given interval satisfies the requirements. (I thought we had some docs on this but I can't find them right now. cc @lucaferranti) Here's your example use case. (Note that you can use julia> using IntervalArithmetic
julia> @format true; # display decorations
julia> f(x) = x + (0 / x);
julia> x = DecoratedInterval(1..2);
julia> f(x)
[1, 2]_com
julia> y = DecoratedInterval(-1..2);
julia> f(y)
[-1, 2]_trv The decoration |
The docs on decorations are here. They don't seem to have been captured in |
I am computing zeroes of some pretty weird functions, and occasionally have unexpected behavior. A minimal working example (it's embedded in a lot of my functions; they depend on parameters and sometimes this kind of thing happens) is provided by the following.
I think this is more of a feature of IntervalArithmetic.jl and/or ForwardDiff.jl internals than it is with IntervalRootFinding.jl, since the main reason this happens can be traced back to two things:
zero(typeof(x))/x
in such a way thatzero(typeof(x))*ForwardDiff.derivative(y->1/y,x)
is computed. This is just a hunch; I haven't looked at the internals.zero(typeof(x))*interval(-Inf,Inf)
will return[0,0]
, butinterval(0)/interval(0)
returns the empty interval. This is why interval Newton converges. Despite this, our function does not have a zero, and evaluates to the empty interval there as it should.I suspect the same thing will happen if h is replaced with
h(x) = zero(typeof(x))/x + f(x)
for anyf
that has a unique zero in [-1,1] at 0 such thatroots()
converges.I wasn't sure where to raise this issue. One could argue that this happens because of an inconsistency with IntervalArithmetic.jl's handling of
0*interval(-Inf,Inf)
and similar. However, I noticed this problem while using IntervalRootFinding.jl, so I've raised the issue here for now.The text was updated successfully, but these errors were encountered: