Determining the sign of a function over a given interval

The simplest thing to do is just use standard interval arithmetic, which happens to work in this case:

julia> using IntervalArithmetic

julia> f(x) = 3x^2 + 2x + 5
f (generic function with 1 method)

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

julia> f(X)
[3, 10]

To show that there is a zero crossing, if you know the function is continuous then it’s enough to find points a and b where sign(f(a)) and sign(f(b)) are opposite – points rather than intervals.

You can instead use the derivative (via automatic differentiation) and show that it is bounded away from 0:

julia> using ForwardDiff

julia> ForwardDiff.derivative(f, 2..3)
[14, 20]

This shows that the derivative is strictly positive over the interval, and hence the function is monotone there.

For more sophisticated root finding, check out IntervalRootFinding.jl:

julia> using IntervalRootFinding

julia> roots(f, X)
0-element Array{Root{Interval{Float64}},1}

This proves that there are no roots over the original interval.

cc @lbenet for Taylor models

5 Likes