code improvement implemented

This commit is contained in:
leobr 2022-10-12 16:04:26 +02:00
parent 9534795504
commit d364086bb1
1 changed files with 4 additions and 4 deletions

View File

@ -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()