4
$\begingroup$

The documentation for TuringMachine gives the following example of a machine specified by explicit transitions:

t = TuringMachine[
    {{state_,color_?EvenQ}:>{state,color/2,-1},{state_,color_?OddQ}:>{state,3 color+1,1}},
    {1,{1,2,3,4,5}},5];

But attempting to plot this with RulePlot[t] results in:

{{{1, 1, 0}, {1, 2, 3, 4, 5}}, {{1, 2, 1}, {4, 2, 3, 4, 5}}, {{1, 1, 
   0}, {4, 1, 3, 4, 5}}, {{1, 5, -1}, {2, 1, 3, 4, 5}}, {{1, 1, 
   0}, {2, 1, 3, 4, 16}}, {{1, 5, -1}, {1, 1, 3, 4, 16}}}

Why doesn't RulePlot understand the explicit transitions TuringMachine in the documentation?

$\endgroup$
2
  • $\begingroup$ ArrayPlot works: ArrayPlot[Last /@ t, PlotLegends -> Automatic] $\endgroup$
    – Bob Hanlon
    Jun 28, 2020 at 16:14
  • 1
    $\begingroup$ @BobHanlon: But why doesn't RulePlot? I don't see anything in the "documentation" that suggests that it wouldn't work. $\endgroup$
    – orome
    Jun 28, 2020 at 16:48

1 Answer 1

1
$\begingroup$

Unfortunately the following is not a solution, but an observation that grew too long for a comment. At first, I thought that the problem may be the fact that the initialization and number of steps should be given as arguments to RulePlot rather than to TuringMachine, so I tried:

Clear[separate]

separate := 
  RulePlot[
    TuringMachine[
      {{state_, color_?EvenQ} :> {state, color/2, -1},
       {state_, color_?OddQ} :> {state, 3 color + 1, 1}}
    ],
    {1, {1, 2, 3, 4, 5}}, 5
  ]

... but that failed as well.

Reading through the results of Trace@separate, it appears to me that the following check returning False causes RulePlot to decide to fail and return unevaluated:

NKSSpecialFunctions`RulePlot`Dump`ValidTuringMachineRulesQ[{
   {state_, color_?EvenQ} :> {state, color/2, -1}, 
   {state_, color_?OddQ} :> {state, 3 color + 1, 1}
}]

(* Out: False *)

None of these checks appear when one executes Trace@t using your definition of the TuringMachine.

$\endgroup$
3
  • 1
    $\begingroup$ So what's happening here? Is this another failure of the documentation, or another bug? $\endgroup$
    – orome
    Jun 28, 2020 at 19:07
  • $\begingroup$ The TuringMachine expression works, and RulePlot works with other forms of TuringMachine expressions, but not with this one, so I am leaning towards bug here. Unless somebody else comes up with a better explanation, I'd report it to WRI Support. $\endgroup$
    – MarcoB
    Jun 28, 2020 at 19:09
  • 5
    $\begingroup$ I'm weary of reporting bugs. Nearly every single thing I've ever tried as a simple experiment in Mathematica has uncovered a fundamental bug. I just got notification that one I uncovered in 2012 was finally fixed — 8 years later. $\endgroup$
    – orome
    Jun 28, 2020 at 19:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.