Variational formulation and finite element solution of the nonlinear one dimensional Poisson's equation in semiconductors