Re: Debugging Mathematica Code (Mathematica 7)
- To: mathgroup at smc.vnet.net
- Subject: [mg95581] Re: Debugging Mathematica Code (Mathematica 7)
- From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
- Date: Thu, 22 Jan 2009 06:59:10 -0500 (EST)
- Organization: Uni Leipzig
- References: <gl1okn$dpb$1@smc.vnet.net> <gl4a7r$gi7$1@smc.vnet.net> <gl71ps$c1f$1@smc.vnet.net>
- Reply-to: kuska at informatik.uni-leipzig.de
Hi, I have never had such a problem but you should open the debugger controls always before you send a code piece to the kernel. I really suggest the Wolfram Workbench debugger ! It works more like one would expect it if one use a compiled language like C++. Have a look at http://www.wolfram.com/broadcast/screencasts/workbench/debugging/ BTW We have stopped to make bugs in in the programs we wrote, because it turns out not to be useful at all ;-) Regards Jens m.g. wrote: > On 20 Jan., 12:57, Jens-Peer Kuska <ku... at informatik.uni-leipzig.de> > wrote: >> Hi, >> >> the Wolfram Workbench has an excellent debugger >> and there are situations where you need it. >> >> BTW: What is so complicated ? >> - go to the Evaluation Menu and open the Debugger >> - now type into a notebook >> >> foo[0] = 1 >> foo[n_Integer] /; n > 0 := n*foo[n - 1] >> >> use the mouse and mark in >> foo[n_Integer] /; n > 0 := n*foo[n - 1] >> the "foo[n - 1]" expression. >> >> Go to the debugger window and use >> "Break at selection" Now the "foo[n - 1]" >> has a red frame. >> >> Finally go to the notebook window and enter >> >> foo[4] >> >> as an input. And ... ta ta ta >> The Stack window show the stack >> and all is as it should. Now press "Continue" >> ind the debugger menu to see the next >> step in the recursion ... >> >> Regards >> Jens >> >> magma wrote: >>> No, there isn't a decent explanation. >>> You can check prior posts by me and others on debugging, but this is >>> the conclusion, basically. >>> Anyway, the general feeling among knowledgeable users is that you do >>> not really need a debugger. >>> These users just sprinkle print statements here and there to see >>> intermediate results. >>> I additionally also use On[] and Off[] which help me see clearly the >>> code flow. >>> You don't really need much more. >>> hth >>> On Jan 19, 12:36 pm, "m.g." <m... at michaelgamer.de> wrote: >>>> Hello Experts, >>>> I made my fist steps with the Mathematica (so called) debugger and= > st= >>> umbled >>>> immediately. Is there anywhrere a documentation of this tool that is >>>> worth it's name (a criterion which the Mathematica 7 documentatin on d= > ebu= >>> g >>>> surely fails). I've tried a lot, but I'm still at the stage "trial an >>>> error". >>>> Greetings >>>> Mike > > Hi Jens, > > thanks for the fast reply. I did exactly this what you described, > but: Sometimes it works, sometimes not. I used "step" and "step in", > to see waht the code does, but it seems that frequent swithceing > breakpoint on and of "irritates" the debugger and it's behavior gets a > bit, say, probabilisitc, and therefore I was looking for documentation > (for it could be my fault in missusing the tool without knowing there > is a missuse). So I returned to the insertion of Print-Statements. > > But I would like more to have a debugger which works well - it's more > easy and comfortable like the print-statement workaround. > > Greetings > > Mike >