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

Optimum term in quadratic expansion #109

Closed
mforets opened this issue Jan 29, 2020 · 5 comments · Fixed by #175
Closed

Optimum term in quadratic expansion #109

mforets opened this issue Jan 29, 2020 · 5 comments · Fixed by #175
Assignees

Comments

@mforets
Copy link
Member

mforets commented Jan 29, 2020

Doing (α + βx) x looses the dependency between the arguments, so it may be less precise using interval arithmetic. If there is a general rule, one has to find it by taking the derivative of the expression as in the paper, which is a particular case with alpha, beta being something like t and 1/2t^2.

julia> fprod(α, β, x) =+ β*x)*x
fprod (generic function with 1 method)

julia> fsum(α, β, x) = α*x + β*x^2
fsum (generic function with 1 method)

julia> y = Interval(-1, 1)
[-1, 1]

julia> fprod(0.0, 1.0, y)
[-1, 1]

julia> fsum(0.0, 1.0, y) # fsum is tighter
[0, 1]

julia> y = Interval(-3, -2)
[-3, -2]

julia> fprod(1.0, 2.0, y) # fprod is tighter
[6, 15]

julia> fsum(1.0, 2.0, y)
[5, 16]

Originally posted by @mforets in #91 (comment)

@lucaferranti
Copy link
Member

Assuming $\alpha$ and $\beta$ are not intervals, in this case you can eliminate the dependency problem the following way

fexact(α, β, x) = ((2*β*x + α)^2 - α^2)/(4*β)

this way

julia> y = Interval(-1, 1)
[-1, 1]

julia> fprod(0.0, 1.0, y), fsum(0.0, 1.0, y), fexact(0.0, 1.0, y)
([-1, 1], [0, 1], [-0, 1])

julia> y = Interval(-3, -2)
[-3, -2]

julia> fprod(1.0, 2.0, y), fsum(1.0, 2.0, y), fexact(1.0, 2.0, y)
([6, 15], [5, 16], [6, 15])

julia> y = Interval(-3, 3)
[-3, 3]

julia> fprod(1.0, 2.0, y), fsum(1.0, 2.0, y), fexact(1.0, 2.0, y)
([-21, 21], [-3, 21], [-0.125, 21])

here is a plot of the latest case
example

@lucaferranti
Copy link
Member

well the formula above doesn't work if $\beta=0$, but that's a trivial case to consider

@lucaferranti
Copy link
Member

where should this go? I can open a PR for this.

Also does my assumption (alpha and beta are not intervals) hold? If it doesn't, it may make dependency problem worse

@mforets
Copy link
Member Author

mforets commented Sep 22, 2021

where should this go?

i no longer remember the context in which this method was needed. (seems to be the scalar version of this one).

then i suggest to define the method on exponential.jl and with signature

quadratic_expansion(x::Interval, α::Real, β::Real)

(NB this library doesn't depend on LazySets so there is no risk of confusion between LazySets.Interval and IntervalArithmetic.Interval)

Also does my assumption (alpha and beta are not intervals) hold?

yes, that assumption holds

I can open a PR for this.

go for it 👍

@lucaferranti
Copy link
Member

Next that function should replace this line ? With a quick glance, the rest of the code should not suffer from dependency issues?

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

Successfully merging a pull request may close this issue.

2 participants