Professional Documents
Culture Documents
import math
a=0
b=1
n = 10
h = (b - a) / (n + 1)
x = np.linspace(a, b, n + 2)
u = np.zeros(n + 2)
def exact_solution(x):
print("Exact:",exact_solution(x))
print("FDM:",u)
print("Delta:",delta)
print("Delta_avg:",avg_error)
plt.figure(figsize=(10, 6))
plt.xlabel("x")
plt.ylabel("u")
plt.legend()
plt.grid(True)
plt.show()