import matplotlib.pyplot as plt import numpy as np def f(x) : return x**4-(5/6)*x**3-(10/3)*x**2+(25/6)*x-1 X = np.linspace(-2.2,2,1000) plt.plot(X,f(X)) plt.grid() plt.show() ## Détermination des 4 racines par dichotomie def dichotomie(f,a,b,epsilon) : fa = f(a) fb = f(b) largeur = b-a while largeur > epsilon : c=(a+b)/2 fc = f(c) if fa*fc < 0: b=c fb=fc else: a=c fa=fc largeur = b-a return c epsilon =1e-12 print(dichotomie(f,-2.1,-1.8,epsilon)) print(dichotomie(f,0,0.5,epsilon)) print(dichotomie(f,0.9,1.2,epsilon)) print(dichotomie(f,1.3,1.6,epsilon))