How can I evaluate the variables in the loop

How can I evaluate the variables in the loop - Messages

#1 Posted: 9/10/2021 9:24:11 AM
Andrey

Andrey

1 likes in 44 posts.

Group: User

Dear Smath-experts,

How can I evaluate the variables in the loop in SMATH?
I want to see how the variables are changing in the loop like in python.
Is what debug is for, but how does it work?

How_works_debuging.png

Best regards,
Andrey
#2 Posted: 9/10/2021 9:40:07 AM
Davide Carpi

Davide Carpi

1416 likes in 2873 posts.

Group: Moderator

You can either use the function trace() to show some specific variables (data will be shown in the "output" window on the fly without stopping evaluations) or use the debugger. This is more in "Visual Studio IDE style" and shows you the whole context in a specific point (the breakpoint); this means that the execution is paused when those points are evaluated. To add/remove a breakpoint you can use the context menu (mouse right-click)
If you like my plugins please consider to support the program buying a license; for personal contributions to me: paypal.me/dcprojects
#3 Posted: 9/10/2021 1:50:44 PM
Jean Giraud

Jean Giraud

983 likes in 6866 posts.

Group: User

Wrote

I want to see how the variables are changing in the loop


You can see it outside the loop, same more vivid.
Cheers ... Jean.

0Anim Landing.sm (56 KiB) downloaded 39 time(s).



#4 Posted: 9/10/2021 5:28:15 PM
Oscar Campo

Oscar Campo

124 likes in 298 posts.

Group: Moderator

Wrote

Dear Smath-experts,

How can I evaluate the variables in the loop in SMATH?
I want to see how the variables are changing in the loop like in python.
Is what debug is for, but how does it work?

...

Best regards,
Andrey



Hi Andrey, you can use trace() for check how variables are changing in the loop:

trace.png

Regards,

Oscar
#5 Posted: 9/10/2021 9:18:10 PM
Jean Giraud

Jean Giraud

983 likes in 6866 posts.

Group: User

... for convenience make it algo style collapsed in utilities.
Thus, you will have it from in-situ command line.
Cheers ... Jean.

Utilities Discrete CUMULATIVE algo.sm (4 KiB) downloaded 29 time(s).
#6 Posted: 9/10/2021 9:34:41 PM
Jean Giraud

Jean Giraud

983 likes in 6866 posts.

Group: User

... explore/practice

Utilities Discrete CUMULATIVE algo.sm (5 KiB) downloaded 36 time(s).
#7 Posted: 9/11/2021 9:58:36 AM
Jean Giraud

Jean Giraud

983 likes in 6866 posts.

Group: User

Thanks Oscar for trace.
I couldn't make it produce SS 6179.
Was good idea to refactor my old vintage.
Cheers ... Jean.

Utilities Discrete CUMULATIVE algo.sm (14 KiB) downloaded 29 time(s).
#8 Posted: 9/11/2021 10:37:47 AM
overlord

overlord

552 likes in 1332 posts.

Group: Moderator

trace() or breakpoints are usually de-facto way to go.
Alternatively you can store variables to a matrix.

Regards

2021-09-11_16-39.png
  • New Posts New Posts
  • No New Posts No New Posts