diff --git a/Schenk_Brandenberger_S2_Aufg2.py b/Schenk_Brandenberger_S2_Aufg2.py new file mode 100644 index 0000000..5690386 --- /dev/null +++ b/Schenk_Brandenberger_S2_Aufg2.py @@ -0,0 +1,21 @@ +import numpy as np +import matplotlib.pyplot as plt + +#Aufgabe 2a +xmin = 1.99 +xmax = 2.01 +x_number_of_points = 500 +xsteps = (xmax - xmin) / x_number_of_points +def f(x): + return x ** 7 - 14 * x ** 6 + 84 * x ** 5 - 280 * x ** 4 + 560 * x ** 3 - 672 * x ** 2 + 448 * x - 128 +def g(x): + return (x - 2) ** 7 +x = np.arange(xmin, xmax + xsteps, xsteps) +yf = np.array([]) +yg = np.array([]) +for x_value in x: + yf = np.append(yf, f(x_value)) + yg = np.append(yg, g(x_value)) +plt.plot(x, yf) +plt.plot(x, yg) +plt.show() \ No newline at end of file