The problem of numerical determination of voltage potential inside one and two dimensional nonhomogeneous media using values of the voltage potential on the boundary of the media has been solved. The convenient form of variational formulation of the problem has been derived. The numerical solution of the problem has been obtained by the method of local variations.