Skip to content

Digital-Physics/turing-machine-sqrt

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 

Repository files navigation

This is a visual implementing of a Turing Machine simulation that computes the square root of 2.

A brief note on how it works:

-There are "E cells" and "F cells" interwoven on the tape.
-The F cells are used to write the bits of the binary expansion of the square root of 2, as they are computed. Once the bit is written in an F cell the m-configuration rules are such that it is never overwritten. (i.e. it is the next bit of sqrt(2))
-The E cells are used for work purposes and as a way to flag adjacent F cells with relevant numbers on the tape.
-The sqrt(2) is an irrational number, yet it is computable, as demonstrated by this very program.
-The calculation takes the current binary representation of sqrt(2) (e.g. 1.011) and assumes the next digit in its bit sequence is going to be 1, not a 0.
-Then it multiplies the number by itself. If the resulting number is greater than 2, its truncated expansion assuming the next bit is 1 results in a value that is already larger than 2. If that's the case the next bit in the binary epansion will be 0 when it is actually written in the next F cell. If assuming the next bit in the sequence was 1 resulted in a squareed number number that is less than 2, it actually writes the the 1 it was implicitly assuming while computing the multiplication on the next F cell.

See chapter 6 in the book "The Annotated Turing" by Charles Petzold for more details.

The site is hosted here:

https://turing-machine-sqrt.onrender.com/

About

A visualization of a Turing Machine computing the square root of 2 in binary

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages