From d364086bb1935173e43fd8ba5a022a8bb907a71d Mon Sep 17 00:00:00 2001 From: leobr Date: Wed, 12 Oct 2022 16:04:26 +0200 Subject: [PATCH] code improvement implemented --- Schenk_Brandenberger_S2_Aufg3.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Schenk_Brandenberger_S2_Aufg3.py b/Schenk_Brandenberger_S2_Aufg3.py index 967f95b..350b77f 100644 --- a/Schenk_Brandenberger_S2_Aufg3.py +++ b/Schenk_Brandenberger_S2_Aufg3.py @@ -22,7 +22,7 @@ for i in range(50): sum_s_new = sn_new * n pi2 = sum_s pi2_new = sum_s_new - print("n: ", n, " sn: ", sn_new, " pi: ", pi2) + print(f'n: {n} sn: {sn_new} pi: {pi2}') x = np.append(x, n) y = np.append(y, pi2) y_new = np.append(y_new, pi2_new) @@ -31,12 +31,12 @@ for i in range(50): sn = s2n(sn) sn_new = s2n_new(sn_new) -plt.plot(x, y) -plt.plot(x, y_new) +plt.plot(x, y, label='2*pi') +plt.plot(x, y_new, label='2*pi_new') plt.xscale('log', base=2) plt.xlim((2 ** 3, 2 ** 31)) plt.ylim((6.25, 6.3)) -plt.legend(["2*pi", "2*pi_new"]) +plt.legend() plt.title("Aufgabe 3") plt.show()