From ee463720d9fcfa748fc8b36088c1c2105883e1aa Mon Sep 17 00:00:00 2001 From: schrom01 Date: Fri, 7 Oct 2022 11:07:47 +0200 Subject: [PATCH] Solved Task 3 --- Schenk_Brandenberger_S2_Aufg3.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/Schenk_Brandenberger_S2_Aufg3.py b/Schenk_Brandenberger_S2_Aufg3.py index 48d436c..af94020 100644 --- a/Schenk_Brandenberger_S2_Aufg3.py +++ b/Schenk_Brandenberger_S2_Aufg3.py @@ -17,12 +17,12 @@ y_new = np.array([]) for i in range(50): sum_s = sn * n sum_s_new = sn_new * n - pi = sum_s / 2 - pi_new = sum_s_new / 2 - print("n: ", n, " sn: ", sn_new, " pi: ", pi) + pi2 = sum_s + pi2_new = sum_s_new + print("n: ", n, " sn: ", sn_new, " pi: ", pi2) x = np.append(x, n) - y = np.append(y, pi) - y_new = np.append(y_new, pi_new) + y = np.append(y, pi2) + y_new = np.append(y_new, pi2_new) n = n * 2 sn = s2n(sn) @@ -34,8 +34,9 @@ plt.plot(x, y) plt.plot(x, y_new) plt.xscale('log', base=2) plt.xlim((2**3, 2**31)) -plt.ylim((3.125, 3.15)) +plt.ylim((6.25, 6.3)) plt.legend(["pi", "pi_new"]) +plt.title("Aufgabe 3") plt.show() # mit der ersten Formel stimmt der berechnete Wert ab n = 50331648 nicht mehr.