Skip to content

Tighten the interval returned by InternalITP when there's an exact zero crossing #1137

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 3 commits into from
Apr 3, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 2 additions & 7 deletions src/internal_itp.jl
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ function SciMLBase.solve(prob::IntervalNonlinearProblem{IP, Tuple{T, T}}, alg::I
retcode = ReturnCode.ExactSolutionRight, left, right)
end
span = abs(right - left)
k1 = T(alg.scaled_k1)/span
k1 = T(alg.scaled_k1) / span
n0 = T(alg.n0)
n_h = exponent(span / (2 * ϵ))
ϵ_s = ϵ * exp2(n_h + n0)
Expand All @@ -61,11 +61,6 @@ function SciMLBase.solve(prob::IntervalNonlinearProblem{IP, Tuple{T, T}}, alg::I
xt = ifelse(δ ≤ abs(diff), x_f + copysign(δ, diff), mid) # Truncation Step

xp = ifelse(abs(xt - mid) ≤ r, xt, mid - copysign(r, diff)) # Projection Step
if span < 2ϵ
return SciMLBase.build_solution(
prob, alg, xt, f(xt); retcode = ReturnCode.Success, left, right
)
end
yp = f(xp)
yps = yp * sign(fr)
if yps > T0
Expand All @@ -74,7 +69,7 @@ function SciMLBase.solve(prob::IntervalNonlinearProblem{IP, Tuple{T, T}}, alg::I
left, fl = xp, yp
else
return SciMLBase.build_solution(
prob, alg, xp, yps; retcode = ReturnCode.Success, left, right
prob, alg, xp, yps; retcode = ReturnCode.Success, left = xp, right = xp
)
end

Expand Down
Loading