Add ghost points:
u = zeros(Nx+3) u_1 = zeros(Nx+3) u_2 = zeros(Nx+3) x = linspace(0, L, Nx+1) # Mesh points without ghost points
u[-1]
u
0,..,Nx+2