An efficient pseudospectral method for numerical solution of nonlinear singular initial and boundary value problems arising in astrophysics