Explanation of the Difference Engine
Those who are only familiar with ordinary arithmetic may, by following out with the pen some of the examples which will be given, easily make themselves acquainted with the simple principles on which the Difference Engine acts.
It is necessary to state distinctly at the outset, that the Difference Engine is not intended to answer special questions. Its object is to calculate and print a series of results formed according to given laws. These are called Tables—many such are in use in various trades. For example—there are collections of Tables of the amount of any number of pounds from 1 to 100lbs. of butchers’ meat at various prices per lb. Let us examine one of these Tables: viz.—the price of meat 5d. per lb., we find
Number.
Lbs.
Table.
Price.
s.
d.
1
0
5
2
0
10
3
1
3
4
1
8
5
2
1
There are two ways of computing this Table:—
1st. We might have multiplied the number of lbs. in each line by 5, the price per lb., and have put down the result in £ s. d., as in the 2nd column: or,
2nd. We might have put down the price of 1lb., which is 5d., and have added five pence for each succeeding lb.
Let us now examine the relative advantages of each plan. We shall find that if we had multiplied each number of lbs. in the Table by 5, and put down the resulting amount, then every number in the Table would have been computed independently. If, therefore, an error had been committed, it would not have affected any but the single tabular number at which it had been made. On the other hand, if a single error had occurred in the system of computing by adding five at each step, any such error would have rendered the whole of the rest of the Table untrue.
Thus the system of calculating by differences, which is the easiest, is much more liable to error. It has, on the other hand, this great advantage: viz., that when the Table has been so computed, if we calculate its last term directly, and if it agree with the last term found by the continual addition of 5, we shall then be quite certain that every term throughout is correct. In the system of computing each term directly, we possess no such check upon our accuracy.
Now the Table we have been considering is, in fact, merely a Table whose first difference is constant and equal to five. If we express it in pence it becomes—
Table.
1st Difference.
1
5
5
2
10
5
3
15
5
4
20
5
5
25
Any machine, therefore, which could add one number to another, and at the same time retain the original number called the first difference for the next operation, would be able to compute all such Tables.
Let us now consider another form of Table which might readily occur to a boy playing with his marbles, or to a young lady with the balls of her solitaire board.
The boy may place a row of his marbles on the sand, at equal distances from each other, thus—
He might then, beginning with the second, place two other marbles under each, thus—
He might then, beginning with the third, place three other marbles under each group, and so on; commencing always one group later, and making the addition one marble more each time. The several groups would stand thus arranged—
He will not fail to observe that he has thus formed a series of triangular groups, every group having an equal number of marbles in each of its three sides. Also that the side of each successive group contains one more marble than that of its preceding group.
Now an inquisitive boy would naturally count the numbers in each group and he would find them thus—
1,
3,
6,
10,
15,
21
He might also want to know how many marbles the thirtieth or any other distant group might contain. Perhaps he might go to papa to obtain this information; but I much fear papa would snub him, and would tell him that it was nonsense—that it was useless—that nobody knew the number, and so forth. If the boy is told by papa, that he is not able to answer the question, then I recommend him to pay careful attention to whatever that father may at any time say, for he has overcome two of the greatest obstacles to the acquisition of knowledge—inasmuch as he possesses the consciousness that he does not know—and he has the moral courage to avow it.
If papa fail to inform him, let him go to mamma, who will not fail to find means to satisfy her darling’s curiosity. In the meantime the author of this sketch will endeavour to lead his young friend to make use of his own common sense for the purpose of becoming better acquainted with the triangular figures he has formed with his marbles.
In the case of the Table of the price of butchers’ meat, it was obvious that it could be formed by adding the same constant difference continually to the first term. Now suppose we place the numbers of our groups of marbles in a column, as we did our prices of various weights of meat. Instead of adding a certain difference, as we did in the former case, let us subtract the figures representing each group of marbles from the figures of the succeeding group in the Table. The process will stand thus:—
Number of the Group.
Table.
1st Difference.
2nd Difference.
Number of Marbles in each Group.
Difference between the number of Marbles in each Group and that in the next.
1
1
1
1
2
3
2
1
3
6
3
1
4
10
4
1
5
15
5
1
6
21
6
7
28
7
It is usual to call the third column thus formed the column of first differences. It is evident in the present instance that that column represents the natural numbers. But we already know that the first difference of the natural numbers is constant and equal to unity. It appears, therefore, that a Table of these numbers, representing the group of marbles, might be constructed to any extent by mere addition—using the number 1 as the first number of the Table, the number 1 as the first Difference, and also the number 1 as the second Difference, which last always remains constant.
Now as we could find the value of any given number of pounds of meat directly, without going through all the previous part of the Table, so by a somewhat different rule we can find at once the value of any group whose number is given.
Thus, if we require the number of marbles in the fifth group, proceed thus:—
Take the number of the group
5
Add 1 to this number, it becomes
6
Multiply these numbers together
2)30
Divide the product by 2
1
This gives 15, the number of marbles in the 5th group.
If the reader will take the trouble to calculate with his pencil the five groups given above, he will soon perceive the general truth of this rule.
We have now arrived at the fact that this Table—like that of the price of butchers’ meat—can be calculated by two different methods. By the first, each number of the Table is calculated independently: by the second, the truth of each number depends upon the truth of all the previous numbers.
Perhaps my young friend may now ask me, What is the use of such Tables? Until he has advanced further in his arithmetical studies, he must take for granted that they are of some use. The very Table about which he has been reasoning possesses a special name—it is called a Table of Triangular Numbers. Almost every general collection of Tables hitherto published contains portions of it of more or less extent.
Above a century ago, a volume in small quarto, containing the first 20,000 triangular numbers, was published at the Hague by E. De Joncourt, A.M., and Professor of Philosophy. I cannot resist quoting the author’s enthusiastic expression of the happiness he enjoyed in composing his celebrated work:
“The Trigonals here to be found, and nowhere else, are exactly elaborate. Let the candid reader make the best of these numbers, and feel (if possible) in perusing my work the pleasure I had in composing it.
“That sweet joy may arise from such contemplations cannot be denied. Numbers and lines have many charms, unseen by vulgar eyes, and only discovered to the unwearied and respectful sons of Art. In features the serpentine line (who starts not at the name) produces beauty and love; and in numbers, high powers, and humble roots, give soft delight.
“Lo! the raptured arithmetician! Easily satisfied, he asks no Brussels lace, nor a coach and six. To calculate, contents his liveliest desires, and obedient numbers are within his reach.”
I hope my young friend is acquainted with the fact—that the product of any number multiplied by itself is called the square of that number. Thus 36 is the product of 6 multiplied by 6, and 36 is called the square of 6. I would now recommend him to examine the series of square numbers:
1,
4,
9,
16,
25,
36,
49,
64,
etc.,
and to make, for his own instruction, the series of their first and second differences, and then to apply to it the same reasoning which has been already applied to the Table of Triangular Numbers.
When he feels that he has mastered that Table, I shall be happy to accompany mamma’s darling to Woolwich or to Portsmouth, where he will find some practical illustrations of the use of his newly-acquired numbers. He will find scattered about in the Arsenal various heaps of cannon balls, some of them triangular, others square or oblong pyramids.
Looking on the simplest form—the triangular pyramid—he will observe that it exactly represents his own heaps of marbles placed each successively above one another until the top of the pyramid contains only a single ball.
The new series thus formed by the addition of his own triangular numbers is—
Number.
Table.
1st Difference.
2nd Difference.
3rd Difference.
1
1
3
3
1
2
4
6
4
1
3
10
10
5
1
4
20
15
6
5
35
21
6
56
He will at once perceive that this Table of the number of cannon balls contained in a triangular pyramid can be carried to any extent by simply adding successive differences, the third of which is constant.
The next step will naturally be to inquire how any number in this Table can be calculated by itself. A little consideration will lead him to a fair guess; a little industry will enable him to confirm his conjecture.
It will be observed at the start of this section that in order to find independently any number of the Table of the price of butchers’ meat, the following rule was observed:—
Take the number whose tabular number is required.
Multiply it by the first difference.
This product is equal to the required tabular number.
Again, the rule for finding any triangular number was:—
Take the number of the group
5
Add 1 to this number, it becomes
6
Multiply these numbers together
2)30
Divide the product by 2
15
This is the number of marbles in the 5th group.
Now let us make a bold conjecture respecting the Table of cannon balls, and try this rule:—
Take the number whose tabular number is required, say
5
Add 1 to that number
6
Add 1 more to that number
7
Multiply all three numbers together
2)210
Divide by 2
105
The real number in the 5th pyramid is 35. But the number 105 at which we have arrived is exactly three times as great. If, therefore, instead of dividing by 2 we had divided by 2 and also by 3, we should have arrived at a true result in this instance.
The amended rule is therefore—
Take the number whose tabular number is required, say
n
Add 1 to it
n
+
1
Add 1 to this
n
+
2
Multiply these three numbers together
n
×
(
n
+
1
)
×
(
n
+
2
)
Divide by 1 × 2 × 3. The result is
n
×
(
n
+
1
)
×
(
n
+
2
)
6
This rule will, upon trial, be found to give correctly every tabular number.
By similar reasoning we might arrive at the knowledge of the number of cannon balls in square and rectangular pyramids. But it is presumed that enough has been stated to enable the reader to form some general notion of the method of calculating arithmetical Tables by differences which are constant.
It may now be stated that mathematicians have discovered that all the Tables most important for practical purposes, such as those relating to Astronomy and Navigation, can, although they may not possess any constant differences, still be calculated in detached portions by that method.
Hence the importance of having machinery to calculate by differences, which, if well made, cannot err; and which, if carelessly set, presents in the last term it calculates the power of verification of every antecedent term.