Computational Physics, Physics, Heat Equation, Python, Math.
conductivity source : array of floats source term for the heat equation Returns ------- f : array of floats right-hand side of the heat equation with Dirichlet boundary conditions implemented """ nx = T.shape[0] f = np.empty(nx) f[1:-1] = alpha/dx**2 * (T[:-2] - 2*T[1:-1] + T[2:]) + source[1:-1]