1

I'm on a Mac with OS 10.11.6 and I'm using Sage 7.2's notebook interface. I did things in Mathematica that I want to check in Sage, but I'm a beginner at Sage. In Mathematica it's possible to keep track of the execution of my code, especially to detect when it's hanging, by using the Mathematica Dynamic[] command. Is there anything like this command in Sage, or is there perhaps another way to track the progress of the execution of a lengthy computation that will let me know in real time if and when it hangs? At the moment I insert print commands in my code that result in thousands of tuples of values of a tuple of variables streaming vertically down my screen. Messy. I'd rather see the values of such a tuple simply update in place as they do, say, on a digital clock. This is what Dynamic[] achieves in Mathematica.

magma
  • 626
  • 5
  • 15

1 Answers1

0

Well, Mathematica doesn't have a debugger. So they tried to overcome this obstacle by introducing the Dynamic[] command. But when a programming language does have a debugger, why bother implementing something similar to Dynamic?

There are some ways to debug a sage code, you can refer to this other post for example. Also there is a built-in command, trace, that does a pretty similar job to Dynamic in Mathematica.

You can also refer to this (seemingly old) post for further information.

Community
  • 1
  • 1
polfosol ఠ_ఠ
  • 1,840
  • 26
  • 41
  • "why bother implementing something similar to Dynamic?" In my own case I frequently run programs that will take hours to execute. I need a real-time view of the progress of the execution of the code so I'll know when it hangs. Otherwise I don't know how long to wait before interrupting execution. I'm a mathematician--an end-user, in other words, not a programmer. I don't know if a debugger will do this for me. Will it? – Barry Brent Oct 04 '16 at 00:51
  • Trace does appear to inform me after a program actually crashes. But often in what I do, a program will just massively slow down at certain values of the parameters--without crashing. Trace won't tell me about that, will it? – Barry Brent Oct 04 '16 at 00:57
  • By the way, for me it's not a Sage vs Mathematica contest. As a basic check, I need to be able to replicate submitted work (done originally on one platform) on a second platform.So I want to be able to work in both. – Barry Brent Oct 04 '16 at 01:05
  • But the whole issue seems moot to me now. The "vertical streams" I mentioned in the question are not so messy after all. Sage truncates the column of values, so it's easy to arrange one's screen to keep the latest updates visible. – Barry Brent Oct 04 '16 at 01:39