Skip to content

Commit fce3589

Browse files
Merge pull request #1137 from DaniGlez/master
Tighten the interval returned by InternalITP when there's an exact zero crossing
2 parents 0874ff4 + 8710d95 commit fce3589

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

src/internal_itp.jl

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ function SciMLBase.solve(prob::IntervalNonlinearProblem{IP, Tuple{T, T}}, alg::I
4141
retcode = ReturnCode.ExactSolutionRight, left, right)
4242
end
4343
span = abs(right - left)
44-
k1 = T(alg.scaled_k1)/span
44+
k1 = T(alg.scaled_k1) / span
4545
n0 = T(alg.n0)
4646
n_h = exponent(span / (2 * ϵ))
4747
ϵ_s = ϵ * exp2(n_h + n0)
@@ -61,11 +61,6 @@ function SciMLBase.solve(prob::IntervalNonlinearProblem{IP, Tuple{T, T}}, alg::I
6161
xt = ifelse abs(diff), x_f + copysign(δ, diff), mid) # Truncation Step
6262

6363
xp = ifelse(abs(xt - mid) r, xt, mid - copysign(r, diff)) # Projection Step
64-
if span < 2ϵ
65-
return SciMLBase.build_solution(
66-
prob, alg, xt, f(xt); retcode = ReturnCode.Success, left, right
67-
)
68-
end
6964
yp = f(xp)
7065
yps = yp * sign(fr)
7166
if yps > T0
@@ -74,7 +69,7 @@ function SciMLBase.solve(prob::IntervalNonlinearProblem{IP, Tuple{T, T}}, alg::I
7469
left, fl = xp, yp
7570
else
7671
return SciMLBase.build_solution(
77-
prob, alg, xp, yps; retcode = ReturnCode.Success, left, right
72+
prob, alg, xp, yps; retcode = ReturnCode.Success, left = xp, right = xp
7873
)
7974
end
8075

0 commit comments

Comments
 (0)