Compare commits
3 Commits
18d7e8cdb5
...
76153f334e
| Author | SHA1 | Date | |
|---|---|---|---|
| 76153f334e | |||
| 868566149d | |||
| 7eee7fc75b |
@ -1,2 +1,3 @@
|
|||||||
numpy
|
numpy
|
||||||
matplotlib
|
matplotlib
|
||||||
|
ipykernel
|
||||||
35
src/serie_3.py
Normal file
35
src/serie_3.py
Normal 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("----------------------------------------------------------------")
|
||||||
Loading…
x
Reference in New Issue
Block a user