TheAlmagestistheearliestofPtolemy'sworksandgivesindetailthemathematicaltheoryofthemotionsoftheSun,Moon,andplanets.

Please segment the words:
The Almagest is the earliest of Ptolemy's works and gives in detail the mathematical theory of the motions of the Sun, Moon, and planets.