Skip to content
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

Union of isdisjoint intervals #191

Open
ps-pat opened this issue Aug 30, 2024 · 0 comments
Open

Union of isdisjoint intervals #191

ps-pat opened this issue Aug 30, 2024 · 0 comments

Comments

@ps-pat
Copy link

ps-pat commented Aug 30, 2024

Right now, this is the error message we get when trying to compute the union of incompatible intervals:

julia> OpenInterval(1, 2)  OpenInterval(2, 3)
ERROR: ArgumentError: Cannot construct union of disjoint sets.

It is a little bit confusing since it is possible to construct the union of disjoint intervals as long as they share an endpoint:

julia> isdisjoint(OpenInterval(1, 2), OpenInterval(2, 3))
true
julia> OpenInterval(1, 2)  ClosedInterval(2, 3)
1 .. 3 (open-closed)

The confusion arises from such a pair of intervals being disjoint but connected sets. Maybe the error message should be changed to reflect that. Also, right now, in order to check if two intervals are disconnected, you have to do something like

isdisjoint(A, B) && !=(endpoints(A  B)...)

which is a little bit inefficient since it computes A ∩ B twice or go full-on with

AB = A  B
isempty(AB) && !=(endpoints(AB)...)

which is kind of lengthy. Maybe it would make sense to have a isconnected method?

All in all fairly minor issue, but it got me a little bit confused as a first-time user.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant