Advertisement
Guest User

yaulan

a guest
Jan 17th, 2019
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.91 KB | None | 0 0
  1. from math import*
  2. borne_inf=float(input("Borne inférieure de l'intervalla d'étude:"))
  3. image_borne_inf=2*borne_inf-2
  4. borne_sup=float(input("Borne supérieure de l'intervalle d'étude:"))
  5. image_borne_sup=4*borne_sup-4
  6. ecart=abs(borne_sup-borne_inf)
  7. if image_borne_inf<0 and image_borne_sup<0:
  8. print("Les images sont de meme signe:impossible d'executer l'algorithme.")
  9. else:
  10. if image_borne_inf>0 and image_borne_sup>0
  11. print("Les images sont de meme signe:impossible d'exécuter l'algorythme.")
  12. else:
  13. while (ecart>0.01):
  14. milieu=(borne_inf+borne_sup)/2
  15. image_milieu=2*milieu-2
  16. if image_milieu<0 and image_borne_inf>0:
  17. borne_sup=milieu
  18. else:
  19. if image_milieu>0 and image_borne_sup<0:
  20. borne_inf=milieu
  21. ecart=abs(borne_sup-borne_inf)
  22. print("l'antécédent de 0 par f vaut",milieu,"au centième près.")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement