def test4(self): fx = "math.cos(x)" f = lambda x: eval("np.cos(x)") equa = Equa_Solver(f=fx, a=0, b=2, err=1e-14) dichoRes = Dichotomie.solve(equa) t = np.linspace(0, 2, 10) drawGraph(t, f, dichoRes)
def test5(self): fx = "x**3 - 4*x + 1" f = lambda x: eval("x**3 - 4*x + 1") equa = Equa_Solver(f=fx, a=0, b=1, err=1e-14) dichoRes = Dichotomie.solve(equa) t = np.linspace(0, 1, 10) drawGraph(t, f, dichoRes)
def test5(self): print("-----------------------------------") print("| Méthode Dichotomie |") print("-----------------------------------") f = "x**3 - 4*x + 1" equa = Equa_Solver(f=f, a=-3, b=-2, err=1e-8) x_list = Dichotomie.solve(equa) print_rate(x_list)
def test2(self): fx = "x**3 - x**2 - 1" f = lambda x: eval(fx) equa = Equa_Solver(f=fx, a=1, b=2, err=1e-8) dichoRes = Dichotomie.solve(equa) t = np.linspace(1, 2, 10) drawGraph(t, f, dichoRes)
def test5(self): print("-----------------------------------") print("| Méthode Cordes |") print("-----------------------------------", ) f = "x**3 - 4*x + 1" equa = Equa_Solver(f=f, a=-3.0, b=-2.0) x_list = Cordes.solve(equa) print_rate(x_list)
def test3(self): print("-----------------------------------") print("| Méthode Dichotomie |") print("-----------------------------------") f = "cos(2*x)**2 - x**2" equa = Equa_Solver(f=f, a=0, b=1, err=1e-8) x_list = Dichotomie.solve(equa) print_rate(x_list)
def test6(self): print("-----------------------------------") print("| Méthode Cordes |") print("-----------------------------------", ) f = "x-exp(-x)" equa = Equa_Solver(f=f, a=0.0, b=1.0) x_list = Cordes.solve(equa) print_rate(x_list)
def test6(self): print("-----------------------------------") print("| Méthode Fausse position |") print("-----------------------------------", ) f = "x-exp(-x)" equa = Equa_Solver(f=f, a=0.0, b=1.0) x_list = FalsePosition.solve(equa) print_rate(x_list)
def test1(self): fx = "x**2-math.cos(x)" f = lambda x: eval("x**2-np.cos(x)") equa = Equa_Solver(f=fx, a=0, b=1, err=1e-15) dichoRes = Dichotomie.solve(equa) t = np.linspace(0, 1, 10) drawGraph(t, f, dichoRes)
def test3(self): print("-----------------------------------") print("| Méthode Cordes |") print("-----------------------------------", ) f = "cos(2*x)**2 - x**2" equa = Equa_Solver(f=f, a=0.0, b=1) x_list = Cordes.solve(equa) print_rate(x_list)
def test5(self): print("-----------------------------------") print("| Méthode Fausse position |") print("-----------------------------------", ) f = "x**3 - 4*x + 1" equa = Equa_Solver(f=f, a=-3.0, b=-2.0) x_list = FalsePosition.solve(equa) print_rate(x_list)
def test4(self): print("-----------------------------------") print("| Méthode Dichotomie |") print("-----------------------------------") f = "cos(x)" equa = Equa_Solver(f=f, a=0, b=2, err=1e-8) x_list = Dichotomie.solve(equa) print_rate(x_list)
def test1(self): print("-----------------------------------") print("| Méthode Fausse position |") print("-----------------------------------", ) f = "x**2-cos(x)" equa = Equa_Solver(f=f, err=1e-8, a=0.0, b=1.0) x_list = FalsePosition.solve(equa) print_rate(x_list)
def test4(self): print("-----------------------------------") print("| Méthode Cordes |") print("-----------------------------------", ) f = "cos(x)" equa = Equa_Solver(f=f, a=0.0, b=3.0) x_list = Cordes.solve(equa) print_rate(x_list)
def test1(self): print("-----------------------------------") print("| Méthode Cordes |") print("-----------------------------------", ) f = "x**2-cos(x)" equa = Equa_Solver(f=f, err=1e-8, a=0.0, b=1.0, max_iter=10) x_list = Cordes.solve(equa) print_rate(x_list)
def test3(self): print("-----------------------------------") print("| Méthode Fausse position |") print("-----------------------------------", ) f = "cos(2*x)**2 - x**2" equa = Equa_Solver(f=f, a=0.0, b=1) x_list = FalsePosition.solve(equa) print_rate(x_list)
def test2(self): print("-----------------------------------") print("| Méthode Dichotomie |") print("-----------------------------------") f = "x**3 - x**2 - 1" equa = Equa_Solver(f=f, a=1, b=2, err=1e-8) x_list = Dichotomie.solve(equa) print_rate(x_list)
def test1(self): formule = self.entryFomule.get() fx = formule try: f = lambda x: eval(fx) a = float(self.entryA.get()) b = float(self.entryB.get()) equa = Equa_Solver(f=fx, a=a, b=b, err=1e-15) dichoRes = Dichotomie.solve(equa) dichoRes_final = dichoRes[-1] dichoRes.pop() cv = None t = np.linspace(a, b, 10, endpoint=False) drawGraph(a, b, fx, 1e-15, t, f, dichoRes, cv=cv) except ValueError as verr: showerror( title=" Intervalle érroné", message=" Les bornes d'intervalle doivent etre des entiers !" ) return except (TypeError, SyntaxError): showerror( title=" Formule érronée", message=" La fonction que vous avez entré n'est pas correcte !" ) return except SolverException: showerror( title=" monotonie !", message= " La fonction que vous avez entré n'est pas monotonne \n f(a)f(b) > 0 !" ) return except Exception as ex: showerror( title=" Intervalle érroné", message=" Les bornes d'intervalle doivent etre des entiers !" ) return