Compare commits

..

2 commits

Author SHA1 Message Date
dino.celebic
a1928ab84b ex2 2025-10-20 23:50:21 +02:00
dino.celebic
f6872d827d ex2 2025-10-20 23:48:46 +02:00

19
ex2/task_c.py Normal file
View file

@ -0,0 +1,19 @@
import numpy as np
import matplotlib.pyplot as plt
x = np.linspace(0,1,200)
p_list = [-100, -10, -1, 0, 1, 10, 100]
for p in p_list:
if p != 0:
u = (np.exp(p*x)-1)/(np.exp(p)-1)
else:
u = x
plt.plot(x,u, label=f"p={p}")
plt.xlabel("x")
plt.ylabel("u(x)")
plt.title("Solution of -u''+pu'=0 with u(0)=0 u(1)=1")
plt.legend()
plt.show()