Supplement 2
MATHEMATICS
In the course of our discussion of machines that think, we have had to refer without much explanation to a number of mathematical ideas. The purpose of this supplement is to explain a few of these ideas a little more carefully than seemed easy to do in the text and, at the end of the supplement, to put down briefly some additional notes for reference.
DEVICES FOR MULTIPLICATION
Suppose that we have to multiply 372 by 465. With the ordinary school method, we write 465 under the 372 and proceed about as follows: 5 times 2 is 10, put down the 0 and carry the 1; 5 times 7 is 35, 35 and 1 is 36, put down the 6 and carry the 3; 5 times 3 is 15, 15 and 3 is 18, put down the 8 and carry the 1; ... The method is based mainly on a well-learned subroutine of continually changing steps:
- 1. Select a multiplicand digit.
- 2. Select a multiplier digit.
- 3. Refer to the multiplication table with these digits.
- 4. Obtain the value of their product, called a partial product.
- 5. Add the preceding carry.
- 6. Set down the right-hand digit.
- 7. Carry the left-hand digit.
We can, however, simplify this subroutine for a machine by delaying the carrying. We collect in one place all the right-hand digits of partial products, collect in another place all the left-hand digits, and delay all addition until the end.
For example, let us multiply 372 by 465 with this method:
| Right-Hand Digits |
Left-Hand Digits |
Usual Method for Comparison |
|---|---|---|
| 372 | 372 | 372 |
| × 465 | × 465 | × 465 |
| 550 | 131 | 1860 |
| 822 | 141 | 2232 |
| 288 | 120 | 1488 |
| 37570 | 13541 | 172980 |
Final Addition |
||
| 37570 | ||
| + 13541 | ||
| 172980 | ||
37570 is called the right-hand component of the product. It is convenient to fill in with 0 the space at the end of 13541 and to call 135410 the left-hand component of the product.
This process is called multiplying by right- and left-hand components. It has the great advantage that no carrying is necessary to complete any line of the original multiplications. Some computing machines use this process. Built into the hardware of the machine is a multiplication table up to 9 × 9. The machine, therefore, can find automatically the right-hand digit and the left-hand digit of any partial product. In a computing machine that uses this process, all the left-hand digits are automatically added in one register, and all the right-hand digits are added in another register. The only carrying that is needed is the carrying as the right-hand digits are accumulated and as the left-hand digits are accumulated. At the end of the multiplication, one of the registers is automatically added into the other, giving the product.
Another device used in computing machines for multiplying is to change the multiplier into a set of digits 0 to 5 that are either positive or negative. For example, suppose that we want to multiply 897 by 182. We note that 182 equals 200 minus 20 plus 2, and so we can write it as
- 222.
The minus over the 2 marks it as a negative digit 2. Then to multiply we have:
- 897
- 222
- 1794
- -1794
- 1794
- 163254
The middle 1794 is subtracted. This process is usually called short-cut multiplication. Everybody discovers this trick when he decides that multiplying by 99 is too much work, that it is easier to multiply by 100 and subtract once.
BINARY OR TWO NUMBERS
We are well accustomed to decimal notation in which we use 10 decimal digits 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 and write them in combinations to designate decimal numbers. In binary notation we use two binary digits 0, 1 and write them in combinations to designate binary numbers. For example, the first 17 numbers, from 0 to 16 in the decimal notation, correspond with the following numbers in binary notation:
| Decimal | Binary | Decimal | Binary |
|---|---|---|---|
| 0 | 0 | ||
| 1 | 1 | 9 | 1001 |
| 2 | 10 | 10 | 1010 |
| 3 | 11 | 11 | 1011 |
| 4 | 100 | 12 | 1100 |
| 5 | 101 | 13 | 1101 |
| 6 | 110 | 14 | 1110 |
| 7 | 111 | 15 | 1111 |
| 8 | 1000 | 16 | 10000 |
In decimal notation, 101 means one times a hundred, no tens, and one. In binary notation, 101 means one times four, no twos, and one. The successive digits in a decimal number from right to left count 1, 10, 100, 1000, 10000, ...—successive powers of 10 (for this term, see the end of this supplement). The successive digits in a binary number from right to left count 1, 2, 4, 8, 16, ...—powers of 2.
The decimal notation is convenient when equipment for computing has ten positions, like the fingers of a man, or the positions of a counter wheel. The binary notation is convenient when equipment for computing has just two positions, like “yes” or “no,” or current flowing or no current flowing.
Addition, subtraction, multiplication, and division can all be carried out unusually simply in binary notation. The addition table is simple and consists only of four entries.
| + | 0 | 1 |
| 0 | 0 | 1 |
| 1 | 1 | 10 |
The multiplication table is also simple and contains only four entries.
| × | 0 | 1 |
| 0 | 0 | 0 |
| 1 | 0 | 1 |
Suppose that we add in binary notation 101 and 1001:
| Binary Addition |
Check |
|---|---|
| 101 | 5 |
| + 1001 | 9 |
| 1110 | 14 |
We proceed: 1 and 1 is 10; write down 0 and carry 1; 0 and 0 is 0, and 1 to carry is 1; and 1 and 0 is 1; and then we just copy the last 1. To check this we can convert to decimal and see that 101 is 5, 1001 is 9, and 1110 is 14, and we can verify that 5 and 9 is 14.
One of the easiest ways to subtract in binary notation is to add a ones complement (that is, the analogue of the nines complement) and use end-around-carry (for these two terms, see the end of this supplement). A ones complement can be written down at sight by just putting 1 for 0 and 0 for 1. For example, suppose that we subtract 101 from 1110:
| Direct Subtraction |
Check | Subtraction by Adding Ones Complement |
|---|---|---|
| 1110 | 14 | 1110 |
| - 101 | - 5 | + 1010 |
| 1001 | 9 | (1)1000 |
| ↓ | ||
| ⎯→ 1 | ||
| 1001 |
Multiplication in the binary notation is simple. It amounts to (1) adding if the multiplier digit is 1 and not adding if the multiplier digit is 0, and (2) moving over or shifting. For example, let us multiply 111 by 101:
| Binary Multiplication |
Check |
|---|---|
| 111 | 7 |
| × 101 | × 5 |
| 111 | |
| 111 | |
| 100011 | 35 |
The digit 1 in the 6th (or nth) binary place from the right in 100011 stands for 1 times 2 to the 5th (or n-1 th) power, 2 × 2 × 2 × 2 × 2 = 32. The result 100011 is translated into 32 plus 2 plus 1, which equals 35 and verifies.
Division in the binary notation is also simple. It amounts to (1) subtracting (yielding a quotient digit 1) or not subtracting (yielding a quotient digit 0), and (2) shifting. We never need to try multiples of the divisor to find the largest that can be subtracted yet leave a positive remainder. For example, let us divide 1010 (10 in decimal) into 10001110 (142 in decimal):
- 1110 (14 in decimal)
- ————
- 1010)10001110
- 1010
- 1111
- 1010
- 1011
- 1010
- 10 (remainder, 2 in decimal)
In decimal notation, digits to the right of the decimal point count powers of ⅒. In binary notation, digits to the right of the binary point count powers of ½: ½, ¼, ⅛, ¹/₁₆.... For example, 0.1011 equals ½ + ⅛ + ¹/₁₆, or ¹¹/₁₆.
If we were accustomed to using binary numbers, all our arithmetic would be very simple. Furthermore, binary numbers are in many ways much better for calculating machinery than any other numbers. The main problem is converting numbers from decimal notation to binary. One method depends on storing the powers of 2 in decimal notation. The rule is: subtract successively smaller powers of 2; start with the largest that can be subtracted, and count 1 for each power that goes and 0 for each power that does not. For example, 86 in decimal becomes 1010110 in binary:
| 86 | ||
| 64 | 64 goes | 1 |
| 22 | 32 does not go | 0 |
| 16 | 16 goes | 1 |
| 6 | 8 does not go | 0 |
| 4 | 4 goes | 1 |
| 2 | 2 goes | 1 |
| 2 | 1 does not go | 0 |
| 0 |
It is a little troublesome to remember long series of 1’s and 0’s; in fact, to write any number in binary notation takes about 3⅓ times as much space as decimal notation. For this reason we can separate binary numbers into triples beginning at the right and label each triple as follows:
| Triple | Label |
|---|---|
| 000 | 0 |
| 001 | 1 |
| 010 | 2 |
| 011 | 3 |
| 100 | 4 |
| 101 | 5 |
| 110 | 6 |
| 111 | 7 |
For example, 1010110 would become 1 010 110 or 126. This notation is often called octal notation, because it is notation in the scale of eight.
BIQUINARY OR TWO-FIVE NUMBERS
Another kind of notation for numbers is biquinary notation, so called because it uses both 2’s and 5’s. Essentially this notation is very like Roman numerals, ancient style. By ancient style we mean, for example, VIIII instead of IX. In the following table we show the first two dozen numbers in decimal, biquinary, and ancient Roman notation:
| Decimal | Biquinary | Roman |
|---|---|---|
| 0 | 0 | |
| 1 | 1 | I |
| 2 | 2 | II |
| 3 | 3 | III |
| 4 | 4 | IIII |
| 5 | 10 | V |
| 6 | 11 | VI |
| 7 | 12 | VII |
| 8 | 13 | VIII |
| 9 | 14 | VIIII |
| 10 | 100 | X |
| 11 | 101 | XI |
| 12 | 102 | XII |
| 13 | 103 | XIII |
| 14 | 104 | XIIII |
| 15 | 110 | XV |
| 16 | 111 | XVI |
| 17 | 112 | XVII |
| 18 | 113 | XVIII |
| 19 | 114 | XVIIII |
| 20 | 200 | XX |
| 21 | 201 | XXI |
| 22 | 202 | XXII |
| 23 | 203 | XXIII |
The biquinary columns alternate in going from 0 to 4 and from 0 to 1. The digits from 0 to 4 are not changed. The digits from 5 to 9 are changed into 10 to 14. We see that the biquinary digits are 0 to 4 in odd columns and 0, 1 in even columns, counting from the right.
This is the notation actually expressed by the abacus. The beads of the abacus show by their positions groups of 2 and 5 (see Fig. 1).
Fig. 1. Abacus and notations.
SOME OPERATIONS OF ALGEBRA
One of the operations of algebra that is important for a mechanical brain is approximation, the problem of getting close to the right value of a number. Take, for example, finding square root (see the end of this supplement). The ordinary process taught in school is rather troublesome. We can set down another process, however, using a desk calculator to do division, which gives us square root with great speed.
Suppose that we want to find the square root of a number N, and suppose that we have x₀ as a guessed square root correct to one figure. For example, N might be 67.2 and x₀ might be 8, chosen because 8 × 8 is 64, and 9 × 9 is 81, and it seems as if 8 should be near the square root of 67.2. Here is the process:
- 1. Divide x₀ into N, and obtain N / x₀.
- 2. Multiply x₀ + N / x₀ by 0.5 and call the result x₁.
Now repeat:
- 1. Divide x₁ into N and obtain N / x₁.
- 2. Multiply x₁ + N / x₁ by 0.5 and call the result x₂.
Every time this process is repeated, the new x comes a great deal closer to the correct square root. In fact it can be shown that, if x₀ is correct to one figure, then:
| Approximation | Is Correct To ··· Figures |
|---|---|
| x₁ | 2 |
| x₂ | 4 |
| x₃ | 8 |
| x₄ | 16 |
Let us see how this actually works out with 67.2 and a 10-column desk calculator.
Round 1: 8 divided into 67.2 gives 8.4. One half of 8 plus 8.4 is 8.2. This is x₁.
Round 2: 8.2 divided into 67.2 gives 8.195122. One half of 8.2 plus 8.195122 is 8.197561. This is x₂.
Round 3: 8.197561 divided into 67.2 gives 8.197560225. One half of 8.197561 and 8.197560225 is 8.1975606125. This is x₃.
Checking x₃, we find that 8.1975606125 divided into 67.2 gives 8.1975606126 approximately.
In this case, then, x₃ is correct to more than 10 figures. In other words, with a reasonable guess and two or three divisions we can obtain all the accuracy we can ordinarily use. This process is called rapid approximation, or rapidly convergent approximation, since it converges (points or comes together) very quickly to the number we are seeking.
Another important operation of algebra is interpolation, the problem of putting values smoothly in between other values. For example, suppose that we have the table:
| x | y |
|---|---|
| 5 | 26 |
| 6 | 37 |
| 7 | 50 |
| 8 | 65 |
| 9 | 82 |
Suppose that we want to find the value that y (or yₓ) ought to have when x has the value of 7.2. This is the problem of interpolating y so as to find y at the value of 7.2, y₇ˌ₂.
One way of doing this is to discover the formula that expresses y and then to put x into that formula. This is not always easy. Another way is to take the difference between y₇ and y₈, 15, and share the difference appropriately over the distance 7 to 7.2 and 7.2 to 8. We can, for example, take ²/₁₀ of 15 = 3, add that to y₇ = 50, and obtain an estimated y₇ˌ₂ = 53. This is called linear interpolation, since the difference 0.2 in the value of x is used only to the first power. It is a good practical way to carry out most interpolation quickly and approximately.
Actually here y = x² + 1, and so the true value of y₇ˌ₂ is (7.2 × 7.2) + 1, or 52.84, which is rather close to 53. Types of interpolation procedures more accurate than linear interpolation will come much nearer still to the true value.
ALGEBRA OF LOGIC
We turn now to the algebra of logic. The first half of Chapter 9, “Reasoning” (through the section “Logical-Truth Calculation by Algebra”), introduces this subject. There the terms truth values, truth tables, logical connectives, and algebra of logic are explained. The part of Chapter 3, “A Machine That Will Think,” that discusses the operations greater-than and selection, also explains some of the algebra of logic. It introduces, for example, the formula
p = T(a > b) = 1, 0
This is a way of saying briefly that the truth value of the statement “a is greater than b” equals p; p is 1 if the statement is true and 0 if the statement is false. The truth value 1 corresponds with “yes.” The truth value 0 corresponds with “no.”
With mechanical brains we are especially interested in handling mathematics and logic without any sharp dividing line between them. For example, suppose that we have a register in which a ten-digit number like 1,765,438,890 may be stored. We should be able to use that register to store a number consisting of only 1’s and 0’s, like 1,100,100,010. Such a number may designate the answers to 10 successive questions: yes, yes, no, no, yes, no, no, no, yes, no. Or it may tell 10 successive binary digits. The register then is three times as useful: it can store either decimal numbers or truth values or binary digits. We need, of course, a way to obtain from the register any desired digit. For this purpose we may have two instructions to the machine: (1) read the left-hand end digit; (2) shift the number around in a circle. The second instruction is the same as multiplying by 10 and then putting the left-most digit at the right-hand end. For example, suppose that we want the 3rd digit from the left in 1,100,100,010. The result of the first circular shift is 1,001,000,101; the result of the second circular shift is 0,010,001,011; and reading the left-most digit gives 0. A process like this has been called extraction and is being built into the newest mechanical brains.
Using truth values, we can put down very neatly some truths of ordinary algebra. For example:
- (the absolute value of a) =
- a × (the truth of a greater than or equal to 0)
- - a × (the truth of a less than 0)
|a| = a · T(a ≥ 0) - a · T(a < 0)
For another example:
- Either a is greater than b,
- or else a equals b,
- or else a is less than b
T(a > b) + T(a = b) + T(a < b) = 1
Many common logical operations, like selecting and comparing, and the behavior of many simple mechanisms, like a light or a lock, can be expressed by truth values. Chapter 4, on punch-card mechanisms, contains a number of examples.
pronoun, variable
In ordinary language, a pronoun, like “he,” “she,” “it,” “the former,” “the latter,” is a word that usually stands for a noun previously referred to. A pronoun usually stands for the last preceding noun that the grammar allows. In mathematics, a variable, like “a,” “b,” “x,” “m₁,” “m₂” closely resembles a pronoun in ordinary language. A variable is a symbol that usually stands for a number previously referred to, and usually it stands for the same number throughout a particular discussion.
multiplicand, dividend, augend, etc.
| In the Equation |
The Name of a is: |
The Name of b is: |
The Name of c is: |
|---|---|---|---|
| a + b = c | augend | addend | sum |
| a - b = c | minuend | subtrahend | remainder |
| a × b = c | multiplicand | multiplier | product |
| a ÷ b = c | dividend | divisor | quotient |
Augend and addend are names of registers in the Harvard Mark II calculator (see Chapter 10).
subtraction by adding, nines complement
Two digits that add to 9 (0 and 9, 1 and 8, 2 and 7, 3 and 6, 4 and 5) are called nines complements of each other. The nines complement of a number a is the number b in which each digit of b is the nines complement of the corresponding digit of a; for example, the nines complement of 173 is 826. Ordinary subtraction is the same as addition as of the nines complement, with a simple correction; for example, 562 less 173 (equal to 389) is the same as 562 plus 826 (equal to 1388) less 1000 plus 1.
end-around-carry
The correction “less 1000 plus 1” of the foregoing example may be thought of as carrying the 1 (in the result 1388) around from the left-hand end to the right-hand end, where it is there added. So the 1 is called end-around-carry.
tens complement
Two digits that add to 10 are called tens complements of each other. The tens complement of a number a, however, is equal to the nines complement of the number plus 1. For example, the tens complement of 173 is 827. When subtracting by adding a tens complement, the left-most digit 1 in the result is dropped. For example, 562 less 173 (equal to 389) is the same as 562 plus 827 (equal to 1389) less 1000.
power, square, cube, reciprocal, etc.
A power of any number a is a multiplied by itself some number of times. a × a × a ... × a where a appears b times is written aᵇ and is read a to the bth power. a², a to the 2nd power, is a × a and is called a squared or the square of a. a³, a to the 3rd power, a × a × a, is called a cubed, or the cube of a. a⁰, a to the zero power, is equal to 1 for every a. a¹, a to the power 1, is a itself. The first power is often called linear. a to some negative power is the same as 1 divided by that power; that is, a⁻ᵇ = 1/aᵇ. a⁻¹, a to the power minus 1, is 1/a, and is called the reciprocal of a. a¹ᐟ², a to the one-half power, is a number c such that c × c = a, and is called the square root of a and often denoted by √a.
table, tabular value, argument, etc.
An example of a table is:
| 0.025 | 0.03 | |
| 1 | 1.02500 | 1.03000 |
| 2 | 1.05063 | 1.06090 |
| 3 | 1.07689 | 1.09273 |
The numbers in the body of the table, called tabular values, depend on or are determined by the numbers along the edge of the table, called arguments. In this example, if 1, 2, 3 are choices of a number n, and if 0.025, 0.03 are choices of a number i, then each tabular value y is equal to 1 plus i raised to the nth power. n and i are also called independent variables, and y is called the dependent variable. The table expresses a function or formula or rule. The rule could be stated as: add i to 1; raise the result to the nth power.
constant
A number is said to be a constant if it has the same value under all conditions. For example, in the formula:
(area of a circle) = π × (radius)²,
π is a constant, equal to 3.14159 ...,
applying equally well to all circles.
infinity
Mathematics recognizes several kinds of infinity. One of them occurs when numbers become very large. For example, the quotient of 12 divided by a number x, as x becomes closer and closer to 0, becomes indefinitely large, and the limit is called infinity and is denoted ∞.
equation, simultaneous, linear
An example of two linear simultaneous equations is:
7x + 8t = 22
3x + 5t = 11
x and t are called unknowns—that is, unknown variables—because the objective of solving the equations is to find them. These equations are called simultaneous because they are to be solved together, at the same time, for values of x and t which will fit in both equations. The equations are called linear because the only powers of the unknowns that appear are the first power. Values that solve equations are said to satisfy them. It is easy to solve these two equations and find that x = 2 and t = 1 is their solution. But it is a long process to solve 10 linear simultaneous equations in 10 unknowns, and it is almost impossible (without using a mechanical brain) to solve 100 linear simultaneous equations in 100 unknowns.
derivative, integral,
differential equation, etc.
See the sections in Chapter 5 entitled “Differential Equations,” “Physical Problems,” and “Solving Physical Problems.” There these ideas and, to some extent, also the following ideas were explained: formula, equation, function, differential function, instantaneous rate of change, interval, inverse, integrating. See also a textbook on calculus. If y is a function of x, then a mathematical symbol for the derivative of y with respect to x is Dₓ y, and a symbol for the integral of y with respect to x, is ∫y dx. An integral with given initial conditions (see p. 83) is a definite integral.
exponential
A famous mathematical function is the exponential. It equals the constant e raised to the x power, eˣ, where e equals 2.71828.... The exponential lies between the powers of 2 and the powers of 3. It can be computed from:
| eˣ = 1 + | x² | + | x³ | + . . . |
| 1 · 2 | 1 · 2 · 3 |
It is a solution of the differential equation Dₓy = y. See also a textbook on calculus. The exponential to the base 10 is 10ˣ.
logarithm
Another important mathematical function is the logarithm. It is written log x or logₑ x and can be computed from the two equations:
log uv = log u + log v
| log(1 + x) = x - | x² | + | x³ | - . . . x² < 1 |
| 2 | 3 |
It is a solution of the differential equation Dₓy = 1/y. If y is the logarithm of x, then x is the antilogarithm of y. The logarithm to the base 10 of x, log₁₀ x, equals the logarithm to the base e of x, logₑ x, divided by logₑ 10. See also textbooks on algebra and calculus.
sine, cosine, tangent, antitangent
These also are important mathematical functions. The sine and cosine are solutions of the differential equation Dₓ(Dₓy) =-y and are written as sin x and cos x. They can be computed from
| sin x = x - | x³ | + | x⁵ | - . . . |
| 1 · 2· 3 | 1 · 2 · 3· 4· 5 | |||
| cos x = 1 - | x² | + | x₄ | - . . . |
| 1 · 2 | 1 · 2 · 3· 4 | |||
The tangent of x is simply sine of x divided by cosine of x. If y is the tangent of x, then x is the antitangent of y. See also references on trigonometry and on calculus. Trigonometric tables include sine, cosine, tangent, and related functions.
Bessel functions
These are mathematical functions that were named after Friedrich W. Bessel, a Prussian astronomer who lived from 1784 to 1846. Bessel functions are found as some of the solutions of the differential equation
x² Dₓ(Dₓy) + x Dₓy + (x² - n²)y = O
This equation arises in a number of physical problems in the fields of electricity, sound, heat flow, air flow, etc.
matrix
A matrix is a table (or array) of numbers in rows and columns, for which addition, multiplication, etc., with similar tables is specially defined. For example, the matrix
| 1 | 2 | |
| 3 | 4 |
plus the matrix
| 5 | 20 | |
| 60 | 100 |
equals the matrix
| 6 | 22 | |
| 63 | 104 |
(Can you guess the rule defining addition?)
Calculations using matrices are useful in physics, engineering, psychology, statistics, etc. To add a square matrix of 100 terms in an array of 10 columns and 10 rows to another such matrix, 100 ordinary additions of numbers are needed. To multiply one such matrix by another, 1000 ordinary multiplications and 900 ordinary additions are needed. See references on matrix algebra and matrix calculus.
differences, smoothness, checking
On p. 221, a sequence of values of y is shown: 26, 37, 50, 65, 82. Suppose, however, the second value of y was reported as 47 instead of 37. Then the differences of y as we pass down the sequence would not be 11, 13, 15, 17 (which is certainly regular or smooth) but 21, 3, 15, 17 (which is certainly not smooth). The second set of differences would strongly suggest a mistake in the reporting of y. The smoothness of differences is often a useful check on a sequence of reported values.