Merge remote-tracking branch 'origin/main'
# Conflicts: # Schenk_Brandenberger_S2_Aufg3.py
This commit is contained in:
commit
388773f989
|
@ -17,12 +17,12 @@ y_new = np.array([])
|
||||||
for i in range(50):
|
for i in range(50):
|
||||||
sum_s = sn * n
|
sum_s = sn * n
|
||||||
sum_s_new = sn_new * n
|
sum_s_new = sn_new * n
|
||||||
pi = sum_s / 2
|
pi2 = sum_s
|
||||||
pi_new = sum_s_new / 2
|
pi2_new = sum_s_new
|
||||||
print("n: ", n, " sn: ", sn_new, " pi: ", pi)
|
print("n: ", n, " sn: ", sn_new, " pi: ", pi2)
|
||||||
x = np.append(x, n)
|
x = np.append(x, n)
|
||||||
y = np.append(y, pi)
|
y = np.append(y, pi2)
|
||||||
y_new = np.append(y_new, pi_new)
|
y_new = np.append(y_new, pi2_new)
|
||||||
|
|
||||||
n = n * 2
|
n = n * 2
|
||||||
sn = s2n(sn)
|
sn = s2n(sn)
|
||||||
|
@ -34,8 +34,9 @@ plt.plot(x, y)
|
||||||
plt.plot(x, y_new)
|
plt.plot(x, y_new)
|
||||||
plt.xscale('log', base=2)
|
plt.xscale('log', base=2)
|
||||||
plt.xlim((2**3, 2**31))
|
plt.xlim((2**3, 2**31))
|
||||||
plt.ylim((3.125, 3.15))
|
|
||||||
plt.legend(["2*pi", "2*pi_new"])
|
plt.legend(["2*pi", "2*pi_new"])
|
||||||
|
plt.ylim((6.25, 6.3))
|
||||||
|
plt.title("Aufgabe 3")
|
||||||
plt.show()
|
plt.show()
|
||||||
|
|
||||||
# mit der ersten Formel stimmt der berechnete Wert ab n = 50331648 nicht mehr.
|
# mit der ersten Formel stimmt der berechnete Wert ab n = 50331648 nicht mehr.
|
||||||
|
|
Loading…
Reference in New Issue