-
Notifications
You must be signed in to change notification settings - Fork 71
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
interval + inf returns invalid interval #535
Comments
>> infsup(1, 2) + Inf
warning: illegal interval boundaries: infimum = supremum = +/- infinity
warning: called from
infsup at line 813 column 5
plus at line 50 column 7
ans = [Empty] fwiw octave behavior. I think octave converts each number to interval first so the warning originates from trying to construct |
in |
similar easy fix in master by tweaking these lines |
The same issue exists for subtraction and multiplication (in julia> interval(1, 2) - Inf
[-∞, -∞]
julia> interval(1, 2) * Inf
[∞, ∞] |
Thanks a lot for the comment @cbilz. After a discussion with @lucaferranti, and going into the standard (section 10.2, the remark just after Eq. 4), we both agreed that the "correct answers" should be of the form |
It seems that this is a problem with how |
I agree. It turns out to be related to how julia> IntervalArithmetic.round_expr(Inf, RoundDown)
Inf |
@lbenet I was looking into fixing this issue for the 1.0-dev branch, but I realized that I am not reaching the same conclusion as you. The interval arithmetic formalism can be quite subtle, so I am perhaps overlooking something here 😅. For set based flavour, according to Section 10.2 of the standard, the set of intervals However, returning Since we have that |
I was reading #558, which quotes your comment above... Sorry to reply (here) to it until now.
Fully agree with you. To avoid confusion, let me refer to that infinity as
I'm not sure if I agree completely here with you. With that result you describe, the addition is extended to If, however, we consider that EDIT: Using |
I may be misinterpreting Note 1 in Section 10.2 of the standard which is:
Wouldn't that imply that 1..Inf is the set True, we do not really care about type unstability per se. The way I phrased my sentence was a little misleading sorry. My reasoning is only about the extension of the algebra. |
Thanks for explaining how to get the curly braces; I've edited my comment above. And also thanks for quoting Note 1 of Sect. 10.2: it illustrates the kind of statements that make me dislike reading the standard 😸. Isn't that clause contradictory in itself? I mean "The definition implies If "$−\infty$ and In the reasoning I wrote above, the first sentence is our departure point. So, we may use the symbols
I think I got you right: |
I mean I do understand your point of view (and thanks for taking the time to discuss this). Indeed, the clause is contradicting itself 😄. But, as you said, I also agree that
and then that I mean if Specifically, when they write "−∞ ≤ x ≤ +∞, which is the whole real line R" one then reads "−∞ < x < +∞, which is the whole real line R". Therefore |
I think either way there is a unique interpretation because My breakdown of the discussions here is:
Ultimately I think the most natural choice would be to use the Cset flavor as a default (which allows intervals to contain We would still have to support the set-based flavor to be standard compliant though x_x. [1] Funnily enough |
Thanks @Kolaru for your clear explanation and pragmatical approach! (I was about to send my comment, but yours is clearer!) |
Interesting I have not looked into the "Cset flavour". I focused on the "set-based flavour" because that is the main one on the 1.0-dev and we need to decide on a behaviour. I do agree that returning I have a hard time conflating I also agree about the decorations; in this context with a bare So in my opinion, either we throw an error or the empty set is the most suitable choice, since
|
I agree that it is uncomfortably hard to think Maybe I'm wrong, but I think these issues arise from the fact that there are lot's of caveats when Regarding the consistency of the library, the example you chose above is not the best, IMHO, because the interval A different example is division: julia> 1/(0..0) # empty set is returned; denominator must not be identically zero
∅
julia> 1/(0..1) # semi-infinite line
[1.0, ∞]
julia> 1/(-1..1) # real line
[-∞, ∞] Note that, in the latter two cases |
Absolutely. Now concerning the examples. Let me try again to use the standard to help us out (not sure it will 😄) (cf. page 35 of the standard, so "set-based flavour"). Let
The examples So the examples to look at are more things like The reasoning behind the example with |
Ah I think I found a potential tie-breaker: |
We all are pleading for a clearer and unambiguous standard !! 😄 Good points, all above! Playing in your favor: if it's not real nor has an interval extension, it simply makes no sense to ask Playing in the other direction: If I think of this question in terms of a function Another uncomfortable and inconsistent case: |
Sorry I should have made this clear in my previous comment: So I looked at the standard and they do not impose a behaviour because for set-based flavour they only care about operations where the inputs are both elements of Thinking about this in terms of limits also works in favour of returning
EDIT: Concerning |
I think an important take away is that With this in mind, either we throw an error or return the empty set systematically (including @Kolaru @lucaferranti @dpsanders What do you think of all this discussion, and the final conclusion? |
Just a small bump to not forget about this, since this also impacts PR #558 |
Any comment @Kolaru @lucaferranti @dpsanders? I've left a review of #558... |
I think there are different types of function domain we have to deal with:
Conceptually, I prefer the last one to error. However, it is impractical, because My second choice would be to go with the "promotion" (I quote because I am not referring to Julia built-in promotion mechanism, just its idea) So after thinking about it I am leaning towards the last possibility. Which I know is a bit of a stretch. However, I want to reaffirm that the true solution to that is to use decorated intervals (that could be the default for 1.0?) or a different flavor of intervals. Also, don't be fooled by the length of this message, I don't think this is a particularly central issue[1]. In a proper application, it is very unlikely to get them appear, and I don't think it would be fair to blame IA for the unhelpful or hard to debug results that would come out. I'll review #558 today or tomorrow. [1] I wanted to make my opinion clear and simple, which backfired. |
We noticed that #568 would help avoid all these problems too. |
Resolved by #558. |
both on master and 1.0-dev
Not sure what it should return though, maybe
Interval(prevfloat(Inf), Inf)
? 🤔The text was updated successfully, but these errors were encountered: