aufgabenblatt_5_2.py created and README updated with needed libraries

This commit is contained in:
git-sandro 2025-10-28 20:45:09 +01:00
parent 4be811989a
commit 5947f09e84
2 changed files with 64 additions and 1 deletions

View File

@ -1 +1,7 @@
This reposetory is used for saving my calculations. Install Jupyter VS Code extension for interactive window
Python libraries needed. Use pip install ...
* numpy
* matplotlib
* sympy
* ipython

View File

@ -0,0 +1,57 @@
#%%
import numpy as np
import matplotlib.pyplot as plt
# Parameter
x = np.arange(0, 7, 0.1)
y = np.sin(x)
# Plot
plt.figure(1)
plt.plot(x, y, lw=3, label="sin(x)")
plt.xlabel("x")
plt.ylabel("y")
plt.legend("image")
plt.grid(visible=True)
plt.axis("image")
#%%
import numpy as np
import matplotlib.pyplot as plt
import matplotlib as mpl
# Konfigurieren
mpl.rcParams["font.size"] = 20
mpl.rcParams["font.family"] = "serif"
# 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
# Daten
x_data = np.linspace(x_0, x_E, N)
f_data = f(x_data)
g_data = g(x_data)
# Plot
plt.figure(fig)
plt.plot(x_data, f_data, linewidth = lw, label = r"$f = \frac{3} {1+x}$")
plt.plot(x_data, g_data, linewidth = lw, label = r"$g = \frac{x} {2}$")
plt.xlabel(r"$x$")
plt.ylabel(r"$y$")
plt.legend()
plt.grid(visible=True)
plt.axis("image")