Series solutions for polytropes and the isothermal sphere