From df0a438ada2b583033f45dccc1868ccf8771c3f9 Mon Sep 17 00:00:00 2001 From: "navid.sassan" Date: Tue, 22 Sep 2020 17:54:24 +0200 Subject: [PATCH] actually solved ex1 --- serie1/IT19ta_ZH7_S1_Aufg1.py | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/serie1/IT19ta_ZH7_S1_Aufg1.py b/serie1/IT19ta_ZH7_S1_Aufg1.py index a6e39b3..b7a4db0 100755 --- a/serie1/IT19ta_ZH7_S1_Aufg1.py +++ b/serie1/IT19ta_ZH7_S1_Aufg1.py @@ -4,20 +4,27 @@ import numpy import matplotlib.pyplot as plt -def funktion(): - plt.figure() - plt.xlabel("x") - plt.ylabel("y") - +def main(): x = numpy.arange(-10, 10) y = (x ** 5 - 5 * x ** 4 - 30 * x ** 3 + 110 * x ** 2 + 29 * x - 105) plt.xlim(-6, 8) plt.ylim(-2000, 2000) plt.grid() - plt.plot(x, y) + plt.plot(x, y, label="f(x)") + f_deriv = (5 * x**4 - 20 * x**3 - 90 * x**2 + 220 * x + 29) + plt.plot(x, f_deriv, label="Derivative f'(x)") + + c = 0 + f_int = (((x - 2) * x * (x ** 4 - 4 * x ** 3 - 53 * x ** 2 + 114 * x + 315)) / 6) + c + plt.plot(x, f_int, label="Integral F(x)") + + plt.title("Exercise 1") + plt.xlabel("x") + plt.ylabel("y") + plt.legend() plt.show() if __name__ == "__main__": - funktion() + main()