  An efficient approach to handle localized states by using spectral methods
(SM) in one and three dimensions is presented. The method consists of
transformation of the infinite domain to the bounded domain in $(0, \pi)$ and
using the Fourier sine series as a set of basis functions for the SM. It is
shown that with an appropriate choice of transformation functions, this method
manages to preserve the good properties of original SMs; more precisely, superb
computational efficiency when high level of accuracy is necessary. This is made
possible by analytically exploiting the properties of the transformation
function and the Fourier sine series. An especially important property of this
approach is the possibility of calculating the Hartree energy very efficiently.
This is done by exploiting the positive properties of the sine series as a
basis set and conducting an extinctive part of the calculations analytically.
We illustrate the efficiency of this method and implement it to solve the
Poisson's and Helmholtz equations in both one and three dimensions. The
efficiency of the method is verified through a comparison to recently published
results for both one and three dimensional problems.
