IntervalSets.jl icon indicating copy to clipboard operation
IntervalSets.jl copied to clipboard

Support broadcasting for `+`, `-`, `*`, `/` in 0.7?

Open dlfivefifty opened this issue 6 years ago • 2 comments

While it makes sense to not override +, etc. to mean interval arithmetic, overriding broadcast notation seems less confusion. I'd propose that broadcasting is meant in the sense of set arithmetic: that is, x in d1 .+ d2 iff there exists s in d1 and t in d2 such that x == s+t. In particular,

(1..2) .+ 1 == 2..3
(1..2) .+ (3..4) == 4..6
(1..2) .+ (3..5) == 4..7
3 .* (1..2) == 3..6

Less clear is what to do for discontinuous special functions:

exp.(1..2) == exp(1) .. exp(2)
sign.(1..2) == 1..1
sign.(-1 .. 1) # throws error? But how to catch this?

dlfivefifty avatar Jul 31 '18 12:07 dlfivefifty

I really like this suggestion since it's a natural consequence of interval-as-container.

For practical implementation, there is one major concern: roundoff error. I'll discuss in #55.

timholy avatar Sep 15 '19 09:09 timholy

Can map be defined on these too?

jariji avatar Apr 03 '24 05:04 jariji