Solved Task 3
This commit is contained in:
parent
14704d5cc6
commit
ee463720d9
|
@ -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.
|
||||
|
|
Loading…
Reference in New Issue