Accelerated power series solution of polytropic and isothermal gas spheres