TracePrint does not work as in my book

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
4
down vote

favorite












I am using Mathematica 11.3



Here is an my execution of code from book "Essentials of Programming in Mathematica" (Fibonacci numbers):



F[1]=1;
F[2]=1;
F[n_]:=F[n-2]+F[n-1]
Table[F[i],i,1,26]



1,1,2,3,5,8,13,21,34,55,89,144,233,377,610,987,1597,2584,4181,6765,10946,17711,28657,46368,75025,121393




TracePrint[F[4],F[_Integer]F[_]+F[_]]



3




But instead, the book has:





Question:



Why my I am not getting that step by step execution like in the book when executing TracePrint part?










share|improve this question



























    up vote
    4
    down vote

    favorite












    I am using Mathematica 11.3



    Here is an my execution of code from book "Essentials of Programming in Mathematica" (Fibonacci numbers):



    F[1]=1;
    F[2]=1;
    F[n_]:=F[n-2]+F[n-1]
    Table[F[i],i,1,26]



    1,1,2,3,5,8,13,21,34,55,89,144,233,377,610,987,1597,2584,4181,6765,10946,17711,28657,46368,75025,121393




    TracePrint[F[4],F[_Integer]F[_]+F[_]]



    3




    But instead, the book has:





    Question:



    Why my I am not getting that step by step execution like in the book when executing TracePrint part?










    share|improve this question

























      up vote
      4
      down vote

      favorite









      up vote
      4
      down vote

      favorite











      I am using Mathematica 11.3



      Here is an my execution of code from book "Essentials of Programming in Mathematica" (Fibonacci numbers):



      F[1]=1;
      F[2]=1;
      F[n_]:=F[n-2]+F[n-1]
      Table[F[i],i,1,26]



      1,1,2,3,5,8,13,21,34,55,89,144,233,377,610,987,1597,2584,4181,6765,10946,17711,28657,46368,75025,121393




      TracePrint[F[4],F[_Integer]F[_]+F[_]]



      3




      But instead, the book has:





      Question:



      Why my I am not getting that step by step execution like in the book when executing TracePrint part?










      share|improve this question















      I am using Mathematica 11.3



      Here is an my execution of code from book "Essentials of Programming in Mathematica" (Fibonacci numbers):



      F[1]=1;
      F[2]=1;
      F[n_]:=F[n-2]+F[n-1]
      Table[F[i],i,1,26]



      1,1,2,3,5,8,13,21,34,55,89,144,233,377,610,987,1597,2584,4181,6765,10946,17711,28657,46368,75025,121393




      TracePrint[F[4],F[_Integer]F[_]+F[_]]



      3




      But instead, the book has:





      Question:



      Why my I am not getting that step by step execution like in the book when executing TracePrint part?







      recursion debugging






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Sep 25 at 6:16









      Henrik Schumacher

      40.7k257122




      40.7k257122










      asked Sep 25 at 6:14









      vasili111

      32917




      32917




















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          4
          down vote



          accepted










          That's probably a typo in the book. The pattern F[_Integer] F[_] + F[_] does not occur in during the evaluation of F[4].



          The code should look like this (notice the |):



          TracePrint[F[4], F[_Integer] | F[_] + F[_]]





          share|improve this answer




















            Your Answer




            StackExchange.ifUsing("editor", function ()
            return StackExchange.using("mathjaxEditing", function ()
            StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix)
            StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
            );
            );
            , "mathjax-editing");

            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "387"
            ;
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function()
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled)
            StackExchange.using("snippets", function()
            createEditor();
            );

            else
            createEditor();

            );

            function createEditor()
            StackExchange.prepareEditor(
            heartbeatType: 'answer',
            convertImagesToLinks: false,
            noModals: false,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: null,
            bindNavPrevention: true,
            postfix: "",
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );













             

            draft saved


            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmathematica.stackexchange.com%2fquestions%2f182532%2ftraceprint-does-not-work-as-in-my-book%23new-answer', 'question_page');

            );

            Post as a guest






























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes








            up vote
            4
            down vote



            accepted










            That's probably a typo in the book. The pattern F[_Integer] F[_] + F[_] does not occur in during the evaluation of F[4].



            The code should look like this (notice the |):



            TracePrint[F[4], F[_Integer] | F[_] + F[_]]





            share|improve this answer
























              up vote
              4
              down vote



              accepted










              That's probably a typo in the book. The pattern F[_Integer] F[_] + F[_] does not occur in during the evaluation of F[4].



              The code should look like this (notice the |):



              TracePrint[F[4], F[_Integer] | F[_] + F[_]]





              share|improve this answer






















                up vote
                4
                down vote



                accepted







                up vote
                4
                down vote



                accepted






                That's probably a typo in the book. The pattern F[_Integer] F[_] + F[_] does not occur in during the evaluation of F[4].



                The code should look like this (notice the |):



                TracePrint[F[4], F[_Integer] | F[_] + F[_]]





                share|improve this answer












                That's probably a typo in the book. The pattern F[_Integer] F[_] + F[_] does not occur in during the evaluation of F[4].



                The code should look like this (notice the |):



                TracePrint[F[4], F[_Integer] | F[_] + F[_]]






                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Sep 25 at 6:24









                Henrik Schumacher

                40.7k257122




                40.7k257122



























                     

                    draft saved


                    draft discarded















































                     


                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmathematica.stackexchange.com%2fquestions%2f182532%2ftraceprint-does-not-work-as-in-my-book%23new-answer', 'question_page');

                    );

                    Post as a guest













































































                    Popular posts from this blog

                    How to check contact read email or not when send email to Individual?

                    Displaying single band from multi-band raster using QGIS

                    How many registers does an x86_64 CPU actually have?