When the Alter Rebbe was nine he studied geometry and astronomy. At ten he composed a calendar for fifteen years. When he was twelve years old, it happened that he lectured publicly on Rambam’s laws of kidush hachodesh. The preeminent Torah-scholars who were present at that time in the study-hall were utterly overwhelmed.
Much of this treatise is devoted to complex astronomical calculations relative to projected appearance of the new moon, etc.