Computational Physics, Physics, Heat Equation, Python, Math.
u = zeros(L) u[0] = 0 u[L-1] = 0 for t in range(100): for i in range(1, L-1): u[i] += (u[i+1] - 2*u[i] + u[i-1])/4 fig, ax = plt.subplots(figsize=(20,10)) ax.axis('off') ax.scatter(x,u, linewidth=15, c=u, cmap='jet') plt.show() To make the problem more interesting, we include a source term in the