Compare commits

..

No commits in common. "main" and "serie_3" have entirely different histories.

2 changed files with 3 additions and 45 deletions

View File

@ -1,4 +1,3 @@
numpy==2.4.3
matplotlib==3.10.8
ipykernel==7.2.0
scipy==1.17.1
numpy
matplotlib
ipykernel

View File

@ -1,41 +0,0 @@
# %%
# Python initialisieren
import matplotlib.pyplot as plt
import numpy as np
import scipy.integrate as ig
# Parameter
x_0 = 0.0
x_E = np.pi
N = 11
n = 5
pr = 6
lw = 3
fig = 1
# Funktion
f = lambda x: np.sin(x)
# Berechnungen
for k in range(0, n):
x_data = np.linspace(x_0, x_E, N)
y_data = f(x_data)
I = ig.trapezoid(y=y_data, x=x_data)
J = ig.simpson(y=y_data, x=x_data)
print(f"I = {I:#.16g}")
print(f"J = {J:#.16g}")
N *= 2
# Ausgabe
print(f"I = {I:#.{pr}g}")
print(f"J = {J:#.{pr}g}")
# Plot
fh = plt.figure(fig)
plt.plot(x_data, y_data, linewidth=lw)
plt.xlabel("x")
plt.ylabel("y")
plt.grid(visible=True)
plt.axis("image")
plt.show()
# %%