• No results found

Our contemporary ideas about programs and programming can clarify and organise our at- tempts to appreciate and reconstruct the ideas of Charles Babbage on programming. Equally, they may obscure or mislead us in reinterpreting and extending his achievements (compare

2.2. THE ANALYTICAL ENGINE AND ITS PROGRAMMING 31

Temptations 1 and 2 above!). There is a small number of draft programs and notes, in con- trast with the large amount of information on the machine. There are no complete programs and there is no detailed specification of all the instructions. There are the descriptions of the machine, and the paper by L Menabrea and the important set of notes by Ada Lovelace of 1845.

The evolution of the Analytical Engine began in 1833 when work on the Difference Engine stopped. The first notes of 1834 are workable designs. In late 1837 there is a major revision which was the basis for the development until 1849, when Babbage ceased work until starting up again in 1856.

A clear and concise specification of an early form of the Analytical Engine is found in the letter Babbage wrote to the Belgian statistician Adolphe Quetelet, dated 27 April 1835:

It is intended to be capable of having 100 variables (or numbers susceptible of change) placed upon it; each number to consist of 25 figures.

The engine will then perform any of the following operations or any combination of them: v1,v2, . . . ,v100 being any number, it will

add vi tovk;

subtract vi from vk;

multiply vi byvk;

divide vi byvk;

extract the square root of vk;

reduce vk to zero.

Hence if f(v1,v2, . . . ,vn), n < 100, be any given function which can be formed

by addition, multiplication, subtraction, division, or extraction of square root the engine will calculate the numerical value of f. It will then substitute this value instead of v1 or any other variable and calculate the second function with respect

to v1.

It appears that it can tabulate almost any equation of finite differences.

Also suppose you had by observation a thousand values of a, b, c, d, and wish to calculate by the formula

p =p(a +b)/cd.

The engine would be set to calculate the formula. It would then have the first set of the values of a, b, c, d put in. It would calculate and print them, then reduce them to zero and ring a bell to inform you that the next set of constants must be put into the engine.

Whenever a relation exists between any number of coefficients of a series (provided it can be expressed by addition, subtraction, multiplication, division, powers, or extraction root) the engine will successively calculate and print those terms and it may then be set to find the value of the series for any values of the variable.

Extract of a letter from C Babbage to A Quetelet, 27 April 1835.

Works of Babbage. Volume III. Analytical Engine and Mechanical Notation.

The idea of the machine contained in this letter can be explored by making a simple math- ematical model based on a few features. In particular, one might first guess that:

(i) the machine simply computes arithmetic expressions based on the five operators and 100 variables mentioned;

(ii) the expression is changed;

(iii) each expression is repeatedly evaluated on a finite sequence or stream of values for the variables; and

(iv) loops do not occur.

What does the remark about tabulating all finite difference equations imply? The specifi- cation is too loose and vague for us to answer semantic questions with confidence.

We will develop a formal model based on these four assumptions in due course.

This description of 1835 predates the idea of using Jacquard cards (which has been dated to the night of 30 June 1836). The idea of the Jacquards, or punched cards, is fundamental. It enriches the conception of the machine and its use, making explicit the breaking down and sequencing of its actions. It is an essential feature of mechanisation to break down processes to actions and operations. A number of types of cards were envisaged, notably variable and operation cards. In a description of the engine in 1837, the operation cards were to be used for addition, subtraction, multiplication and division.

In the paper by L Menabrea, there is an emphasis on (what we may call) the algorithmic aspects of the Analytical Engine, and this is further developed in the Lovelace notes. A few “programs” are discussed and, to add to our stock of raw materials for our theories, we will look at the “program” for solving a pair of simultaneous equations.

Consider the pair

mx +ny =d m0x+n0y=d0

of equations, where x and y are the unknowns. By eliminating the variabley in the usual way, we find

x= dn 0d0n n0mnm0 and, similarly eliminating x, we find

y= d

0mdm0 mn0m0n.

The problem is to program the machine to calculate x and y according to these formulae. The letters

V0,V1,V2,V3,V4 and V5

denote the columns reserved for the coefficients and have values m,n,d,m0,n0 and d0

respectively. A series of Jacquard cards provides the series of arithmetic operations that evaluate the expressions on the machine. They involve a number of working variables V6, . . . ,V14, and

two output variablesV15 and V16. The series of operations and their effects on all the columns

2.2. THE ANALYTICAL ENGINE AND ITS PROGRAMMING 33

We leave the reader to ponder on the calculation and the underlying program from this trace. Notice that when the value of a variable column is no longer required, then it is re-initialised to the value 0.

From time to time we will look at the treatment of data, program control, and the method- ology of programming the Analytical Engine. Our aim in looking at old ideas is not to write their history. We will pick on historical concepts and methods to suggest examples to illuminate and enrich contemporary ideas.