The first task is then to set up the matrix A for a given k0. This is an (N+1)×(N+1) matrix. It can be convenient to have an outer loop which runs over the chosen observable values for the energy k20/m. {\em Note that all mesh points kj for j=1,N must be different from k0. Note also that V(ki,kj) is an (N+1)×(N+1) matrix}.
With the matrix A we can rewrite the problem as a matrix problem of dimension (N+1)×(N+1). All matrices R, A and V have this dimension and we get Ai,lRl,j=Vi,j, or just AR=V.