Density functional theory for inhomogeneous polymer systems. I. Numerical methods