Assignment 1


Charles Babbages's Difference and Analytical Engines

Write out answers to each of these problems. You can write them out on paper, but I encourage you to test your solutions by using the Babbage difference engine and Babbage analytical engine the course web site.

  • Problem 1 - Programming the Difference Engine

    • 1.1 For each of the following two exercises (we did the progression of cubes in class), write out the Difference Engine program that generates the desired series: Hint: you can do these problems without knowing the polynomial by writing out the sequence and getting the differences, and then the differences of the differences, until you get to a non-changing value.

      • 1.1a The even integers: 0, 2, 4, 6, 8, 10, 12, 14, 16, ...
      • 1.1b The sum of the first N even integers: 0, 2, 6, 12, 20, 30, 42, 56, ...
    • 1.2 Spherical objects, such as cannonballs, can be stacked in many ways to form a pyramid. A “square-base pyramid” has a square number of cannonballs. For example, a cannonball pyramid with three layers has one cannonball at the top, which sits on top of a square composed of four cannonballs, which in turn sits on top of a square composed of nine cannonballs. The total number of cannonballs is a function of the number of layers. The number of cannonballs in an empty pyramid is 0, the number in a pyramid with one layer is 1, the number in a pyramid with two layers is 5 (from 1+4), the number in a pyramid of three layers is 14 (from 1+4+9), and so on. Program the Difference Engine to produce a table showing the number of cannonballs as the height increases.

  • Problem 2 — Programming the Analytical Engine

    • Solve the following three exercises:

      • 2.1 Trace the operation of the following program and determine the sequence of values that appear on the printer:

        N 0 1
        N 1 100000
        P 0
        +
        L 0
        L 0
        S 0
        -
        L 0
        L 1
        ?B 9
        

        What mathematical function is this program computing?

      • 2.2 Write a program that displays the cubes of the integer (0, 1, 8, 27, 64, 125, 216, and so on) up to the value of 10^3

      • 2.3 In the 13th century, the Italian mathematician Leonardo Fibonacci—as a way to explain the geometric growth of a population of rabbits—devised a mathematical sequence that now bears his name. The first two terms in this sequence are 0 and 1, and every subsequent term is the sum of the preceding two. Thus, the first several terms in the Fibonacci sequence look like this:

        0 1 1 2 3 5 8 13 21 34 55 89
        

        Write a program for the Analytical Engine that displays the first 30 terms in the Fibonacci sequence.

  • Problem 3 — The Babbage Machine and the von Neumann Architecture

    • In class, Chris mentioned that today’s machines are very similar in concept to Babbage’s Analytical Engine. If you’ve ever studied assembly language, you might be struck by how similar they are. Take a look at the Wikipedia article on the von Neumann architecture, and match the components of the Babbage Analytical Engine to the components mentioned in the bulleted list at the beginning of the article, repeated here for convenience:

      • A processing unit with both an arithmetic logic unit and processor registers
      • A control unit that includes an instruction register and a program counter
      • Memory that stores data and instructions
      • External mass storage
      • Input and output mechanisms

      (note: some of the von Neumann architecture components are not present on the Babbage alalytical engine)