| Line 6: |
Line 6: |
| | ==Early Life== | | ==Early Life== |
| | Although she was the only legitimate child of of the famous British poet [[George Gordon, Lord Byron|Lord Byron]], she had virtually no relationship with him, given his death when she was only nine years old. | | Although she was the only legitimate child of of the famous British poet [[George Gordon, Lord Byron|Lord Byron]], she had virtually no relationship with him, given his death when she was only nine years old. |
| | + | |
| | + | ==What did Ada's Bernoulli program look like?== |
| | + | The program, and detailed technical commentary, appeared in a paper "Sketch of the Analytical Engine Invented by Charles Babbage" that Ada wrote in 1843. The program itself has been reproduced in the "sidebar" on page 79 of the referenced Scientific American article. First there is a list of the six input and output variables that are used: V1, V2, V3, V21, V22 and V23. And the temporary variables V4 through V13. In modern terminology in a strongly typed language such as C++, we would write something like: |
| | + | |
| | + | int V1, V2, V3; // inputs |
| | + | int V21, V22, V23; // outputs |
| | + | int V4, V5, V6, V7, V8, V9, V10, V11, V12, V13; // temps |
| | + | |
| | + | Then she lists the 23 instructions. Instruction 5, for example, appears to say (though it's hard to read): |
| | + | |
| | + | V11 = V12 / V2; // V11 = (1/2) * (2N-1)/(2N+1) |
| | + | |
| | + | (She used the old-fashioned divide sign "<math>\div</math>"; she didn't know any better. Neither the 026 keypunch nor the ASCII character set had been invented.) |
| | + | |
| | + | She used two loops—see the other sidebar on page 78. V10 is the outer loop counter. The loop consists of instructions 13 to 23. It continues until V10 counts down to 1. |
| | + | |
| | + | ==Was it a computer?== |
| | + | The "analytical engine" was so far ahead of its time that one might be tempted to call it just a "visionary idea". The technology of the time was nowhere near capable of building it. Even the much-less-ambitious "difference engine" was beyond the technology of the day—making the counters do arithmetic reliably required very careful machining of the parts. Only a small partial prototype of the difference engine was built in Babbage's lifetime. But Babbage clearly knew what he wanted<ref>That Babbage knew what he was doing is attested to by the fact that his full difference engine was finally constructed in 1991 (the bicentennial of Babbage's birth) and is on display at the London Science Museum. Babbage's original plans were almost exactly correct.</ref>. His vision of a calculating device that can perform operations under control of a "program" punched into cards, and that makes control decisions based on the data resulting from the calculation steps, was incredibly prescient. It was exactly the principle used in modern computers. Lovelace understood that vision, and even extended it to the idea that computers might perform tasks beyond purely numerical ones, such as composing music. The fact that the analytical engine was mechanical rather than electronic did not make it any less a computer. It just made it harder to build. It took about 100 years for the field of electrical engineering to make computers such as that envisioned by Babbage realizable. |
| | + | |
| | + | ==Was it a RISC machine or a CISC machine?== |
| | + | From looking at Ada's program for Bernoulli polynomials, it is clear that the machine did its calculation by manipulating numbers in specific registers. It did not have any "random access memory" that could be addressed. CISC machines address memory in their operation instructions, while RISC machines operate on registers, loading and storing memory locations only with specific instructions. So the analytical engine would have to be classified as a RISC machine in that sense. |
| | + | |
| | + | ==Was Ada's program a real program, or just a "description of an algorithm"?== |
| | + | It is impossible to answer this to everyone's satisfaction. She certainly didn't punch it on cards or type it into a computer terminal. (She might conceivably have punched it onto cards if Babbage had made his design sufficiently concrete as to assign binary opcodes, but he never got anywhere near that far.) Since it never ran on a computer in the form in which she wrote it, it could be argued that it wasn't a program, but was merely an algorithm. But, whatever it was, it was written in the peculiarly stilted language of computer machine code. That is, the numbers that it was manipulating were assigned to specific registers. As the iteration loop cycled around, those registers were overwritten with new values. That is not the way ordinary mathematical algorithms are expressed. They are expressed in terms of more abstract formulas and recurrences. In Ada's case, the formulas were broken down into individual operations, manipulating specific registers that she specified. The recurrence was specified by manipulating a count register and testing whether it had reached zero. |
| | + | |
| | + | Algorithms like Euclid's algorithm or Heron's formula, or even integration techniques or the description of the factorial function, are not described that way unless one is writing a computer program. |
| | + | |
| | + | "Algorithms" for calculating Bernoulli numbers had been known for some time. But she wrote this "algorithm" in the form of ''specifically realizable numerical operations'' that she (naively, Babbage's design was ''far'' beyond what the technology of the day would have provided) believed the analytical engine could have done. And she used the ''specific ability of a calculating device to make control decisions based on the data''. |
| | + | |
| | + | ==Was Ada really first? Was the Bernoulli program the first program?== |
| | + | There are those who claim <ref>[http://projects.exeter.ac.uk/babbage/ada.html]</ref> that Babbage himself, or an assistant of his, or perhaps some of his sons, must have written "programs" before Ada did. Issues like this arise from time to time, perhaps most notably in the "calculus war" between Newton and Leibniz, or the "non-Euclidean geometry war" among Gauss, Bolyai, and Lobachevsky. The scientific community generally gives great weight to the act of publishing one's work. If these other people wrote programs before Ada did, they don't seem to have published them, and they are lost. It is not known what problems these earlier programs might have been solving. |
| | | | |
| | ==References== | | ==References== |