solutions
This commit is contained in:
commit
79b9099274
3 changed files with 29 additions and 0 deletions
1
C/.venv/bin/python
Symbolic link
1
C/.venv/bin/python
Symbolic link
|
|
@ -0,0 +1 @@
|
||||||
|
python3
|
||||||
1
C/.venv/bin/python3.12
Symbolic link
1
C/.venv/bin/python3.12
Symbolic link
|
|
@ -0,0 +1 @@
|
||||||
|
python3
|
||||||
27
C/main.py
Normal file
27
C/main.py
Normal 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()
|
||||||
Loading…
Add table
Add a link
Reference in a new issue