diff --git a/serie_taylor/revision_part_b.py b/serie_taylor/revision_part_b.py index 8e494d42ef7fe692bed0f75a5966e4cdad2290bb..cd4123a924ce6c76b4ab43705835569ba11da150 100644 --- a/serie_taylor/revision_part_b.py +++ b/serie_taylor/revision_part_b.py @@ -33,18 +33,24 @@ def T(x: float, a: float) -> float: if __name__ == "__main__": - eval_point = 2 - x_axis = np.arange(-5, 9, 0.1) - - print(f"Zéros de la fonction f = {iter_bisection(4, 8, f, True)}") - - # plt.figure(figsize=(8, 6)) - # plt.plot(x_axis, f(x_axis), label='f(x) = sin(x) + exp(-x) / 10') - # plt.plot(x_axis, T(x_axis, eval_point), - # label='Polynôme de Taylor de degré 5') - # plt.legend() - # plt.xlabel('x') - # plt.ylabel('y') - # plt.title('Polynôme de Taylor de degré 5 pour f(x)') - # plt.grid(True) - # plt.show() + x_eval_point = 2 + start = -5 + stop = 9 + x_axis = np.arange(start, stop, 0.01) + y_eval_point = f(x_eval_point) + + print(f"Zéros de la fonction f = {iter_bisection(-4, -2, f, True)}") + + plt.figure(figsize=(8, 6)) + plt.xlim(start, stop) + plt.ylim(-5, 5) + plt.plot(x_axis, f(x_axis), label='f(x) = sin(x) + exp(-x) / 10') + plt.plot(x_axis, T(x_axis, x_eval_point), + label='Polynôme de Taylor de degré 5') + plt.plot(x_eval_point, y_eval_point, marker="o", markerfacecolor="purple") + plt.legend() + plt.xlabel('x') + plt.ylabel('y') + plt.title('Polynôme de Taylor de degré 5 pour f(x)') + plt.grid(True) + plt.show()