{"id":13411414,"url":"https://github.com/simonjwright/analytical-engine","last_synced_at":"2025-03-14T17:30:48.815Z","repository":{"id":135312005,"uuid":"60040770","full_name":"simonjwright/analytical-engine","owner":"simonjwright","description":"An Ada 2012 emulation of Charles Babbage’s Analytical Engine","archived":false,"fork":false,"pushed_at":"2022-05-13T16:21:11.000Z","size":113,"stargazers_count":13,"open_issues_count":2,"forks_count":3,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-10T16:55:22.568Z","etag":null,"topics":["ada","emulator","gmp"],"latest_commit_sha":null,"homepage":"","language":"Ada","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/simonjwright.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"COPYING.RUNTIME","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2016-05-30T21:47:51.000Z","updated_at":"2025-02-21T06:20:32.000Z","dependencies_parsed_at":null,"dependency_job_id":"b9787820-afcb-4554-b232-1f78801e2b5d","html_url":"https://github.com/simonjwright/analytical-engine","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simonjwright%2Fanalytical-engine","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simonjwright%2Fanalytical-engine/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simonjwright%2Fanalytical-engine/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simonjwright%2Fanalytical-engine/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/simonjwright","download_url":"https://codeload.github.com/simonjwright/analytical-engine/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243618616,"owners_count":20320268,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ada","emulator","gmp"],"created_at":"2024-07-30T20:01:13.509Z","updated_at":"2025-03-14T17:30:48.441Z","avatar_url":"https://github.com/simonjwright.png","language":"Ada","funding_links":[],"categories":["Applications"],"sub_categories":["Shells, Interpreters and Emulators"],"readme":"# Analytical Engine Emulator\n\nThis is an Ada translation of the Java emulator at\n[Fourmilab](http://www.fourmilab.ch/babbage/).\n\nIn due course, it is hoped to create a web-based emulator (using\n[Gnoga](http://www.gnoga.com)). In the mean time, there is a command\nline based version.\n\n## Copying\n\nThe Java source of the Fourmilab emulator is included in this\nrepository for reference (in the `fourmilab/` subdirectory); the\nAnalytical Engine code's author states _Emulator source code is\nintended for experienced Java developers, and is utterly\nunsupported. The program is in the public domain and you can do\nanything you like with it, but you're entirely on your own._, while\n`BigInt.java` is copyrighted by the Massachusetts Institute of\nTechnology.\n\nThe Ada source is licensed under the\n[GNU General Public License (version 3)][] with the\n[GCC Runtime Library exception][].\n\n[GNU General Public License (version 3)]: http://www.gnu.org/licenses/gpl.html\n[GCC Runtime Library exception]: http://www.gnu.org/licenses/gcc-exception-faq.html\n\n## Building\n\nThe Ada emulator is written using [Ada2012][], and uses the\n[GNU Multiple Precision Arithmetic library][], via the\n[GMP binding in GNATCOLL][].\n\nIf you have one of the [FSF GCC binaries for OS X][] (6.1 or later), a\nsuitable library is provided. Otherwise, GMP and GNATCOLL are\nreasonably straightforward to build.\n\n[Ada2012]: http://www.ada-auth.org/standards/rm12_w_tc1/html/RM-TOC.html\n\n[GNU Multiple Precision Arithmetic library]: https://gmplib.org\n\n[GMP binding in GNATCOLL]: https://github.com/AdaCore/gnatcoll/blob/master/src/gmp/gnatcoll-gmp-integers.ads\n\n[FSF GCC binaries for OS X]: https://sourceforge.net/projects/gnuada/files/GNAT_GCC%20Mac%20OS%20X/\n\n## Running\n\nThere are three switches:\n\n  * `-h` or `--help`: outputs help.\n  * `-t` or `--trace`: trace execution (like card T1)\n  * `-z` or `--overwrite-nonzero`: allow storing to a non-zero column\n\nand, as usual, run by\n\n    ./aes [switches] [card-chain-file]\n\n(uses standard input if no card chain file is supplied).\n\nThe \"storing to a non-zero column\" issue is referenced in [this paper][]\nby Rainer Glaschick, section 3.5, Memory peculiarities. It would have\nbeen necessary to ensure that a column that was to be written to was\nzero beforehand; the operation of storing a value involved racks\ntransferring the value on the source to the destination as the source\ndigits were rotated back to zeros.\n\nIf `-z` is given, overwriting will be allowed; otherwise, an error\nwill be reported and execution will halt.\n\n[this paper]: http://rclab.de/rclab/_media/analyticalengine/aal_noteg_glaschick_v1.2.pdf\n\n## Programming Cards\n\nThe design here is as in the [Fourmilab Java implementation][]. To\ndate only the card types below have been implemented:\n\n  * Number Cards\n  * Operation Cards\n  * Variable Cards\n  * Stepping Up and Down Cards\n  * Combinatorial Cards\n  * Action Cards\n  * Comment Cards\n  * Attendant Request Cards:\n    * Calculation Trace Cards\n    * Numeric Output Format Cards\n    * Output Annotation Cards\n\nThese card types have not been implemented (yet):\n\n  * Curve Drawing Cards\n  * Attendant Request Cards:\n    * Advancing and Backing Block Cards\n    * Card Library Inclusion Requests\n    * Decimal Place Expansion Cards\n\nAs in the [Fourmilab Java implementation][], multiplication can be\nindicated by `*` or `×`, division by `/` or `÷`.\n\n[Fourmilab Java implementation]: https://www.fourmilab.ch/babbage/cards.html\n\nWhen counting for Combinatorial Cards (conditional and unconditional\njumps), remember that comment cards (blank cards, or cards starting\nwith a period or white space) need to be included!\n\n### Changes\n\n  * As a minor change, lower case can be used: `n001 42` is acceptable\n  (it stores 42 into column 1).\n  * Text after the required content is ignored, so comments can be included: `n001 42 the answer` is acceptable.\n\n## Examples\n\nThe file `bernouilli.ae` is an implementation of the Lovelace design\nin Note G of the [Sketch of the Analytical Engine][] (the last\nsection), with two errors corrected:\n\n  * in operation 4, the operands are reversed (it should be V4 / V5,\n    not V5 / V4).\n  * in operation 24, the result placed in V24 should be **-**V13.\n\nAAL's notes don't discuss the fact that the Engine only implemented\ninteger arithmetic, which means that a naive attempt at dividing 7 by\n9 at operation 4 will result in 0 remainder 7, not the 0.777777777 one\nmight have hoped for. To deal with this, all real values are scaled by\n10 decimal places;\n\n  * the precalculated value of B1, 0.1666666666, is stored as\n    1666666666, and similarly for B3, B5.\n  * dividends are scaled up by 10 decimal places.\n  * products are scaled down by 10 decimal places.\n\nFor more on this, see the notes on _Stepping Up and Down Cards_ in the\n[Fourmilab Java implementation][].\n\n[Sketch of the Analytical Engine]: https://www.fourmilab.ch/babbage/sketch.html\n\nThe file `bernouilli5.ae` adds another \"iteration\" to the above\nprogram; the previously computed B7 is stored on column 24, and\noperations 13 to 23 are repeated once more (now using column 24 as\ninput at operation 21).\n\nThe file `check_for_prime.ae` determines whether a number is\nprime. It's set to check 203 (AAL's 203rd birthday was in 2018).\n\n## Performance\n\nThe [Deep Learning with the Analytical Engine][] project, with the\n[Deep Learning with the Analytical Engine repository][], reports on an\n\n\u003e implementation of a convolutional neural network as a program for\n\u003e Charles Babbage's Analytical Engine, capable of recognising\n\u003e handwritten digits to a high degree of accuracy (98.5% if provided\n\u003e with a sufficient amount of training data and left running\n\u003e sufficiently long).\n\nThe program consists of over 400,000 cards! (it was generated by\nPython scripts from a high-level description). It requires `-z` to\nrun. As a timing test, the program was run for the first 10 images\nonly: in Java, this took 18 seconds, of which 10 seconds was initial\nprocessing, in Ada (where the initial processing was about a second)\nwith `-O0 -gnata` 44 seconds, with `-O2 -gnatp` 22 seconds. So the Ada\nimplementation is about 3 times slower than the Java one. More work to\nbe done!\n\n[Deep Learning with the Analytical Engine]: https://cp4space.wordpress.com/2016/02/06/deep-learning-with-the-analytical-engine/\n[Deep Learning with the Analytical Engine repository]: https://gitlab.com/apgoucher/DLAE\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsimonjwright%2Fanalytical-engine","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsimonjwright%2Fanalytical-engine","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsimonjwright%2Fanalytical-engine/lists"}