Shashwat Singh
Prof. Brian L. Stuart
CS 164-A
November 21, 2016
Babbage Difference Engine Simulation
A difference engine is an automatic mechanical calculator designed to tab- ulate polynomial functions. The name derives from the method of divided differ- ences, a way to interpolate or tabulate functions by using a small set of polyno- mial coefficients. Most mathematical functions commonly used by engineers, sci- entists and navigators, including logarithmic and trigonometric functions, can be approximated by polynomials, so a difference engine can compute many useful tables of numbers. The historical difficulty in producing error-free tables by teams of mathematicians and human "computers" spurred Charles Babbage's desire to build a mechanism to automate the process. It is considered to be the world's first computer. Difference Engine Simulator ( Javascript ):
Approach:
• I created around 8-9 variables to store different values and assigned them to the various input boxes.
• Then I created a new ‘calculate()’ function and assigned it to the start button. Inside the calculate() function are inputs gathered from text boxes are assigned inside parseInt() and ParseFloat().
• Then I used ‘for’ loop inside the ‘calculate’ function in order to process and calculate the values, thus storing and outputting the values shown in the text box.
How it works:
• Initially there are total of 8 text boxes in the simulator.
• User must fill numbers in them and press the start button to com- pute.
• When the start button is pressed, the calculation will output in the large text box under the input fields with the number of rows mentioned in the “rows” input box.
• To re-start the whole process, user can press the reload button. Test:
• Attached below is the screenshot for the values given in the as- signment up to 100 rows.
• In addition to this, it was also tested with y = x4 ( — here derivatives are : y=0, ∆y = 0, ∆2y = 0 , ∆3y = 0, ∆4y = 24, ∆5y = 0 ) Data for y = x4
00000240
100024240
2002448240
30247272240
4249614496240
5120240240120240
6360480360144240
7840840504168240 816801344672192240
930242016864216240
10 5040 2880 1080 240 24 0
11 7920 3960 1320 264 24 0
12 11880 5280 1584 288 24 0
13 17160 6864 1872 312 24 0
14 24024 8736 2184 336 24 0
15 32760 10920 2520 360 24 0
16 43680 13440 2880 384 24 0
17 57120 16320 3264 408 24 0
18 73440 19584 3672 432 24 0
19 93024 23256 4104 456 24 0
20 116280 27360 4560 480 24 0
Simulator Link — http://www.pages.drexel.edu/~ss4335/engine.html References :
Difference Engine Intro. In Wikipedia. Retrieved November 20th 2016, from https://en.wikipedi- a.org/wiki/Difference_engine