Polynomial solution to the tensorial differential equations for monoenergetic neutrons in slab and sphere geometries