TracePrint does not work as in my book
Clash 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?
recursion debugging
add a comment |Â
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?
recursion debugging
add a comment |Â
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?
recursion debugging
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
recursion debugging
edited Sep 25 at 6:16
Henrik Schumacher
40.7k257122
40.7k257122
asked Sep 25 at 6:14
vasili111
32917
32917
add a comment |Â
add a comment |Â
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[_]]
add a comment |Â
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[_]]
add a comment |Â
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[_]]
add a comment |Â
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[_]]
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[_]]
answered Sep 25 at 6:24
Henrik Schumacher
40.7k257122
40.7k257122
add a comment |Â
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password