Skip to content

Commit 71ca13e

Browse files
author
Luis Benet
committed
Small fixes in roots (after the review)
Also deleted `deriv` from the roots when using Bisection
1 parent 27cd0e3 commit 71ca13e

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/roots.jl

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,8 @@ IntervalLike{T} = Union{Interval{T}, IntervalBox{T}}
119119
NewtonLike = Union{Type{Newton}, Type{Krawczyk}}
120120

121121
"""
122-
roots(f, X, contractor, tol=1e-3 ; deriv=nothing)
122+
roots(f, X, contractor, tol=1e-3)
123+
roots(f, deriv, X, contractor, tol=1e-3)
123124
124125
Uses a generic branch and prune routine to find in principle all isolated roots of a function
125126
`f:R^n → R^n` in a box `X`, or a vector of boxes.
@@ -134,15 +135,15 @@ Inputs:
134135
135136
"""
136137
# Contractor specific `roots` functions
137-
function roots(f, X::IntervalLike{T}, ::Type{Bisection}, tol::Float64=1e-3; deriv = nothing) where {T}
138+
function roots(f, X::IntervalLike{T}, ::Type{Bisection}, tol::Float64=1e-3) where {T}
138139
branch_and_prune(X, Bisection(f), tol)
139140
end
140141

141142
function roots(f, X::Interval{T}, C::NewtonLike, tol::Float64=1e-3) where {T}
142143

143144
deriv = x -> ForwardDiff.derivative(f, x)
144145

145-
branch_and_prune(X, C(f, deriv), tol)
146+
roots(f, deriv, X, C, tol)
146147
end
147148

148149
function roots(f, deriv, X::Interval{T}, C::NewtonLike, tol::Float64=1e-3) where {T}
@@ -153,7 +154,7 @@ function roots(f, X::IntervalBox{T}, C::NewtonLike, tol::Float64=1e-3) where {T}
153154

154155
deriv = x -> ForwardDiff.jacobian(f, x)
155156

156-
branch_and_prune(X, C(f, deriv), tol)
157+
roots(f, deriv, X, C, tol)
157158
end
158159

159160
function roots(f, deriv, X::IntervalBox{T}, C::NewtonLike, tol::Float64=1e-3) where {T}

0 commit comments

Comments
 (0)