diff --git a/tp6.py b/tp6.py index d126dd4..7413311 100644 --- a/tp6.py +++ b/tp6.py @@ -108,19 +108,35 @@ def exercice2() -> None: x = [i for i in range(len(x_i))] - f = lambda x : np.sin(x) + f = lambda input_of_f : np.sin(input_of_f) results = [] + real_results = [] for i in x: res = P_newton(x_i, [f(x_i[i]) for i in range(len(x_i))], i) print(res) + real_results.append(f(i)) results.append(res) + print(real_results) + plt.plot(results) + plt.plot(real_results, '-.') plt.show() +def exercice3() -> None: + t = [1.5, 3.5, 4.5, 11, 12, 13] + h = [80, 160, 184, 184, 149, 116] + + # fonction de calcul de h + f_h = lambda a, b, c, t: a * (t ** 2) + b * t + c + + print(f'{f_h(1,2,3,t[0])}') + + if __name__ == '__main__': - exercice1() - #exercice2() + #exercice1() + exercice2() + #exercice3()