Closed dpsanders closed 4 months ago
This can be implemented using piecewise
from this comment:
julia> f(x) = piecewise((-Inf..0 => x -> 0..0, 0..Inf => x -> sqrt(x)), x)
f (generic function with 1 method)
julia> f(1..2)
[0.0, 1.41422]_trv
julia> f(-1..1)
[0.0, 1.0]_trv
julia> f(-1..(-1))
[0.0, 0.0]_trv
Suppose I want to define a function
I believe that currently we have no mechanism for a user to do this in terms of interval objects. (They would have to manually define it using
inf
,sup
,if
etc.)A natural way would be to define
Heaviside
as in https://github.com/JuliaIntervals/IntervalArithmetic.jl/issues/653 and thenBut this will give empty for
x < 0
, instead of0
, sincesqrt(x)
gives empty.We either need a "strong 0" that gives
0
when multiplied by empty, or a general functionthat does this in the interval context.