Fix incorrect algorithm

This commit is contained in:
Manuel Thalmann 2023-03-29 08:40:25 +02:00
parent 483f4d1c25
commit 57bb3a3368

View file

@ -28,7 +28,7 @@ def Miguel_S5_Aufg2(x, y, xx):
z[i] = 3 * (((y[2] - y[1]) / h[1]) - ((y[1] - y[0]) / h[0]))
elif i == n - 3:
A[i][i - 1] = h[i - 1]
A[i][i] = h[i - 1] + h[i]
A[i][i] = 2 * (h[i - 1] + h[i])
z[i] = 3 * (((y[i + 1] - y[i]) / h[i]) - ((y[i] - y[i - 1]) / h[i - 1]))
else:
A[i][i - 1] = h[i - 1]
@ -63,6 +63,5 @@ y = array([6, 3, 9, 0])
xx = array([4.5, 6.5, 9.0])
Miguel_S5_Aufg2(x, y, xx)
pyplot.scatter(xx, interpolate.CubicSpline(x, y)(xx))
# %%