JuliaIntervals / IntervalContractors.jl

Interval contractors and inverse (reverse) functions for Julia
Other
10 stars 10 forks source link

Improve mul_rev #28

Closed dpsanders closed 5 years ago

dpsanders commented 5 years ago

Consider the following example from Hickey 1997 (in the notation of this package):

julia> x = -1..5
[-1, 5]

julia> y = -1..1
[-1, 1]

julia> z = 2..10
[2, 10]

julia> result = mul_rev(z, x, y)
([2, 10], [-1, 5], [-1, 1])

However, in fact it's possible to show that the result for x and y should be

(2..10, 0.4..1, 2..5)

(and z should be 2..5).

This can be obtained by splitting up x and y into positive and negative parts and then taking the hull:

julia> x .∩ extended_div(z, y)
(∅, [2, 5])

julia> union( (x .∩ extended_div(z, y))...)
[2, 5]

julia> union( (y .∩ extended_div(z, x))...)
[0.4, 1]
dpsanders commented 5 years ago

According to Hickey, it's necessary to separate out 0 for separate treatment.?