From b1d6f6c5222f10fce188f36e5a7615ea3ffa109c Mon Sep 17 00:00:00 2001 From: git-sandro Date: Wed, 25 Feb 2026 23:33:07 +0100 Subject: [PATCH] feat: serie_1.py abschluss --- introduction/serie_1.py | 250 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 250 insertions(+) diff --git a/introduction/serie_1.py b/introduction/serie_1.py index 1f553b7..cca43ce 100644 --- a/introduction/serie_1.py +++ b/introduction/serie_1.py @@ -105,4 +105,254 @@ plt.xlabel(r"$x$") plt.ylabel(r"$y$") plt.legend() plt.grid(visible=True) +plt.axis("image") + +# %% +print("Aufgabe 8. d)") +# Python konfigurieren +plt.close("all") +plt.rcParams["figure.figsize"] = (7.03,15) +plt.rcParams["font.size"] = 9 +plt.rcParams["font.family"] = "serif" +plt.rcParams["text.usetex"] = False + +# Parameter +x_0 = 0 +x_E = 4 +N = 201 +lw = 3 +fig = 1 + +# Funktionen +def f(x): + y = 3/(1+x) + return y + +def g(x): + y = x/2 + return y + +def h(x): + y = x**2/8 + return y + +# Daten +x_data = np.linspace(x_0, x_E, N) +f_data = f(x_data) +g_data = g(x_data) +h_data = h(x_data) + +# pltot +fh = plt.figure(fig) +plt.plot(x_data, f_data, linewidth = lw, label = r"$f$") +plt.plot(x_data, g_data, "--", linewidth = lw, label = r"$g$") +plt.plot(x_data, h_data, "-.", linewidth = lw, label = r"$h$") +plt.xlabel(r"$x$") +plt.ylabel(r"$y$") +plt.legend() +plt.grid(visible=True) +plt.axis("image") + +# %% +print("Aufgabe 9. a)") +# Python konfigurieren +plt.close("all") +plt.rcParams["figure.figsize"] = (7.03,15) +plt.rcParams["font.size"] = 9 +plt.rcParams["font.family"] = "serif" +plt.rcParams["text.usetex"] = False + +# Parameter +x_0 = 0 +x_E = 2 +N = 201 +lw = 3 +fig = 1 + +# Funktionen +def f(x): + y = 0.4*x+1 + return y + +# Daten +x_data = np.linspace(x_0, x_E, N) +f_data = f(x_data) + +# pltot +fh = plt.figure(fig) +plt.plot(x_data, f_data, linewidth = lw) +plt.xlabel(r"$x$") +plt.ylabel(r"$y$") +plt.grid(visible=True) +plt.axis("image") + +# %% +print("Aufgabe 9. b)") +# Python konfigurieren +plt.close("all") +plt.rcParams["figure.figsize"] = (7.03,15) +plt.rcParams["font.size"] = 9 +plt.rcParams["font.family"] = "serif" +plt.rcParams["text.usetex"] = False + +# Parameter +x_0 = -2 +x_E = 2 +N = 201 +lw = 3 +fig = 1 + +# Funktionen +def f(x): + y = x**2 + return y + +# Daten +x_data = np.linspace(x_0, x_E, N) +f_data = f(x_data) + +# pltot +fh = plt.figure(fig) +plt.plot(x_data, f_data, linewidth = lw) +plt.xlabel(r"$x$") +plt.ylabel(r"$y$") +plt.grid(visible=True) +plt.axis("image") + +# %% +print("Aufgabe 9. c)") +# Python konfigurieren +plt.close("all") +plt.rcParams["figure.figsize"] = (7.03,15) +plt.rcParams["font.size"] = 9 +plt.rcParams["font.family"] = "serif" +plt.rcParams["text.usetex"] = False + +# Parameter +x_0 = -6 +x_E = 2 +N = 201 +lw = 3 +fig = 1 + +# Funktionen +def f(x): + y = 2**x + return y + +# Daten +x_data = np.linspace(x_0, x_E, N) +f_data = f(x_data) + +# pltot +fh = plt.figure(fig) +plt.plot(x_data, f_data, linewidth = lw) +plt.xlabel(r"$x$") +plt.ylabel(r"$y$") +plt.grid(visible=True) +plt.axis("image") + +# %% +print("Aufgabe 9. d)") +# Python konfigurieren +plt.close("all") +plt.rcParams["figure.figsize"] = (7.03,15) +plt.rcParams["font.size"] = 9 +plt.rcParams["font.family"] = "serif" +plt.rcParams["text.usetex"] = False + +# Parameter +x_0 = 0.01 +x_E = 10 +N = 201 +lw = 3 +fig = 1 + +# Funktionen +def f(x): + y = np.log10(x) + return y + +# Daten +x_data = np.linspace(x_0, x_E, N) +f_data = f(x_data) + +# pltot +fh = plt.figure(fig) +plt.plot(x_data, f_data, linewidth = lw) +plt.xlabel(r"$x$") +plt.ylabel(r"$y$") +plt.grid(visible=True) +plt.axis("image") + +# %% +print("Aufgabe 9. e)") +# Python konfigurieren +plt.close("all") +plt.rcParams["figure.figsize"] = (7.03,15) +plt.rcParams["font.size"] = 9 +plt.rcParams["font.family"] = "serif" +plt.rcParams["text.usetex"] = False + +# Parameter +x_0 = -1 +x_E = 4 +N = 201 +lw = 3 +fig = 1 + +# Funktionen +def f(x): + y = 3/(x+2) + return y + +# Daten +x_data = np.linspace(x_0, x_E, N) +f_data = f(x_data) + +# pltot +fh = plt.figure(fig) +plt.plot(x_data, f_data, linewidth = lw) +plt.xlabel(r"$x$") +plt.ylabel(r"$y$") +plt.grid(visible=True) +plt.axis("image") + +# %% +print("Aufgabe 9. f)") +# Python konfigurieren +plt.close("all") +plt.rcParams["figure.figsize"] = (7.03,15) +plt.rcParams["font.size"] = 9 +plt.rcParams["font.family"] = "serif" +plt.rcParams["text.usetex"] = False + +# Parameter +x_0 = 0 +x_E = 4*np.pi +N = 401 +N_t = 9 +lw = 3 +fig = 1 + +# Funktionen +def f(x): + y = 2*np.sin(x) + return y + +# Daten +x_data = np.linspace(x_0, x_E, N) +f_data = f(x_data) + +# pltot +fh = plt.figure(fig) +plt.plot(x_data, f_data, linewidth = lw) +plt.xlabel(r"$x$") +plt.ylabel(r"$y$") +plt.xticks(np.linspace(x_0, x_E, N_t),("$0$", "$0.5\,\pi$", + "$1.0\,\pi$", "$1.5\,\pi$", + "$2.0\,\pi$", "$2.5\,\pi$", + "$3.0\,\pi$", "$3.5\,\pi$", + "$4.0\,\pi$")) +plt.grid(visible=True) plt.axis("image") \ No newline at end of file