Advertisement
Guest User

Untitled

a guest
Nov 17th, 2019
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. #Zad_4
  2. #Bisection_method
  3. def t(x):
  4. import math
  5. return 2 * x**3 - 3 * x**2 - 10*x + 25
  6. def granice(xmax,xmin,precision):
  7.  
  8. while abs(xmax-xmin)>precision:
  9. xmid = (xmin + xmax) / 2
  10. xmidValue = t(xmid)
  11. if(xmidValue) > 0:
  12. xmax = xmid
  13. elif(xmid < 0):
  14. xmin = xmid
  15. else:
  16. return(xmid,xmidValue)
  17. break
  18. return(xmid,xmidValue)
  19.  
  20.  
  21.  
  22. granice(float(input("X max : ")),float(input("X min : ")),float(input("Precision : ")))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement