JuliaIntervals / IntervalRootFinding.jl

Library for finding the roots of a function using interval arithmetic
https://juliaintervals.github.io/IntervalRootFinding.jl/
Other
127 stars 26 forks source link

Incorrect result for newton1d(x->sin(x)-x) #48

Closed dpsanders closed 6 years ago

dpsanders commented 6 years ago

This has a triple (?) root at 0.

julia> newton1d(x -> sin(x) - x, -10..10)
4-element Array{IntervalRootFinding.Root{IntervalArithmetic.Interval{Float64}},1}:
 Root([-2.55949e-08, 9.21914e-10], :unique)
 Root([9.21913e-10, 1.0455e-08], :unique)
 Root([1.04549e-08, 1.99881e-08], :unique)
 Root([2.74386e-08, 3.41862e-08], :unique)

This result is incorrect: there are not unique roots in those intervals.

cc @eeshan9815

dpsanders commented 6 years ago

The behaviour seems to have got worse:

julia> newton1d(x -> sin(x) - x, -10..11)
0-element Array{IntervalRootFinding.Root{IntervalArithmetic.Interval{Float64}},1}

whereas there is actually a root at 0. :/

dpsanders commented 6 years ago

cc @eeshan9815

dpsanders commented 6 years ago

@eeshan9815 We need a lot more tests to catch things like this!