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

Krawczyk fails for functions with interval parameters #99

Closed
Kolaru opened this issue Oct 4, 2018 · 5 comments
Closed

Krawczyk fails for functions with interval parameters #99

Kolaru opened this issue Oct 4, 2018 · 5 comments

Comments

@Kolaru
Copy link
Collaborator

Kolaru commented Oct 4, 2018

julia> a = 2..2.1
[2, 2.10001]

julia> roots(x -> x^2 - a, -4..4, Krawczyk)
0-element Array{Root{Interval{Float64}},1}

Newton seems to be fine

julia> roots(x -> x^2 - a, -4..4, Newton)
2-element Array{Root{Interval{Float64}},1}:
 Root([1.4141, 1.44946], :unique)
 Root([-1.44946, -1.4141], :unique)
@dpsanders
Copy link
Member

Thanks for the report.

Krawczyk hasn't received much attention. Presumably it's supposed to work for cases like this?

Bisection also does badly, since it ends up bisecting the interval that is the solution :/

@Kolaru
Copy link
Collaborator Author

Kolaru commented Oct 29, 2018

The problem is not the interval parameters, but the fact that our favorite example currently fails with Krawczyk, because the derivative is 0 at the middle point:

julia> roots(x -> x^2 - 2, -4..4, Krawczyk)
0-element Array{Root{Interval{Float64}},1}

The reason is given in the new issue #102.

If the interval is not symmetric, it does just fine:

julia> roots(x -> x^2 - (2..2.1), -4..4.0001, Krawczyk)
2-element Array{Root{Interval{Float64}},1}:
 Root([1.4141, 1.44947], :unique)
 Root([-1.44947, -1.4141], :unique)

Theoretically it is supposed to work fine in this case because for an interval A, the interval extension of x^2 - A is also a (bad) interval extension for x^2 - a for any a in A. Then, all methods may bisect the solution if they are unable to conclude that it exists for all a in A. In that case it is the parameter interval A that should be bisected.

On the up side, I need to do this, so I will be implementing an algorithm doing exactly this tonight :D

@dpsanders
Copy link
Member

This seems to be fixed now:

julia> a = 2..2.1
[2, 2.10001]

julia> roots(x -> x^2 - a, -4..4, Krawczyk)
2-element Array{Root{Interval{Float64}},1}:
 Root([1.41409, 1.44947], :unique)
 Root([-1.44946, -1.4141], :unique)

@dpsanders
Copy link
Member

Needs a test.

@dpsanders dpsanders reopened this Mar 7, 2019
@Kolaru Kolaru mentioned this issue Mar 8, 2019
10 tasks
@Kolaru
Copy link
Collaborator Author

Kolaru commented Mar 8, 2019

I've added it to the (ever growing) list of missing tests in #115.

@Kolaru Kolaru closed this as completed Mar 8, 2019
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

2 participants