Skip to main content
No. 1038:
Hero of Alexandria

Today, a 2000-year-old engineer speaks to us about freedom and creativity. The University of Houston's College of Engineering presents this series about the machines that make our civilization run, and the people whose ingenuity created them.

A colleague stopped by my office the other day. "What do you know about Hero of Alexandria?" he asked. Well, his name says he was from Alexandria. We know he was alive in AD 62 because he wrote about a solar eclipse that year. All we do know comes from his books on engineering and science. He's best known for what we call Hero's turbine -- a steam-driven whirligig that worked a little like a modern jet engine. He did mechanics, astronomy, and math.

"I'm doing a long calculation," my friend said. "I have to take lots of square roots. By programming Hero's method I can make my calculation run very fast." With that, he had my attention.

You see, Hero invented feedback control devices. His self-filling wine bowl, for example, had a hidden float valve that automatically sensed the level of wine in a bowl. When guests ladled out wine, the bowl mysteriously refilled itself.

That's called a closed feedback loop. Egyptian inventors had been making gadgets like that for 300 years before Hero. They'd made feedback-controlled water-clocks and lamp-fillers.

By the time Hero lived, Rome had annexed Egypt, and intellectual freedom gave way to imperial authority. Hero was the end of an inventive age. Not 'til the 1600s was another feedback device invented. Feedback meant letting go of control -- letting a machine make its own decisions. Authoritarian minds don't like that.

But Hero's square root method also works that way. Suppose Hero wanted the square root of 5. He'd guess an answer and then do the following process a few times: Divide 5 by the guess, add the guess, then divide that sum by 2. That gave an improved guess.

Suppose I guess that the square root of 5 is 1. Hero's process gives 3. Then I guess 3 and get 2.33. I guess 2.33 and get 2.24 -- already accurate within 0.1 percent. The result converges very quickly. Four tries usually get you all the accuracy you need.

Hero had set up a do-loop for what we call an iterative solution. The same person who worked with feedback control loops now gives us a wonderful computer do-loop. In either case we start a process and then let it pass out of our hands.

Hero's story has a moral: we have no freedom without letting go of control. Hero, this Egyptian engineer whose only autobiography is his creative product, was the last breath of a Golden Age in North Africa. It'd be 1600 years before math, mechanics, and human affairs would catch up with that fragile inventive freedom we sell so easily for security -- that we sell to satisfy our need to stay in control.

I'm John Lienhard at the University of Houston, where we're interested in the way inventive minds work.

(Theme music)

For the best brief overview of Hero (or Heron) of Alexandria, I recommend the Encyclopaedia Britannica. I am also grateful to N. Shamsundar, UH Mechanical Engineering Department, for bringing Hero's square root algorithm to my attention. He makes the interesting point that all existing computer algorithms for square roots derive from Hero's method. He just found he could speed his particular calculation by programming it himself and truncating the computation sooner.

For more on Hero's mechanics, see:

Mayr, O., The Origins of Feedback Control. Cambridge, MA: MIT Press, 1970, Chapter II.

Drachmann, A.G., The Mechanical Technology of Greek and Roman Antiquity. Copenhagen: Munksgaard, 1963.

Hero's square root algorithm goes as follows: Suppose you want the square root of N. You guess an initial value, Xo, and calculate a better value, X1, with the averaging formula,

          X1 = (Xo + N/Xo)/2

Then you use X1 as your next guess and calculate a better guess, X2:

          X2 = (X1 + N/X1)/2

Thus to get the square root of 5, I guess 1, so (1 + 5/1)/2 = 3.

Next I guess 3, so (3 + 5/3)/2 = 2.333...

On the third trial, I guess 2.333... This time (2.333... + 5/2.333...)/2 = 2.2381...

The value of the square root of 5, accurate to five significant figures, is 2.2361, so I'm now within 0.0020 of the correct value, or less than 1/10th of one percent in error. One more trial, and the result is accurate to within six significant figures.