@jim_r/

analytical_engine

Python

An emulation of Babbage's Analytical Engine, running Ada Lovelace's program for the computation of Bernoulli numbers.

fork
loading
Files
  • main.py
  • ada1.py
  • ada2.py
  • ada5.py
  • ada5z.py
  • ada6.py
  • ada6z.py
  • analytical_engine.py
  • enigma.py
  • factorial1.py
  • factorial2.py
  • factorial3.py
  • factorial3z.py
  • pi.py
  • sqrt.py
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# A simulation of Babbage's Analytical Engine running Ada Lovelace's program
# for calculating Bernoulli Numbers.
#
# This is the first published computer program from a paper published in 1843.
#
# See the articles on "Running the first program" at:
#
# Part 1: https://enigmaticcode.wordpress.com/2015/09/24/running-the-first-program/
# Part 2: https://enigmaticcode.wordpress.com/2015/10/14/running-the-first-program-part-2/
# Part 3: https://enigmaticcode.wordpress.com/2015/10/21/running-the-first-program-part-3/

import enigma
#enigma.run("ada1.py", 10) # Program 1: Python translation of Ada's program
#enigma.run("ada2.py", 10) # Program 2: Python transliteration of Ada's program
#enigma.run("factorial1.py", 12) # Program 3: Analytical Engine "op code" factorial program
#enigma.run("ada5.py") # Program 4: Analytical Engine "op code" version of Ada's program
#enigma.run("ada5z.py") # Program 4 variant: (destructive reads)
#enigma.run("factorial2.py", 40) # Program 5: Analytical Engine "op code" factorial program
#enigma.run("factorial3.py", 40) # Program 6: Analytical Engine "assembly" factorial program
#enigma.run("factorial3z.py", 40) # Program 6 variant: (destructive reads)
#enigma.run("sqrt.py", 2) # Analytical Engine "assembly" square root program
#enigma.run("pi.py") # Analytical Engine "assembly" program to calculate pi
#enigma.run("ada6.py") # Program 7: Analytical Engine "assembly" version of Ada's program
enigma.run("ada6z.py") # Program 7 variant: (destructive reads)