Computational Physics, Physics, Heat Equation, Python, Math.
T[i+1] = euler_step(T[i], rhs_centered, dt, dx, alpha, source) # plot the solution at several times fig, ax = plt.subplots(figsize=(10, 5)) ax.plot(x, T[0], label='Initial condition') ax.plot(x, T[int(0.5/dt)], color='green', label='$t=0.5$') ax.plot(x, T[-1], color='brown', label=f'$t={tf}$')