Skip to content

Commit 15b7605

Browse files
authored
Merge pull request #31 from JuliaIntervals/gradient
Gradient operator
2 parents 5dd515b + 4200982 commit 15b7605

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

src/IntervalRootFinding.jl

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,15 @@ include("krawczyk.jl")
6363
include("complex.jl")
6464
include("branch_and_prune.jl")
6565

66+
67+
gradient(f) = X -> ForwardDiff.gradient(f, SVector(X))
68+
const= gradient
69+
70+
export
71+
72+
73+
74+
6675
function find_roots{T}(f::Function, a::Interval{T}, method::Function = newton;
6776
tolerance = eps(T), debug = false, maxlevel = 30)
6877

test/roots.jl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,3 +54,9 @@ end
5454
rts = roots(g, IntervalBox(X, 3))
5555
@test length(rts) == 4
5656
end
57+
58+
@testset "Stationary points" begin
59+
f(xx) = ( (x, y) = xx; sin(x) * sin(y) )
60+
rts = roots((f), IntervalBox(-5..6, 2), Newton, 1e-5)
61+
@test length(rts) == 25
62+
end

0 commit comments

Comments
 (0)