Computational Physics, Physics, Heat Equation, Python, Math.
cmap='jet') def ans(f): global u, plot #Time is not defined as the animation will do the loop for T times. for j in range(100): for i in range(1,99): u[i,j] += (u[i+1,j] + u[i,j+1] + u[i-1,j] + u[i,j-1] - 4*u[i,j])/4 for c in plot.collections: c.remove() plot = ax.contourf(u, cmap='jet') return