Computational Physics, Physics, Heat Equation, Python, Math.
f[0] = 0. f[-1] = 0. return f We also define a function that returns the exact solution at any time : def exact_solution(x,t, alpha): """Returns the exact solution of the 1D heat equation with heat source term sin(np.pi*x) and initial condition sin(2*np.pi*x) Parameters ---------- x : array of