Skip to content

Commit 7e8d2d8

Browse files
author
debesh
committed
Merge branch 'brent_method' of https://github.com/debesh00800/Python into brent_method
2 parents a531af5 + c623ce6 commit 7e8d2d8

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

maths/brent_method.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,9 @@ def brent_method(
8181
s = right - fr * (right - left) / (fr - fl)
8282

8383
conditions = [
84-
not ((3 * left + right) / 4 < s < right) if right > left else not (right < s < (3 * left + right) / 4),
84+
not ((3 * left + right) / 4 < s < right)
85+
if right > left
86+
else not (right < s < (3 * left + right) / 4),
8587
iteration > 1 and abs(s - right) >= abs(right - c) / 2,
8688
iteration <= 1 and abs(s - right) >= abs(c - d) / 2,
8789
iteration > 1 and abs(right - c) < tol,

0 commit comments

Comments
 (0)