MATHEMATICS

Senin, 17 Januari 2011

URM Emulator - Continued

I completed the URM Emulator in Mathematica. Amazingly little code is required to emulate an URM, and thus a real computer. Example:

Input
{3,4,3,0,0}

Program
{{j,1,3,12},{j,2,3,11},{c,1,3},{s,5},{j,2,5,11},{z,4},{s,3},{s,4},{j,1,4,4},{j,1,1,7},{c,3,1}}
( performs multiplication of r1 and r2 )

Memory-trace
{3,4,3,0,0}
{3,4,3,0,1}
{3,4,3,0,1}
{3,4,4,0,1}
{3,4,4,1,1}
{3,4,5,1,1}
{3,4,5,2,1}
{3,4,6,2,1}
{3,4,6,3,1}
{3,4,6,3,2}
{3,4,6,0,2}
{3,4,7,0,2}
{3,4,7,1,2}
{3,4,8,1,2}
{3,4,8,2,2}
{3,4,9,2,2}
{3,4,9,3,2}
{3,4,9,3,3}
{3,4,9,0,3}
{3,4,10,0,3}
{3,4,10,1,3}
{3,4,11,1,3}
{3,4,11,2,3}
{3,4,12,2,3}
{3,4,12,3,3}
{3,4,12,3,4}
{12,4,12,3,4}

About time to look at the differences between a URM and a pure Turing Machine.

P.S.
Since 4 out of 9 questions of M381 TMA01 are about URMs I don't list the Mathematica code here, but that is logical anyway.

Tidak ada komentar:

Posting Komentar