We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 56d6f97 commit e3f1eaeCopy full SHA for e3f1eae
1 file changed
maths/numerical_analysis/brents_method.py
@@ -39,7 +39,7 @@ def brent_method(
39
for _ in range(max_iter):
40
if fb == 0:
41
return b
42
- if fa != fc and fb != fc:
+ if fc not in {fa, fb}:
43
# Inverse quadratic interpolation
44
s = (
45
a * fb * fc / ((fa - fb) * (fa - fc)) +
@@ -85,4 +85,4 @@ def brent_method(
85
86
if __name__ == "__main__":
87
from doctest import testmod
88
- testmod()
+ testmod()
0 commit comments