Skip to content

Commit

Permalink
Fix type instability in Newton 1D operator;
Browse files Browse the repository at this point in the history
add version without derivative specified
  • Loading branch information
dpsanders committed May 12, 2017
1 parent 410c9f5 commit 8006b70
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/newton.jl
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,17 @@ doc"""
Single-variable Newton operator
"""
function N{T}(f::Function, x::Interval{T}, deriv::Interval{T})
m = guarded_mid(f, x)
m = Interval(m)
m = Interval( guarded_mid(f, x) )

m - (f(m) / deriv)
end

function N{T}(f::Function, x::Interval{T})
m = Interval( guarded_mid(f, x) )

m - (f(m) / ForwardDiff.derivative(f, x))
end

doc"""
Multi-variable Newton operator.
Requires the function to be defined using the `@intervalbox` macro.
Expand Down

0 comments on commit 8006b70

Please sign in to comment.