Skip to content
This repository was archived by the owner on May 15, 2025. It is now read-only.

Commit 0bbf01f

Browse files
committed
Use safer formula for falsi point in ITP
1 parent 21e4e3d commit 0bbf01f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/itp.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ function SciMLBase.solve(prob::IntervalNonlinearProblem, alg::ITP,
8080
n0 = alg.n0
8181
n_h = ceil(log2(abs(right - left) / (2 * ϵ)))
8282
mid = (left + right) / 2
83-
x_f = (fr * left - fl * right) / (fr - fl)
83+
x_f = left + (right - left) * (fl/(fl - fr))
8484
xt = left
8585
xp = left
8686
r = zero(left) #minmax radius
@@ -94,7 +94,7 @@ function SciMLBase.solve(prob::IntervalNonlinearProblem, alg::ITP,
9494
δ = k1 * (span^k2)
9595

9696
## Interpolation step ##
97-
x_f = (fr * left - fl * right) / (fr - fl)
97+
x_f = left + (right - left) * (fl/(fl - fr))
9898

9999
## Truncation step ##
100100
σ = sign(mid - x_f)

0 commit comments

Comments
 (0)