From 468f47aa8abcdd93aab846e548b64537f1cbb23e Mon Sep 17 00:00:00 2001 From: schrom01 Date: Wed, 28 Sep 2022 11:34:58 +0200 Subject: [PATCH] Solved Task 2 --- Schenk_Roman_IT21bWIN_Test_Aufg2.py | 41 +++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 Schenk_Roman_IT21bWIN_Test_Aufg2.py diff --git a/Schenk_Roman_IT21bWIN_Test_Aufg2.py b/Schenk_Roman_IT21bWIN_Test_Aufg2.py new file mode 100644 index 0000000..88d588a --- /dev/null +++ b/Schenk_Roman_IT21bWIN_Test_Aufg2.py @@ -0,0 +1,41 @@ +import numpy as np +import matplotlib.pyplot as plt + +#Task Abbildung 1 +x1 = np.arange(-5, 5.05, 0.05) +y1 = np.array([]) +for x in x1: + y1 = np.append(y1, np.exp(x)) +plt.xlim((-5, 5 + 0.05)) +plt.title("Abbildung 1") +plt.plot(x1, y1) +plt.legend(["f(x) = e^x"]) +plt.figure() + +#Task Abbildung 2 +x2 = np.arange(-10, 10.1, 0.1) +y2 = np.array([]) +for x in x2: + y2 = np.append(y2, x**5 + 3*x**4 + 3*x**2 + x + 1) +plt.xlim((-10, 10 + 0.1)) +plt.title("Abbildung 2") +plt.plot(x2, y2) +plt.legend(["p(x) = x^5 + 3x^4 + 3x^2 + x + 1"]) +plt.figure() + +#Task 3 +x3 = np.arange(-2 * np.pi, 2 * np.pi + 0.01, 0.01) +y3_1 = np.array([]) +y3_2 = np.array([]) +for x in x3: + y3_1 = np.append(y3_1, 0.5 * np.sin(3 * x)) + y3_2 = np.append(y3_2, 0.5 * np.cos(3 * x)) +plt.xlim((-2 * np.pi, 2 * np.pi + 0.01)) +plt.title("Abbildung 3") +plt.plot(x3, y3_1) +plt.plot(x3, y3_2) +plt.legend(["g(x) = 0.5 * sin(3x)", "h(x) = 0.5 * cos(3x)"]) +plt.figure() + +#Show Graphics +plt.show() \ No newline at end of file