Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from math import*
- borne_inf=float(input("Borne inférieure de l'intervalla d'étude:"))
- image_borne_inf=2*borne_inf-2
- borne_sup=float(input("Borne supérieure de l'intervalle d'étude:"))
- image_borne_sup=4*borne_sup-4
- ecart=abs(borne_sup-borne_inf)
- if image_borne_inf<0 and image_borne_sup<0:
- print("Les images sont de meme signe:impossible d'executer l'algorithme.")
- else:
- if image_borne_inf>0 and image_borne_sup>0
- print("Les images sont de meme signe:impossible d'exécuter l'algorythme.")
- else:
- while (ecart>0.01):
- milieu=(borne_inf+borne_sup)/2
- image_milieu=2*milieu-2
- if image_milieu<0 and image_borne_inf>0:
- borne_sup=milieu
- else:
- if image_milieu>0 and image_borne_sup<0:
- borne_inf=milieu
- ecart=abs(borne_sup-borne_inf)
- 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