Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- f = lambda x:x**2-8
- def dich(f,a,b,e):
- deb = a
- fin = b
- mil = (a+b)/2
- while f(deb)*f(fin)<0 and (fin-deb)>e:
- if f(mil)==0:
- break
- elif f(deb)*f(mil)<0:
- fin = mil
- else:
- deb = mil
- mil = (deb+fin)/2
- return([deb,fin])
- print(dich(f,0,4,pow(10,-4)))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement