From 79b909927497ab664cc0b98deeb345afb1c9415e Mon Sep 17 00:00:00 2001 From: Markus Schmidt Date: Tue, 21 Oct 2025 19:35:55 +0200 Subject: [PATCH] solutions --- C/.venv/bin/python | 1 + C/.venv/bin/python3.12 | 1 + C/main.py | 27 +++++++++++++++++++++++++++ 3 files changed, 29 insertions(+) create mode 120000 C/.venv/bin/python create mode 120000 C/.venv/bin/python3.12 create mode 100644 C/main.py diff --git a/C/.venv/bin/python b/C/.venv/bin/python new file mode 120000 index 0000000..b8a0adb --- /dev/null +++ b/C/.venv/bin/python @@ -0,0 +1 @@ +python3 \ No newline at end of file diff --git a/C/.venv/bin/python3.12 b/C/.venv/bin/python3.12 new file mode 120000 index 0000000..b8a0adb --- /dev/null +++ b/C/.venv/bin/python3.12 @@ -0,0 +1 @@ +python3 \ No newline at end of file diff --git a/C/main.py b/C/main.py new file mode 100644 index 0000000..2d6fa64 --- /dev/null +++ b/C/main.py @@ -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()