Skip to content

Commit a033150

Browse files
authored
Merge pull request #233 from ashu01/master
typo fix
2 parents 1182377 + 63189fa commit a033150

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

Bisection.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@ def bisection(function, a, b): # finds where the function becomes 0 in [a,b] us
99
return a
1010
elif function(b) == 0:
1111
return b
12-
elif function(a) * function(b) > 0: # if noone of these are root and they are both possitive or negative,
13-
# then his algorith can't find the root
12+
elif function(a) * function(b) > 0: # if none of these are root and they are both positive or negative,
13+
# then his algorithm can't find the root
1414
print("couldn't find root in [a,b]")
1515
return
1616
else:
1717
mid = (start + end) / 2
18-
while abs(start - mid) > 0.0000001: # untill we achive percise equals to 10^-7
18+
while abs(start - mid) > 0.0000001: # until we achieve precise equals to 10^-7
1919
if function(mid) == 0:
2020
return mid
2121
elif function(mid) * function(start) < 0:
@@ -27,7 +27,7 @@ def bisection(function, a, b): # finds where the function becomes 0 in [a,b] us
2727

2828

2929
def f(x):
30-
return math.pow(x, 3) - 2*x -5
30+
return math.pow(x, 3) - 2*x - 5
3131

3232

3333
print(bisection(f, 1, 1000))

0 commit comments

Comments
 (0)