MathGroup Archive 2008

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Debugging Mathematica

  • To: mathgroup at smc.vnet.net
  • Subject: [mg94697] Re: [mg94654] Debugging Mathematica
  • From: "David Park" <djmpark at comcast.net>
  • Date: Sat, 20 Dec 2008 06:23:35 -0500 (EST)
  • References: <7272378.1229691076470.JavaMail.root@m02>

Nikolaus,

I know there are various sophisticated debugging tools but when developing
routines I have never found it necessary to use anything other than
temporary Print statements. With a Print statement you can display whatever
you wish, in whatever form you wish. So:

f[x_,y_] := Module[{a,b}, ...; Print[First[a]]; ...]

Also when developing a routine I often add statements one by one and test
each time to make certain the intermediate results are what I was expecting.


David Park
djmpark at comcast.net
http://home.comcast.net/~djmpark/  


From: Nikolaus Rath [mailto:Nikolaus at rath.org] 


Hello,

I have trouble debugging a function that I wrote. The function is of the =
form

f[x_,y_] := Module[{a,b}, ...]

I am able to set a breakpoint in the function and Mathematica
correctly stops execution.

However, now I want to inspect the state of some local variables.
Unfortunately some of them have very large contents (~500 000 reals),
so when I open the stack and try to expand the "Local Variables" cell,
the frontend just hangs.

Is there a way to *selectively* display some of the local variables?
What I would like most is to be able to execute code in the current
stack frame, e.g. if I could simply evaluate a[[1]] in some notebook
to get the first element of the local variable a. Is that possible?

I am using Mathematica 7.

Best,

   -Nikolaus

--
 =C2=BBIt is not worth an intelligent man's time to be in the majority.
  By definition, there are already enough people to do that.=C2=AB
                                                         -J.H. Hardy

  PGP fingerprint: 5B93 61F8 4EA2 E279 ABF6  02CF A9AD B7F8 AE4E 425C




  • Prev by Date: Re: Problem with the range of a plot
  • Next by Date: Re: Need Help
  • Previous by thread: Re: Debugging Mathematica
  • Next by thread: Re: Debugging Mathematica