Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def find_root(f, a, b,tol):
- eps=10e-6
- while abs(b-a)>=eps and b-a>tol:
- c=(b+a)/2.0
- if f(c)==0:
- break
- elif f(a)*f(c)<0:
- b=c
- else:
- a=c
- return c
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement