function u = update(M,h,u,R)

u(2:M) = u(2:M) + h*R(2:M);