Zhang Heng (; AD 78–139), formerly romanized as Chang Heng, was a Chinese polymathic scientist and statesman who lived during the Han dynasty. Educated in the capital cities of Luoyang and Chang'an, he achieved success as an astronomer, mathematician, seismologist, hydraulic engineer, inventor, geographer, cartographer, ethnographer, artist, poet, philosopher, politician, and literary scholar. Zhang Heng began his career as a minor civil servant in Nanyang. Eventually, he became Chief Astronomer, Prefect of the Majors for Official Carriages, and then Palace Attendant at the imperial court. His uncompromising stance on historical and calendrical issues led to his becoming a controversial figure, preventing him from rising to the status of Grand Historian. His political rivalry with the palace eunuchs during the reign of Emperor Shun (r. 125–144) led to his decision to retire from the central court to serve as an administrator of Hejian Kingdom in present-day Hebei. Zhang returned home to Nanyang for a short time, before being recalled to serve in the capital once more in 138. He died there a year later, in 139. Zhang applied his extensive knowledge of mechanics and gears in several of his inventions. He invented the world's first water-powered armillary sphere to assist astronomical observation; improved the inflow water clock by adding another tank; and invented the world's first seismoscope, which discerned the cardinal direction of an earthquake away. He improved previous Chinese calculations for pi. In addition to documenting about 2,500 stars in his extensive star catalog, Zhang also posited theories about the Moon and its relationship to the Sun: specifically, he discussed the Moon's sphericity, its illumination by reflected sunlight on one side and the hidden nature of the other, and the nature of solar and lunar eclipses. His fu (rhapsody) and shi poetry were renowned in his time and studied and analyzed by later Chinese writers. Zhang received many posthumous honors for his scholarship and ingenuity; some modern scholars have compared his work in astronomy to that of the Greco-Roman Ptolemy (AD 86–161). Life Early life Born in the town of Xi'e in Nanyang Commandery (north of the modern Nanyang City in Henan province), Zhang Heng came from a distinguished but not affluent family. His grandfather Zhang Kan () had been governor of a commandery and one of the leaders who supported the restoration of the Han by Emperor Guangwu (r. 25–57), following the death of the usurping Wang Mang of