Compare commits

...

3 Commits

2 changed files with 37 additions and 1 deletions

View File

@ -1,2 +1,3 @@
numpy
matplotlib
matplotlib
ipykernel

35
src/serie_3.py Normal file
View File

@ -0,0 +1,35 @@
# %%
import numpy as np
import matplotlib.pyplot as plt
# %%
print("----------------------------------------------------------------")
print(__file__)
print("Aufgabe 2. Interpolationspolynome gemäss NEWTON-Schema berechnen")
print("----------------------------------------------------------------")
# punkte [[x0, x1, x2, xn], [y0, y1, y2, yn]]
punkte = [
[np.array([4, 8]), np.array([1, -1])],
[np.array([-1, 1, 2]), np.array([15, 5, 9])],
[np.array([-1, 0, 1, 2]), np.array([-5, -1, -1, 1])],
]
for punkt in punkte:
# Parameter
x_data = punkt[0]
y_data = punkt[1]
x_0 = x_data[0]
x_e = x_data[-1]
N = 201
lw = 3
fig = 1
# Berechnung
n = np.size(y_data)
TAB = np.block([[y_data], [np.zeros((n-1, n))]])
c_data = np.zeros(n)
c_data[0] = y_data[0]
print("----------------------------------------------------------------")