Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def f(x):
- return()
- a = float(input())
- b = float(input())
- eps = float(input())
- while abs(b - a) > eps:
- x = (a + b) / 2.0
- fx = f(x)
- fa = f(a)
- if (fx < 0 and fa < 0) or (fx > 0 and fa > 0):
- a = x
- else:
- b = x
- print(x)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement