solutions

This commit is contained in:
Markus Schmidt 2025-10-21 19:35:55 +02:00
commit 79b9099274
3 changed files with 29 additions and 0 deletions

27
C/main.py Normal file
View file

@ -0,0 +1,27 @@
import numpy as np
import matplotlib.pyplot as plt
def u(x, p):
if p == 0:
return x
else:
return (np.exp(p*x)-1)/(np.exp(p)-1)
x = np.linspace(0, 1, 200)
p_values = [-10, -2, 0, 2, 10]
colors = ['purple', 'blue', 'black', 'orange', 'red']
plt.figure(figsize=(7,5))
for p, c in zip(p_values, colors):
plt.plot(x, u(x, p), label=f"p = {p}", color=c, linewidth=2)
plt.xlabel("x")
plt.ylabel("u(x)")
plt.legend()
plt.grid(True)
plt.show()