Skip to content

thetkr/NoteG

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Note G Simulator

note-g-simulator is a small C++17 console programme for reproducing and inspecting the Note G calculations discussed in the Clueless Pundit investigation into Ada Lovelace, Operation 4, Line 24, B8, and the B36 overflow wall.

The project is meant to be cloned, built, run, and checked. It is not a full historical reconstruction of Babbage's Analytical Engine.

What This Investigates

Ada Lovelace's Note G describes a procedure for calculating Bernoulli numbers using Charles Babbage's proposed Analytical Engine. This simulator models enough of that world to make the important state changes visible:

  • Store columns hold values.
  • The Mill performs arithmetic.
  • Instruction-card-like actions move values between Store and Mill.
  • Historical variants preserve or repair selected rows in the Note G sequence.

The public verification target is modern B8, also described in this project as Ada's worked B7 target under the historical labelling convention.

What The Simulator Shows

The key public results are:

Check Result
Published sequence -139/630
Operation 4 repaired only 1/30
Operation 4 plus Line 24 repaired -1/30
Expected modern B8 reference -1/30
B36 wall -26315271553053477373 > 9223372036854775807

The Operation 4 issue is represented as:

published: V5 / V4 -> V11
repaired:  V4 / V5 -> V11

The Line 24 issue is represented as:

published: V13 + V24 -> V24
repaired:  V24 - V13 -> V24

The fully repaired path reaches the expected B8 value, -1/30.

What This Does Not Prove

This code does not prove that the Analytical Engine could or could not have been built. It does not claim exact physical card counts, exact machine timing, or absolute historical certainty about every transcription decision.

It does provide reproducible companion code for checking the arithmetic paths used in the article/video: the published row behaviour, the Operation 4 repair, the Line 24 repair, the B8 reference, and the fixed-width arithmetic limit near B36.

Build

CMake

From the repository root:

cmake -S . -B build
cmake --build build

The executable is named note-g-simulator. On Windows, CMake generators may place it under a configuration directory such as build/Debug/.

Direct g++ fallback

If you have a C++17-capable g++ on your path, this direct command also builds the simulator:

g++ -std=c++17 src/*.cpp -o note-g-simulator

Public Verification

The simplest public check is read-only and does not write CSV files:

./build/note-g-simulator --mode verify

Expected summary:

Published sequence: PASS
  expected: -139/630
  observed: -139/630
Operation 4 repaired only: PASS
  expected: 1/30
  observed: 1/30
Operation 4 plus Line 24 repaired: PASS
  expected: -1/30
  observed: -1/30
Expected B8 reference: PASS
  expected: -1/30
  observed: -1/30
Recurrence B8: PASS
  expected: -1/30
  observed: -1/30
B36 signed 64-bit wall: PASS
  expected: -26315271553053477373 > 9223372036854775807
  observed: -26315271553053477373 > 9223372036854775807
  overflow index: B36
  overflow operation: addition

Overall: PASS

You can also run the individual historical modes:

./build/note-g-simulator --mode note-g-method --variant original-bug --summary
./build/note-g-simulator --mode note-g-method --variant corrected-op4 --summary
./build/note-g-simulator --mode note-g-method --variant corrected-all --summary

And compare the modern recurrence reference with the generated Note G-style mode through B8:

./build/note-g-simulator --mode compare --n 8

To see the fixed-width B36 failure directly:

./build/note-g-simulator --mode compare --n 36

That command is expected to stop with an overflow-risk message at B36.

Arithmetic Model

The simulator uses exact rational arithmetic with a bounded long long numerator and denominator. That is intentional: it keeps the code small and makes exact fraction comparisons such as -1/30 possible without decimal drift.

double is not a clean substitute for this investigation because the point is to compare exact rational results and row-level sign/operand changes. A floating-point approximation can hide small exact differences and cannot represent values such as 1/30 exactly.

The B36 wall is a storage limit of this implementation, not a mathematical limit. The numerator:

-26315271553053477373

cannot fit in a signed 64-bit integer whose maximum is:

9223372036854775807

A later version could add an isolated arbitrary-precision rational type using boost::multiprecision::cpp_int, but this release deliberately documents the current fixed-width boundary instead of rewriting the arithmetic system.

See docs/b36-overflow.md for the focused B36 note.

Other Useful Commands

Trace the historical row execution:

./build/note-g-simulator --mode note-g-method --variant corrected-all --trace

Generate historical reports and trace artefacts:

./build/note-g-simulator --historical-report
./build/note-g-simulator --historical-report --export-traces

Generate resource-pressure reports:

./build/note-g-simulator --resource-pressure --historical-target
./build/note-g-simulator --feasibility-synthesis

Report-generating commands write files under results/. The committed results/ files are reference evidence for the article/video; ad hoc generated build artefacts and binaries are ignored.

Licence

This project is released under the MIT Licence. See LICENCE.

About

No description or website provided.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors