Computational Physics, Python, Math, Physics.
u_jp1[1:N_x] = -u_jm1[1:N_x] + 2*u_j[1:N_x] + C2*( 0.5*(q[1:N_x] + q[2:N_x+1])*(u_j[2:N_x+1] - u_j[1:N_x]) - 0.5*(q[0:N_x-1] + q[1:N_x])*(u_j[1:N_x] - u_j[0:N_x-1])) #left bound conditions if left_bound_cond == 1: #Dirichlet bound cond u_jp1[0] = 0 elif left_bound_cond == 2: #Nuemann bound cond #i