From 51fd37f80b90b882ddcc3b50eff6d4232e633aeb Mon Sep 17 00:00:00 2001 From: Namu Date: Wed, 7 Jan 2026 14:35:53 +0100 Subject: [PATCH] =?UTF-8?q?Feat:=20Ajoute=20la=20comparaison=20graphique?= =?UTF-8?q?=20entre=20sin(x)=20et=20l'interpolation=20avec=20le=20polyn?= =?UTF-8?q?=C3=B4me=20de=20Newton?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tp6.py | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) 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()