feat: serie_1.py abschluss
This commit is contained in:
parent
88f29d1f52
commit
debd3e4bcd
@ -105,4 +105,254 @@ plt.xlabel(r"$x$")
|
|||||||
plt.ylabel(r"$y$")
|
plt.ylabel(r"$y$")
|
||||||
plt.legend()
|
plt.legend()
|
||||||
plt.grid(visible=True)
|
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")
|
plt.axis("image")
|
||||||
Loading…
x
Reference in New Issue
Block a user