Skip to content

Commit 2e1a255

Browse files
authored
bug fix (#471)
corrected small typo in the Brent's method. According to the model, the second condition is (mflag is cleared and |s-b| >= |c-d|/2) not (mflag is cleared and |s-b| >= |b-c|/2) The first iteration would be the same but after it might vary.
1 parent dc3c080 commit 2e1a255

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/Bracketing/brent.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ function update_state(
6060
tol = max(options.xabstol, max(abs(b), abs(c), abs(d)) * options.xreltol)
6161
if !(u < s < v) ||
6262
(mflag && abs(s - b) >= abs(b - c) / 2) ||
63-
(!mflag && abs(s - b) >= abs(b - c) / 2) ||
63+
(!mflag && abs(s - b) >= abs(c - d) / 2) ||
6464
(mflag && abs(b - c) <= tol) ||
6565
(!mflag && abs(c - d) <= tol)
6666
s = _middle(a, b)

0 commit comments

Comments
 (0)