Laplace's and Poisson's Equations, boundary conditions
The boundary condtions read
ui,0=gi,00≤i≤n+1,
ui,L=gi,00≤i≤n+1,
u0,j=g0,j0≤j≤n+1,
and
uL,j=gL,j0≤j≤n+1.
With n+1 mesh points the equations for u result in a system of (n+1)2 linear equations in the (n+1)2 unknown ui,j.