Numerical solutions of the Dirichlet problem via a density theorem