Here are the equations: $$\sum_{k = 1}^n i_k + Y_n u_n = J \quad \quad (1)$$ $$i_1 + Y(u_1 - u_2) = J \quad \quad (2)$$ $$i_k - Y(u_{k - 1} -2u_{k} + u_{k + 1}) = 0, \quad \quad k = 2, ..., n - 2 \quad \quad (3)$$ $$u_{n - 1} = u_n \quad \quad (4)$$ $$u_k - \sum_{k = 1}^n r_{kj}i_j = 0, \quad \quad k = 1, ..., n \quad \quad (5)$$
Unknown variables are $u_k$ and $i_k$, $k = 1, ..., n$. All other variables are known.
[EDIT]
I have tried to solve this system by using iterative technique. First I made initial assumption for $i_k$ and then calculated $u_k$ by using equations (1) - (4). Then I used equation (5) in the matrix form $[u] - [R][i] = [0] \quad \Rightarrow [i] = [R]^{-1}[u]$, for finding currents in the next iteration. But this approach does not give correct results. Above system of equations is written from electrical circuit from picture: http://postimg.org/image/r84zrj3gh/